Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
4.5.14
Description
Currently in edge cases the retry mechanism leveraging DefaultHttpRequestRetryHandler does not catch "Connection reset" exceptions. This is caused by
- A connection pool which keeps the connections alive for too long
- The reduced default validation of connections in https://hc.apache.org/httpcomponents-client-4.5.x/current/httpclient/apidocs/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.html: "The code now only checks the connection if the elapsed time since the last use of the connection exceeds the timeout that has been set. The default timeout is set to 2000ms"
The error scenario is as follows:
- A client opens a number of connection almost in parallel which exceed the number of retries
- then the connections are reused shortly before they are closed silently by some proxy or the server.
- Now the client tries to reuse those but runs into the "Connection reset" issue. Although it will retry through DefaultHttpRequestRetryHandler 3 different pooled connections they all suffer from the fact that they are not longer accepted (and therefore throw the same SocketException).
Maybe one could improve the resilience by calling https://hc.apache.org/httpcomponents-client-4.5.x/current/httpclient/apidocs/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.html#setValidateAfterInactivity(int) with 0 on the underlying connection pool manager until a connection is successfully established to that host again.
Attachments
Issue Links
- relates to
-
MRESOLVER-383 java.net.SocketException: Connection reset
- Closed