-
Notifications
You must be signed in to change notification settings - Fork 237
8317801: java/net/Socket/asyncClose/Race.java fails intermittently (aix) #4294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| /* | ||
| * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved. | ||
| * Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved. | ||
| * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
| * | ||
| * This code is free software; you can redistribute it and/or modify it | ||
|
|
@@ -32,6 +32,7 @@ | |
| import jdk.internal.access.SharedSecrets; | ||
|
|
||
| class FileDispatcherImpl extends FileDispatcher { | ||
| private static final boolean SUPPORTS_PENDING_SIGNALS = NativeThread.supportPendingSignals(); | ||
|
|
||
| static { | ||
| IOUtil.load(); | ||
|
|
@@ -104,8 +105,33 @@ void close(FileDescriptor fd) throws IOException { | |
| fdAccess.close(fd); | ||
| } | ||
|
|
||
| void preClose(FileDescriptor fd) throws IOException { | ||
| /** | ||
| * Prepare the given file descriptor for closing. If a virtual thread is blocked | ||
| * on the file descriptor then it is unparked so that it stops polling. On Unix systems, | ||
| * if a platform thread is blocked on the file descriptor then the file descriptor is | ||
| * dup'ed to a special fd and the thread signalled so that the syscall fails with EINTR. | ||
| */ | ||
|
Comment on lines
+109
to
+113
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment is misleading and should be changed. There are no virtual threads in JDK 17. I suggest to drop the second sentence. |
||
| final void preClose(FileDescriptor fd, long reader, long writer) throws IOException { | ||
| if (reader != 0 || writer != 0) { | ||
| implPreClose(fd, reader, writer); | ||
| } | ||
| } | ||
|
|
||
| private void signalThreads(long reader, long writer) { | ||
| if (reader != 0) | ||
| NativeThread.signal(reader); | ||
| if (writer != 0) | ||
| NativeThread.signal(writer); | ||
| } | ||
|
|
||
| void implPreClose(FileDescriptor fd, long reader, long writer) throws IOException { | ||
| if (SUPPORTS_PENDING_SIGNALS) { | ||
| signalThreads(reader, writer); | ||
| } | ||
| preClose0(fd); | ||
| if (!SUPPORTS_PENDING_SIGNALS) { | ||
| signalThreads(reader, writer); | ||
| } | ||
|
Comment on lines
+114
to
+134
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should be fine to collapse those as shared static methods, used by |
||
| } | ||
|
|
||
| void dup(FileDescriptor fd1, FileDescriptor fd2) throws IOException { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,5 +1,5 @@ | ||||||||||||
| /* | ||||||||||||
| * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. | ||||||||||||
| * Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved. | ||||||||||||
| * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||||||||||||
| * | ||||||||||||
| * This code is free software; you can redistribute it and/or modify it | ||||||||||||
|
|
@@ -70,8 +70,9 @@ void close(FileDescriptor fd) throws IOException { | |||||||||||
| FileDispatcherImpl.close0(fd); | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| void preClose(FileDescriptor fd) throws IOException { | ||||||||||||
| FileDispatcherImpl.preClose0(fd); | ||||||||||||
| void preClose(FileDescriptor fd, long reader, long writer) throws IOException { | ||||||||||||
| FileDispatcherImpl dispatcher = new FileDispatcherImpl(); | ||||||||||||
| dispatcher.preClose(fd, reader, writer); | ||||||||||||
|
Comment on lines
+73
to
+75
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| // -- Native methods -- | ||||||||||||
|
|
||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should just delegate to
FileDispatcherImplas before: