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

Thomas Stuefe stuefe at openjdk.org
Wed Sep 3 13:52:48 UTC 2025


On Mon, 1 Sep 2025 15:21:53 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:

> Please review this unclean backport of JDK-8358764. This is for partity with 21.0.9-oracle. The backport is not clean for the following reasons:
> 
> - Usage of `StableValue` in the original patch. I've replaced this with a static variable in class `Net`. Similar to `FAST_LOOPBACK`.
> - Context differences in `SocketChannelImpl.java`, method `implCloseBlockingMode()`. JDK-8351458, "(ch) Move preClose to UnixDispatcher" is not in JDK 21u.
> - Test `PeerReadsAfterAsyncClose` needed an adaptation since the match on the stack trace is wrong for JDK 21. It should be `sun.nio.ch.SocketChannelImpl.read` instead of `sun.nio.ch.SocketChannelImpl.implRead` (in JDK head). The reason for this seems to be "JDK-8308995: Update Network IO JFR events to be static mirror events" (JDK 22+).
> 
> Other than that it's a fairly straight-forward port.
> 
> **Testing:**
> 
> - [x] jdk_net, jdk_nio on Linux x86_64
> - [x] New regression test on Windows without the product fix (fails) and passes with the product fix. The test passes on Linux with/without the product fix so isn't indicative there (as it should since it's a Windows fix).
> - [x] GHA 
> 
> Thoughts?

I'm not an expert here, but the patch looks good to me.

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

Marked as reviewed by stuefe (Reviewer).

PR Review: https://git.openjdk.org/jdk21u-dev/pull/2137#pullrequestreview-3180769255


More information about the jdk-updates-dev mailing list