Skip to content

Add more connection TTL options to the Netty HTTP client #856

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

Closed
millems opened this issue Nov 20, 2018 · 3 comments
Closed

Add more connection TTL options to the Netty HTTP client #856

millems opened this issue Nov 20, 2018 · 3 comments
Labels
feature-request A feature should be added or improved.

Comments

@millems
Copy link
Contributor

millems commented Nov 20, 2018

Missing feature matrix:

Setting 1.11.x 2.0 (Sync, Apache) 2.0 (Async, Netty)
Connection TTL clientConfig.setConnectionTTL(...)clientConfig.withConnectionTTL(...) httpClientBuilder.connectionTimeToLive(...) Not Supported
Connection Max Idle clientConfig.setConnectionMaxIdleMillis(...)clientConfig.withConnectionMaxIdleMillis(...) httpClientBuilder.connectionMaxIdleTime(...) Not Supported
Validate After Inactivity clientConfig.setValidateAfterInactivityMillis(...)clientConfig.withValidateAfterInactivityMillis(...) Not Supported Not Supported
Connection Reaper clientConfig.setUseReaper(...)clientConfig.withReaper(...) httpClientBuilder.useIdleConnectionReaper(...) Not Supported
@Eyal-Shalev
Copy link

@millems is there a way to set the connection TTL on an async client without these functions?

@shorea
Copy link
Contributor

shorea commented Dec 3, 2018

These settings may or may not make sense for a NIO client. If a channel goes inactive it will remove itself from the pool as far as I know. Compare that to blocking IO where a connection may go inactive but we won't know that until the next time we use it, resulting in a failed request. Connection TTL makes sense for both. We should confirm the inactive behavior of channel before implementing the max idle, validate after inactivity, and idle reaper in NIO.

@Eyal-Shalev there is not a way to set connection TTL currently.

millems added a commit that referenced this issue Feb 4, 2019
1. Added support for `useIdleConnectionReaper`, `connectionTimeToLive` and `connectionMaxIdleTime` to the Netty HTTP client.
2. Enable the idle connection reaper by default for apache and netty clients. Connection time-to-live remains disabled by default.

Fixes #856
millems added a commit that referenced this issue Feb 4, 2019
1. Added support for `useIdleConnectionReaper`, `connectionTimeToLive` and `connectionMaxIdleTime` to the Netty HTTP client.
2. Enable the idle connection reaper by default for apache and netty clients. Connection time-to-live remains disabled by default.

Fixes #856
@justnance justnance added feature-request A feature should be added or improved. and removed Feature Request labels Apr 19, 2019
aws-sdk-java-automation added a commit that referenced this issue May 26, 2020
…9238122b

Pull request: release <- staging/ded8419e-b232-4779-9b6e-6acb9238122b
@JD557
Copy link

JD557 commented Jan 25, 2022

If a channel goes inactive it will remove itself from the pool as far as I know.

I don't think this is true. I'm having some issues with some code trying to call SageMaker with a long connectionMaxIdleTime/connectionTimeToLive.

The code worked fine on v1, but on v2 I notice that, if I make a request, wait ~1 minute and perform another request, I get an error:

java.util.concurrent.CompletionException: software.amazon.awssdk.core.exception.SdkClientException: Unable to execute HTTP request: Server failed to send complete response. The channel was closed. This may have been done by the client (e.g. because the request was aborted), by the service (e.g. because there was a handshake error, the request took too long, or the client tried to write on a read-only socket), or by an intermediary party (e.g. because the channel was idle for too long).

I assume that this is caused by SageMaker closing the connection, which is never revalidated and ends up being reused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved.
Projects
None yet
Development

No branches or pull requests

5 participants