[
https://issues.apache.org/jira/browse/HTTPCLIENT-2028?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16970017#comment-16970017
]
Oleg Kalnichevski commented on HTTPCLIENT-2028:
-----------------------------------------------
[~pfrank13] This issue has been discussed on more than one occasion and I have
done my very best to explain the fallacy of expecting the stale check to be
100% reliable because it simply cannot be. No matter how short the
{{setValidateAfterInactivity}} is, even if it was 0, there is always a chance
of the connection becoming stale immediately after passing the test and before
request execution. There is always a window of time between a connection lease
operation and a request execution and during this period of time no matter how
short the connection can get closed by the opposite endpoint.
The problem is not the {{setValidateAfterInactivity}} but wrong expectations
about the purpose of the stale connection check. The stale connection check is
intended to reduce the noise of request execution failures due to the opposite
endpoint closing the connection but it is not a substitute for a reasonable
connection management strategy.
Oleg
> Restore staleConnectionCheckEnabled=true semantic behavior in
> validateAfterInactivity config
> --------------------------------------------------------------------------------------------
>
> Key: HTTPCLIENT-2028
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2028
> Project: HttpComponents HttpClient
> Issue Type: Improvement
> Components: HttpClient (classic)
> Affects Versions: 4.5, 4.5.1, 4.5.2, 4.5.3, 4.5.4, 4.5.5, 4.5.6, 4.5.7,
> 4.5.8, 4.5.9, 4.5.10
> Reporter: Peter Frank
> Priority: Major
>
> Between HttpClient 4.4.x and 4.5.x setStaleConnectionCheckEnabled was
> deprecated in favor of setValidateAfterInactivity. That's all fine, however,
> the implementation of setValidateAfterInactivity has no ability to check if a
> connection is stale all the time. The closest one can get is 1 ms, and
> that's unfortunately not short enough in a test environment scenario when a
> test Http Server is being restarted between Tests to clear out state.
> This is a common issue on the internet for people that use something like
> Wiremock, the irony is troubleshooting the situation makes it go away (cause
> logging slows the tests).
> I would suggest making 0 a special value to "turn on" validation all the time.
> With HttpClient 5 removing the old staleConnectionCheckEnabled completely
> with a piece of what that feature actually did also being removed I fear it
> will leave me, and perhaps others, in a bit of a lurch. Thanks!
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]