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

Severin Gehwolf sgehwolf at openjdk.org
Mon Sep 8 09:48:26 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?

This pull request has now been integrated.

Changeset: 83f9c250
Author:    Severin Gehwolf <sgehwolf at openjdk.org>
URL:       https://git.openjdk.org/jdk21u-dev/commit/83f9c250221f707be484e0163fe9040f99474412
Stats:     246 lines in 5 files changed: 229 ins; 1 del; 16 mod

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

Reviewed-by: stuefe
Backport-of: e5196fc24d2ec9e581af7803ac47036111fee029

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

PR: https://git.openjdk.org/jdk21u-dev/pull/2137


More information about the jdk-updates-dev mailing list