-
Notifications
You must be signed in to change notification settings - Fork 970
Description
Describe the bug
We are using AwsCrtAsyncHttpClient for DynamoDB API calls.
Everything was working fine, however after we upgraded to the new version of SDK we noticed, that over the time LeasedConcurrency metric value is growing steadily and when it reaches maximum capacity all API requests starting to fail with timeout exception apparently because client is not able to acquire new connections from the pool.
Another observation is that the speed of increase in LeasedConcurrency is correlated to the RetryCount, so it might be that connections from the failed requests are not properly released.
Expected Behavior
All connections are properly released and connection pool always has available connections
Current Behavior
Some connections are not properly released which leads to the lack of available connections
Reproduction Steps
var clientBuilder = DynamoDbAsyncClient.builder()
clientBuilder.overrideConfiguration(ClientOverrideConfiguration.builder()
.apiCallAttemptTimeout(Duration.ofMillis(dynamoDbConfiguration.getApiCallAttemptTimeout().toMillis()))
.apiCallTimeout(Duration.ofMillis(dynamoDbConfiguration.getApiCallTimeout().toMillis()))
.retryPolicy(RetryPolicy.builder()
.numRetries(dynamoDbConfiguration.getNumRetries())
.retryCondition(RetryCondition.defaultRetryCondition())
.build())
.addMetricPublisher(new DynamoDbDataDogMetricPublisher())
.build());
var client = clientBuilder.httpClient(AwsCrtAsyncHttpClient.builder()
.connectionMaxIdleTime(httpClientConfiguration.getConnectionMaxIdleTime())
.connectionTimeout(httpClientConfiguration.getConnectionTimeout())
.maxConcurrency(httpClientConfiguration.getMaxConcurrency())
.build());
Possible Solution
No response
Additional Information/Context
The last working SDK version is 2.18.34, so theoretically the change which caused the regression should be here:
2.18.34...2.18.35
The issue is reproducible on the latest SDK version 2.22.10.
AWS Java SDK version used
2.18.35
JDK version used
openjdk version "17.0.7" 2023-04-18 LTS OpenJDK Runtime Environment Zulu17.42+19-CA (build 17.0.7+7-LTS)
Operating System and version
Linux 6.1.61-85.141.amzn2023.x86_64