connection acquisition timeout description broken by NettyNioAsyncHttpClient #6013
Labels
documentation
This is a problem with documentation.
needs-triage
This issue or PR still needs to be triaged.
Describe the issue
If we read https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/http/SdkHttpConfigurationOption.html it says CONNECTION_ACQUIRE_TIMEOUT is
The implication being that this time does not need to worry about the time to actually form a connection, it's just retrieving one from pool and the timeout is if pool is full and it takes a while to get free.
But this is broken by NettyNioAsyncHttpClient, as shown by following (self contained, just have netty-nio-client compile dependency) snippet
which throws exception
Acquire operation took longer than 5000 milliseconds
, but the pool I made initially has no connections, this first time I try to do something should be in the connect case, and should timeout after 10s.Reason is simple enough, BetterFixedChannelPool does the right thing here, it only schedules timeoutTask if pool is full of connections, but HealthCheckedChannelPool which ultimately delegates to BetterFixedChannelPool, it unconditionally starts timer.
Essentially there is implicit assumption that actually acquireConnectionTimeout is at least size of connection timeout for this specific client, but this isn't enforced anywhere (and it's too late to change now probably), so it should be shouted out not to go setting this number to something small.
Will note that docs for https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/http/nio/netty/NettyNioAsyncHttpClient.Builder.html for corresponding method say
which is more nebulous, and could in principle mean they include the time to actually make a connection, so I don't have a gripe with that per se, but in tandem with the fact that this method is coupled to this config that explicitly says it's for picking up existing connections, I do think it should be made clearer.
Links
https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/http/nio/netty/NettyNioAsyncHttpClient.Builder.html and perhaps others
The text was updated successfully, but these errors were encountered: