-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
8319757: java/nio/channels/DatagramChannel/InterruptibleOrNot.java failed: wrong exception thrown #17251
Conversation
👋 Welcome back alanb! A progress list of the required criteria for merging this PR into |
@AlanBateman The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
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.
The test changes look OK to me.
Given that these are unconnected DatagramChannels, do you think this test is susceptible to receiving unexpected packets (in CI environments) and can run into intermittent failures (receive completing successfully before being interrupted)? Would making them connected (to a test specific address that never sends anything) improve the situation or would that then take a different code path than what this test intends to test?
@AlanBateman This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 36 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
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.
Looks good insofar as I know this area.
I view the issue interference (stray datagrams) from other tests/programs as a separate topic. It would be useful to audit the DatagramChannel, DatagramSocket, and other tests that send unicast datagrams to identity the tests that send to target addresses/ports that the test doesn't control. Tests for PortUnreachableException or tests that need to use specific protocol families (IPv4 or IPv6) are examples. It sometimes feels like these need to be isolated, I don't think jtreg exclusivedirs provides enough as it's a lock file for a specific tree rather than all agent VMs. In addition, it would be a bit unusual to use send/receive on a connected DatagramChannel. It's allowed of course but usually it's read/write when connected. So I agree your suggestion is something we should consider doing, I view is as part of broader issue to reduce and eliminate interference from other programs or tests. This PR is more focused on fixing the timing issue in the test where a channel can be closed and the thread blocked on the channel interrupted at around the same time. |
Thanks for the reviews. |
/integrate |
Going to push as commit ace010b.
Your commit was automatically rebased without conflicts. |
@AlanBateman Pushed as commit ace010b. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
/backport jdk22 |
@AlanBateman the backport was successfully created on the branch backport-AlanBateman-ace010b3 in my personal fork of openjdk/jdk22. To create a pull request with this backport targeting openjdk/jdk22:master, just click the following link: The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:
If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk22:
|
InterruptibleOrNot.testInterruptBeforeInterruptibleReceive has failed a few times. It calls DatagramChannel.receive with the interrupt status set and expects ClosedByInterruptException to be thrown. The shared part of the test is also used for the non-interruptible scenario which needs a delayed close to ensure the thread calling receive wakes up. The 2s delay is not sufficient and thus it's possible for the async close to beat the detection of the interrupt status. This leads to AsynchronousCloseException instead of the expected ClosedByInterruptException.
The test is re-worked to split the interruptible and non-interruptible tests. The test is also changed to drop the delayed interrupt/close and instead use a thread to poll under the target thread is in DatagramChannel.receive. The overall test is simpler. I changed it to be a JUnit test, that part is only a few lines of changes.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/17251/head:pull/17251
$ git checkout pull/17251
Update a local copy of the PR:
$ git checkout pull/17251
$ git pull https://git.openjdk.org/jdk.git pull/17251/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 17251
View PR using the GUI difftool:
$ git pr show -t 17251
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/17251.diff
Webrev
Link to Webrev Comment