RFR: 8358764: (sc) SocketChannel.close when thread blocked in read causes connection to be reset (win)

Alan Bateman alanb at openjdk.org
Tue Jun 10 13:38:41 UTC 2025


On Windows, if a platform thread is blocked in SocketChannel.read, and another thread closes the channel, then Windows abruptly closes the connection (RST).  In releases prior to JDK 11,  the connection was shutdown for writing before closing so the connection was closed gracefully, an unexpected behavior change

implCloseBlockingMode is changed to shutdown the connection for writing on Windows, no change in behavior for other platforms.

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

Commit messages:
 - Improve comments
 - Merge branch 'master' into JDK-8358764
 - Initial commit

Changes: https://git.openjdk.org/jdk/pull/25700/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25700&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8358764
  Stats: 244 lines in 5 files changed: 227 ins; 1 del; 16 mod
  Patch: https://git.openjdk.org/jdk/pull/25700.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/25700/head:pull/25700

PR: https://git.openjdk.org/jdk/pull/25700


More information about the nio-dev mailing list