[ https://issues.apache.org/jira/browse/HTTPCLIENT-2288?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Liam Miller-Cushon updated HTTPCLIENT-2288: ------------------------------------------- Summary: Retry logic in DefaultHttpClientConnectionOperator doesn't handle SocketException (was: DefaultHttpClientConnectionOperator) > Retry logic in DefaultHttpClientConnectionOperator doesn't handle > SocketException > --------------------------------------------------------------------------------- > > Key: HTTPCLIENT-2288 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2288 > Project: HttpComponents HttpClient > Issue Type: Bug > Components: HttpClient (classic) > Affects Versions: 4.5.14 > Reporter: Liam Miller-Cushon > Priority: Major > > DefaultHttpClientConnectionOperator has logic to try to connect to all > addresses that a particular host name resolves to: > [https://github.com/apache/httpcomponents-client/blob/7aca075c6e49c3d2f90dbca081d08ebeb36e2f57/httpclient/src/main/java/org/apache/http/impl/conn/DefaultHttpClientConnectionOperator.java#L153] > However it handles ConnectException and several other exceptions, and recent > JDK versions started throwing SocketException in some situations that > previous thread ConnectException: > [https://github.com/openjdk/jdk11u/commit/1d79d3800741d227ac6a588856279e528406c000#diff-b76813f1ff433c5141f02fc9c20c2aae09b255ba9574ff67e49c6e86349235f6L418-R419] > This means that the retries no longer work, leading to failures like the > following that could be resolved by retrying: > ``` > {{Caused by: java.net.SocketException: Network is unreachable (connect failed) > at java.base/java.net.PlainSocketImpl.socketConnect(Native Method) > at > java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:412) > at > java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:255) > at > java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:237) > at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) > at java.base/java.net.Socket.connect(Socket.java:609) > at > org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:368) > at > org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142) > at > org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:376) > at > org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:393)}} > ``` > The latest 5.x versions catch IOException instead of handling more subtypes, > so they are not affected by this issue: > https://github.com/apache/httpcomponents-client/commit/d5e1392840fcbd9ff9d9c5b19d8ed9da2883c224#diff-c8d113aa21d5fe2678c4c36f731cda6ed01d172d7e47e4d9fc527a5d4a921077R154 > This bug only affects 4.5.x, but would you consider accepting a fix if I sent > a PR? -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org