RFR: 8274524: SSLSocket.close() hangs if it is called during the ssl handshake

Alexey Bakhtin abakhtin at openjdk.java.net
Thu Feb 10 18:26:30 UTC 2022


Please review the patch for the JDK-8274524

SSLSocket.close() could cause an intermittent hang of the socket read operation. It happens in case of SO_TIMEOUT is set to 0 (infinite timeout).
SSLSocket.close() reads from the socket as part of the skip() operation to prevent TCP Connection reset (see JDK-8268965). Socket reads are performed in a loop for small chunks. These read operations could cause a deadlock, in case of SO_TIMEOUT = 0
I suggest to force non-zero SO_TIMEOUT during the skip() operation to prevent such deadlock

This is a second iteration of review. Previous PR was closed without integration: https://github.com/openjdk/jdk/pull/5760

-------------

Commit messages:
 - Add read timeout for deplete
 - Fix jcheck issues
 - Add ClientSocketCloseHang jtreg test
 - Reimplemented readLock, added lock in readHandshakeRecord
 - 8274524: SSLSocket.close() hangs if it is called during the ssl handshake

Changes: https://git.openjdk.java.net/jdk/pull/7432/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=7432&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8274524
  Stats: 146 lines in 2 files changed: 146 ins; 0 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk/pull/7432.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/7432/head:pull/7432

PR: https://git.openjdk.java.net/jdk/pull/7432



More information about the security-dev mailing list