Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose crt connection timeout #5835

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

Fred1155
Copy link
Contributor

Motivation and Context

CRT HTTP client Java binding added support for connection acquire timeout, we also need to expose the connectionAcquisitionTimeout field in crt http client and pass it through

Modifications

  1. Change the awscrt.version from 0.33.6 to 0.33.9
  2. Added connectionAcquisitionTimeout method in AwsCrtHttpClient.Builder and AwsCrtAsyncHttpClient.Builder
  3. Implemented connectionAcquisitionTimeout method in AwsCrtClientBuilderBase
  4. Pass through the connectionAcquisitionTimeout in AwsCrtHttpClientBase

Testing

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

@Fred1155 Fred1155 requested a review from a team as a code owner January 28, 2025 23:13
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
62.5% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@@ -140,7 +140,7 @@ public final class SdkHttpConfigurationOption<T> extends AttributeMap.Key<T> {
private static final Duration DEFAULT_SOCKET_READ_TIMEOUT = Duration.ofSeconds(30);
private static final Duration DEFAULT_SOCKET_WRITE_TIMEOUT = Duration.ofSeconds(30);
private static final Duration DEFAULT_CONNECTION_TIMEOUT = Duration.ofSeconds(2);
private static final Duration DEFAULT_CONNECTION_ACQUIRE_TIMEOUT = Duration.ofSeconds(10);
private static final Duration DEFAULT_CONNECTION_ACQUIRE_TIMEOUT = Duration.ofSeconds(50);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for this default value change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default value as 10 will fail the test in code build, but will succeed in my local machine. The time it takes for this test is around 30 seconds in code build, and I'm trying to figure out why that takes such a long time. This is just a test commit to check if increasing the default value will pass the test, and it passed. I'm trying to figure out a way to pass the test without changing the default value.

@@ -126,7 +128,8 @@ private HttpClientConnectionManager createConnectionPool(URI uri) {
.withManualWindowManagement(true)
.withProxyOptions(proxyOptions)
.withMonitoringOptions(monitoringOptions)
.withMaxConnectionIdleInMilliseconds(maxConnectionIdleInMilliseconds);
.withMaxConnectionIdleInMilliseconds(maxConnectionIdleInMilliseconds)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add some tests?

I know it's a bit hard to write a reliable test to verify the configuration itself, but maybe we can add tests to make sure we actually pass this to CRT?

@@ -100,6 +100,12 @@ public BuilderT connectionTimeout(Duration connectionTimeout) {
return thisBuilder();
}

public BuilderT connectionAcquisitionTimeout(Duration connectionAcquisitionTimeout) {
Validate.isPositive(connectionAcquisitionTimeout, "connectionAcquisitionTimeout");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add tests for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants