Repository navigation
HTTPCLIENT-2404: Add timeouts section to the HttpClient 5.6.x configuration guide - #48
Conversation
…ration guide Describe which timeout applies to each phase of a request, how the socket timeout set at different levels overrides each other, and that the timeouts limit inactivity rather than the total time of a request.
|
@shinseongsu I will review the change-set more thoroughly tomorrow but overall looks awesome!
This looks wrong. Both transports should behave consistently. Please raise a JIRA for this issue.
This sounds possible. One may need to be willing to run an extra watcher thread to enforce lease timeouts on an idle pool, but we should investigate if this is not a defect. Please raise a JIRA for this issue as well.
It would be really nice to have connection lifetime settings covered in more details, too. Please do so, if you have time and inclination to contribute that as well. |
|
Thanks for the quick feedback, @ok2c! I don't have a JIRA account yet — I've requested one and I'm waiting for it to be approved. Once I have access, I'll file two separate issues for:
and I think the discussion about both is best continued in those issues. I'll link them back here. I'll also take a look at covering the connection lifetime settings ( |
| None of these settings apply during the TLS handshake. The TLS handshake timeout is used | ||
| instead. | ||
|
|
||
| Response timeout may be unsupported by HTTP transports with message multiplexing such |
There was a problem hiding this comment.
@shinseongsu The HTTP/2 transport will support (conditionally) as of 5.7. I think this statement can be omitted
| | Host name resolution | none | - | | ||
| | TCP connect | [ConnectionConfig](/httpcomponents-client-5.6.x/current/httpclient5/apidocs/org/apache/hc/client5/http/config/ConnectionConfig.html) `connectTimeout` | 3 minutes | | ||
| | TLS handshake | [TlsConfig](/httpcomponents-client-5.6.x/current/httpclient5/apidocs/org/apache/hc/client5/http/config/TlsConfig.html) `handshakeTimeout` | the connect timeout | | ||
| | Request and response exchange | the socket timeout, see [Socket Timeout](#Socket_Timeout) | 3 minutes (classic), no timeout (async) | |
There was a problem hiding this comment.
3 minutes (classic), no timeout (async)
@shinseongsu This looks wrong. Thank you for pointing that out. This should be fixed.
|
@shinseongsu Everything is fine as is. Thank you so much for this contribution. |
|
@shinseongsu Updated site content deployed to |
|
@ok2c I now have a JIRA account and filed the two issues:
I'll continue the discussion on both in those issues. I'll also look at covering the connection lifetime settings ( |
|
@shinseongsu I put together a fix for the default socket consistency problem: apache/httpcomponents-client#923 |
For HTTPCLIENT-2404.
Oleg suggested in the issue that this belongs in the configuration guide rather than a separate document, so I added a Timeouts section to the 5.6.x guide. It covers which timeout applies to each phase of a request, how the socket timeout set at different levels overrides each other, and that none of them is a deadline.
To make sure I wasn't just repeating my own assumptions, I tested each statement against 5.6.5 with a couple of local servers, one that never answers and one that sends the body a byte at a time. Times are in seconds:
Retries were off on the classic client. I can share the test program if that helps.
Before, the guide ends at the caching level:
After, with the new section in the red box:
Two things came up while testing that I left out of the guide, because I don't know if they're intended:
localhost(127.0.0.1 and ::1) the classic client waited 2x the handshake timeout.connectionRequestTimeoutdoesn't seem to fire unless something else happens in the pool. With a 1s timeout and the only connection stuck on a request that never finishes, the second request was still waiting after 10s. I couldn't find any caller ofvalidatePendingRequests(). If it's a bug I can open a separate issue.Should the connection lifetime settings (
timeToLive,idleTimeout, ...) go in here too, or is this enough for the issue?