RFR: 8274524: SSLSocket.close() hangs if it is called during the ssl handshake [v4]
Alexey Bakhtin
abakhtin at openjdk.java.net
Wed Nov 10 18:54:33 UTC 2021
On Wed, 10 Nov 2021 17:28:18 GMT, Xue-Lei Andrew Fan <xuelei at openjdk.org> wrote:
> Did you have a chance to analysis the potential deadlock issues between handshake lock, read lock, write lock and socket lock? The locks used in SSLSocketImpl is complicated. If I remember correctly, there are potential deadlock issues if the read/write locks are used during handshaking. Did you have a dead lock stack for the bug? Alternatively, it might be a direction to improve the close() code.
Hi @XueleiFan,
Thank you for review.
There are two stack traces in the bug report. The one is for SSLSocket.close() and another for SSLSocketImpl.readHandshakeRecord()
SSLSocket.close() is hanged on the InputStream.skip() operation. SSLSocket.close() and SSLSocketImpl.readHandshakeRecord() are called concurrently. SSLSocket.close() calls InputStream.skip() to clear input data from socket but concurrent SSLSocketImpl.readHandshakeRecord() reads some data from the socket. As result InputStream.skip() can not complete operation for previously calculated available bytes and hangs.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5760
More information about the security-dev
mailing list