Skip to content

8317801: java/net/Socket/asyncClose/Race.java fails intermittently (aix)#4294

Open
shruacha1234 wants to merge 1 commit intoopenjdk:masterfrom
shruacha1234:backport_8f121a17
Open

8317801: java/net/Socket/asyncClose/Race.java fails intermittently (aix)#4294
shruacha1234 wants to merge 1 commit intoopenjdk:masterfrom
shruacha1234:backport_8f121a17

Conversation

@shruacha1234
Copy link
Contributor

@shruacha1234 shruacha1234 commented Mar 15, 2026

This pull request contains a backport of commit 8f121a17 from the openjdk/jdk repository.
OpenJDK bug : https://bugs.openjdk.org/browse/JDK-8317801

This fix resolves a race condition in socket close handling that led to intermittent failures in Race.java on AIX in JDK17u-dev

The original patch didn’t apply cleanly to the JDK17u-dev branch due to differences in the NIO dispatcher implementation:

  • UnixDispatcher introduced in later JDK versions does not exist in JDK17.
  • Virtual thread related logic in the original patch is not present in JDK17.
  • The dispatcher hierarchy differs slightly.

To adapt the change for JDK17:

  • NativeDispatcher.preClose was updated to accept the reader and writer thread IDs.
  • Thread signalling logic was moved into FileDispatcherImpl.
  • Channel implementations (SocketChannelImpl, DatagramChannelImpl, ServerSocketChannelImpl, etc.) were updated to delegate signalling through the dispatcher rather than performing it locally.

These changes preserve the functional intent of the upstream patch, ensuring that threads blocked in I/O operations are correctly signalled when a file descriptor is pre-closed.

Testing : local AIX build, java_io, java_nio, jdk_net
Additionally, executed java/net/Socket/asyncClose/Race.java 500 times to check for intermittent failures. No failures were observed.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • JDK-8317801 needs maintainer approval
  • Commit message must refer to an issue

Issue

  • JDK-8317801: java/net/Socket/asyncClose/Race.java fails intermittently (aix) (Bug - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk17u-dev.git pull/4294/head:pull/4294
$ git checkout pull/4294

Update a local copy of the PR:
$ git checkout pull/4294
$ git pull https://git.openjdk.org/jdk17u-dev.git pull/4294/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 4294

View PR using the GUI difftool:
$ git pr show -t 4294

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk17u-dev/pull/4294.diff

Using Webrev

Link to Webrev Comment

Signed-off-by: Shruthi <Shruthi.Shruthi1@ibm.com>
@bridgekeeper
Copy link

bridgekeeper bot commented Mar 15, 2026

👋 Welcome back sacharya! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Mar 15, 2026

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot changed the title Backport 8f121a173ca2534c706682f6c68fbbb0b94ec057 8317801: java/net/Socket/asyncClose/Race.java fails intermittently (aix) Mar 15, 2026
@openjdk
Copy link

openjdk bot commented Mar 15, 2026

This backport pull request has now been updated with issue from the original commit.

@openjdk openjdk bot added backport Port of a pull request already in a different code base rfr Pull request is ready for review labels Mar 15, 2026
@mlbridge
Copy link

mlbridge bot commented Mar 15, 2026

Webrevs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport Port of a pull request already in a different code base rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

1 participant