You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I set a connect timeout on OkHttpClient and attempt to reach an HTTPS endpoint that throws a SocketTimeoutException, OkHttp is retrying the request once before giving up. This is what I believe is happening:
Upon the initial timeout exception, HttpURLConnectionImpl.handleFailure() adds the failed route (with TLS_MODE_MODERN flag) to the RouteDatabase. The database also adds the route with TLS_MODE_COMPATIBLE since it wasn't a handshake exception.
handleFailure() checks to see if the error is recoverable. The test routeSelector.hasNext() returns true, since RouteSelector.hasNextTlsMode() returns true. Another engine is created to try again.
The next time through, the route matches a failed route in the RouteDatabase and is added to the set of postponed routes, and is eventually tried again.
After this attempt fails with a SocketTimeoutException, there are no more TLS modes, addresses, proxies or postponed routes to try, so the RouteSelector will return null, and HttpURLConnectionImpl returns with a permanent failure.
I would expect that a route is tried again with the fallback TLS behaviour, only if there was a handshake exception, and not when a SocketTimeoutException is encountered.
I'm using OkHttp 1.3.0 on Android 4.2.2.
The text was updated successfully, but these errors were encountered:
Yup, great investigation. There's a disconnect between hasNext() and failed TLS modes. We need to tell the route selector that neither TLS mode will work for this host.
When I set a connect timeout on OkHttpClient and attempt to reach an HTTPS endpoint that throws a SocketTimeoutException, OkHttp is retrying the request once before giving up. This is what I believe is happening:
HttpURLConnectionImpl.handleFailure()
adds the failed route (withTLS_MODE_MODERN
flag) to theRouteDatabase
. The database also adds the route withTLS_MODE_COMPATIBLE
since it wasn't a handshake exception.handleFailure()
checks to see if the error is recoverable. The testrouteSelector.hasNext()
returns true, sinceRouteSelector.hasNextTlsMode()
returns true. Another engine is created to try again.RouteDatabase
and is added to the set of postponed routes, and is eventually tried again.RouteSelector
will return null, andHttpURLConnectionImpl
returns with a permanent failure.I would expect that a route is tried again with the fallback TLS behaviour, only if there was a handshake exception, and not when a SocketTimeoutException is encountered.
I'm using OkHttp 1.3.0 on Android 4.2.2.
The text was updated successfully, but these errors were encountered: