httpclient5 version: 5.4.4
httpCore5 version: 5.3.4
Java version: 17 (21 since recently)

We are using http-client-5 under our api-client layer with async + TLS.
Once in a while, we get a timeout exception like this:
"java.net.SocketTimeoutException: 2 SECONDS" in some requests. and from the
stack trace, we see that the exception is coming from
"InternalDataChannel.onTimeout". but the value we see is actually the
connectTimeout, not the readTimeout(socketTimeout) we set for the request.

The explanation we came up with is that, the client completes the initial
connect step with "InternalConnectChannel" and then the socket is handed
over to "InternalDataChannel" to do the TLS handshake in "startTls", which
either takes too long to complete, or hangs. We came to this conclusion
because the code flow seems to have TLS handshake after connect in
sessionRequest.complete callback and handshake uses connectTimeout by
default (and also our request traces don't show a request reaching the
server for such cases).

Our question(s):
1. Is that really what is happening here.
2. Is there anything specific we might check to find the root cause.
3. if it is a "tls handshake too long" issue, can http-client throw a
specific exception for that.

Thanks in advance.

Reply via email to