8317801: java/net/Socket/asyncClose/Race.java fails intermittently (aix)#4294
8317801: java/net/Socket/asyncClose/Race.java fails intermittently (aix)#4294shruacha1234 wants to merge 3 commits intoopenjdk:masterfrom
Conversation
Signed-off-by: Shruthi <Shruthi.Shruthi1@ibm.com>
|
👋 Welcome back sacharya! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
|
This backport pull request has now been updated with issue from the original commit. |
Webrevs
|
|
This backport is being done very differently in JDK 17u because for JDK 21u the following dependencies where included first in the JDK 21 release before doing the actual backport for this bug:
It would have helped if this information was provided to the reader. If we end up going this route without the enhancement backports (which should be fine IMO), then we should more accurately model it to pre-existing JDK 17u code. A review follows shortly. |
| FileDispatcherImpl dispatcher = new FileDispatcherImpl(); | ||
| dispatcher.preClose(fd, reader, writer); |
There was a problem hiding this comment.
This should just delegate to FileDispatcherImpl as before:
| FileDispatcherImpl dispatcher = new FileDispatcherImpl(); | |
| dispatcher.preClose(fd, reader, writer); | |
| FileDispatcherImpl.preClose(fd, reader, writer); |
There was a problem hiding this comment.
In order to avoid the name clash with the non-static variant use a name other than preClose. E.g. doPreClose
|
/reviewers 2 Reviewer |
Signed-off-by: Shruthi <Shruthi.Shruthi1@ibm.com>
Signed-off-by: Shruthi <Shruthi.Shruthi1@ibm.com>
jerboaa
left a comment
There was a problem hiding this comment.
The build failure should be resolved in a different way (rename the shared static method).
| } | ||
|
|
||
| void implPreClose(FileDescriptor fd, long reader, long writer) throws IOException { | ||
| static void implPreClose(FileDescriptor fd, long reader, long writer) throws IOException { |
There was a problem hiding this comment.
Make it private, please. Or fold it into doPreClose
| * dup'ed to a special fd and the thread signalled so that the syscall fails with EINTR. | ||
| */ | ||
| final void preClose(FileDescriptor fd, long reader, long writer) throws IOException { | ||
| static final void preClose(FileDescriptor fd, long reader, long writer) throws IOException { |
There was a problem hiding this comment.
static void doPreClose(...)
Also, please add a comment similar to the the one that was added in preClose0 (and remove the one for preClose0 as it's now outdated:
// Shared with SocketDispatcher and DatagramDispatcher
preClose0 is only used in this class now, so should be private.
| FileDispatcherImpl dispatcher = new FileDispatcherImpl(); | ||
| dispatcher.preClose(fd, reader, writer); |
There was a problem hiding this comment.
In order to avoid the name clash with the non-static variant use a name other than preClose. E.g. doPreClose
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:
UnixDispatcherintroduced in later JDK versions does not exist in JDK17.Virtual threadrelated logic in the original patch is not present in JDK17.To adapt the change for JDK17:
NativeDispatcher.preClosewas updated to accept the reader and writer thread IDs.FileDispatcherImpl.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
Issue
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk17u-dev.git pull/4294/head:pull/4294$ git checkout pull/4294Update a local copy of the PR:
$ git checkout pull/4294$ git pull https://git.openjdk.org/jdk17u-dev.git pull/4294/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 4294View PR using the GUI difftool:
$ git pr show -t 4294Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk17u-dev/pull/4294.diff
Using Webrev
Link to Webrev Comment