Skip to content
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

Closed
wants to merge 4 commits into from

Conversation

AlanBateman
Copy link
Contributor

@AlanBateman AlanBateman commented Jan 3, 2024

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

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

Issue

  • JDK-8319757: java/nio/channels/DatagramChannel/InterruptibleOrNot.java failed: wrong exception thrown (Bug - P4)

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

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 3, 2024

👋 Welcome back alanb! 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 Jan 3, 2024

@AlanBateman The following label will be automatically applied to this pull request:

  • nio

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.

@openjdk openjdk bot added the nio nio-dev@openjdk.org label Jan 3, 2024
@AlanBateman AlanBateman marked this pull request as ready for review January 4, 2024 12:29
@openjdk openjdk bot added the rfr Pull request is ready for review label Jan 4, 2024
@mlbridge
Copy link

mlbridge bot commented Jan 4, 2024

Webrevs

Copy link
Member

@jaikiran jaikiran left a 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?

@openjdk
Copy link

openjdk bot commented Jan 5, 2024

@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:

8319757: java/nio/channels/DatagramChannel/InterruptibleOrNot.java failed: wrong exception thrown

Reviewed-by: jpai, bpb

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 master branch:

  • 631a9f6: 8323073: ProblemList gc/g1/TestSkipRebuildRemsetPhase.java on linux-aarch64
  • ed9f324: 8322985: [BACKOUT] 8318562: Computational test more than 2x slower when AVX instructions are used
  • ade21a9: 8310844: [AArch64] C1 compilation fails because monitor offset in OSR buffer is too large for immediate
  • f0cfd36: 8322532: JShell : Unnamed variable issue
  • 78623c9: 8323012: C2 fails with fatal error: no reachable node should have no use
  • f0e2e43: 8323021: Shenandoah: Encountered reference count always attributed to first worker thread
  • 3dc4bd8: 8322989: New test serviceability/HeapDump/FullGCHeapDumpLimitTest.java fails
  • 1d1cd32: 8321812: Update GC tests to use execute[Limited]TestJava
  • 868f874: 8322920: Some ProcessTools.execute* functions are declared to throw Throwable
  • 2a9c358: 8322725: (tz) Update Timezone Data to 2023d
  • ... and 26 more: https://git.openjdk.org/jdk/compare/1551928502c8ed96350e7b4f1316ea35587407fe...master

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 master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jan 5, 2024
Copy link
Member

@bplb bplb left a 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.

@AlanBateman
Copy link
Contributor Author

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?

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.

@AlanBateman
Copy link
Contributor Author

Thanks for the reviews.

@AlanBateman
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Jan 6, 2024

Going to push as commit ace010b.
Since your change was applied there have been 40 commits pushed to the master branch:

  • be4614e: 8323016: Improve reporting for bad options
  • 35a1b77: 8322636: [JVMCI] HotSpotSpeculationLog can be inconsistent across a single compile
  • 46965a0: 8322981: Fix 2 locations in JDI that throw IOException without using the "Caused by" exception
  • 700c25f: 8322954: Shenandoah: Convert evac-update closures asserts to rich asserts
  • 631a9f6: 8323073: ProblemList gc/g1/TestSkipRebuildRemsetPhase.java on linux-aarch64
  • ed9f324: 8322985: [BACKOUT] 8318562: Computational test more than 2x slower when AVX instructions are used
  • ade21a9: 8310844: [AArch64] C1 compilation fails because monitor offset in OSR buffer is too large for immediate
  • f0cfd36: 8322532: JShell : Unnamed variable issue
  • 78623c9: 8323012: C2 fails with fatal error: no reachable node should have no use
  • f0e2e43: 8323021: Shenandoah: Encountered reference count always attributed to first worker thread
  • ... and 30 more: https://git.openjdk.org/jdk/compare/1551928502c8ed96350e7b4f1316ea35587407fe...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jan 6, 2024
@openjdk openjdk bot closed this Jan 6, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jan 6, 2024
@openjdk
Copy link

openjdk bot commented Jan 6, 2024

@AlanBateman Pushed as commit ace010b.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@AlanBateman
Copy link
Contributor Author

/backport jdk22

@openjdk
Copy link

openjdk bot commented Jan 13, 2024

@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:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit ace010b3 from the openjdk/jdk repository.

The commit being backported was authored by Alan Bateman on 6 Jan 2024 and was reviewed by Jaikiran Pai and Brian Burkhalter.

Thanks!

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:

$ git fetch https://github.com/openjdk-bots/jdk22.git backport-AlanBateman-ace010b3:backport-AlanBateman-ace010b3
$ git checkout backport-AlanBateman-ace010b3
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk22.git backport-AlanBateman-ace010b3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated nio nio-dev@openjdk.org
3 participants