8238990: java/net/httpclient/HandshakeFailureTest.java failed against TLSv1.3 on Windows

Daniel Fuchs daniel.fuchs at oracle.com
Wed Feb 19 19:26:44 UTC 2020


Hi,

Please find below a fix for:
8238990: java/net/httpclient/HandshakeFailureTest.java failed
          against TLSv1.3 on Windows
https://bugs.openjdk.java.net/browse/JDK-8238990

webrev:
http://cr.openjdk.java.net/~dfuchs/webrev_8238990/webrev.00/


The issue here is that we get a race condition between the
thread that reads the socket and the thread that runs the
SSLEngine to handshake and decrypt/encrypt the data.

The thread that reads the socket sometimes get a "Connection reset"
(Unix) or WSAECONNABORTED (Windows) when the connection is
closed by the server side before the handshake is finished.

The thread that runs the SSLEngine concurrently throws a
SSLHandshakeException when processing the received data
if the handshake is unsuccessful.

The HTTP client stack ensures that all data has been processed
before any exception is propagated downstream. However, there is
a single exception slot, and the first exception registered in
that slot wins. The proposed solution is to look at the handshake
status, and wrap the exception in a SSLHandshakeException if the
socket is closed (an exception is reported from upstream) before
the handshake is successfully completed.

Some additional investigation may be required to figure out why
WSAECONNABORTED is raised so often on windows. I am suspecting
that maybe the SSLSocket on the server side is closed too soon,
without first draining the buffers (maybe).
This additional investigation could however best be carried
over with JDK-8235973.

best regards,

-- daniel


More information about the net-dev mailing list