Skip to content

8306774: Make runtime/Monitor/GuaranteedAsyncDeflationIntervalTest.java more reliable #13634

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

Closed
wants to merge 5 commits into from

Conversation

shipilev
Copy link
Member

@shipilev shipilev commented Apr 25, 2023

As seen in some CI runs, doing Object.wait(1) to inflate 10K monitors can take quite a while. One of the test cases implicitly relies on threshold heuristics kicking in before the guaranteed interval of 5 seconds expires. Even if we wait for 1ms for each wait call, we only inflate 5K monitors in those 5 seconds. Which is okay for 5s and 10% threshold test, which would fire after about 1K monitors inflated. But we can also stall for longer -- because wait(1) is not guaranteed to return in 1ms, subject to locking granularity -- which means we can inflate less that 1K monitors, which would mean the threshold heuristics would not fire.

This fix strengthens the test in two ways:

  1. Uses multiple threads to inflate the monitors, so that we are able to eat the cost of wait(1).
  2. Drops the threshold heuristics threshold to minimum value to increase the chances of it firing.

This also makes the test faster.

@dcubed-ojdk, you might want to run this through your CI to see if it fixes the test troubles.

Additional testing:

  • Ad-hoc runs of the test, 100 iterations without trouble.

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-8306774: Make runtime/Monitor/GuaranteedAsyncDeflationIntervalTest.java more reliable

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/13634/head:pull/13634
$ git checkout pull/13634

Update a local copy of the PR:
$ git checkout pull/13634
$ git pull https://git.openjdk.org/jdk.git pull/13634/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 13634

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/13634.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 25, 2023

👋 Welcome back shade! 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 openjdk bot added the rfr Pull request is ready for review label Apr 25, 2023
@openjdk
Copy link

openjdk bot commented Apr 25, 2023

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

  • hotspot-runtime

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 hotspot-runtime hotspot-runtime-dev@openjdk.org label Apr 25, 2023
@mlbridge
Copy link

mlbridge bot commented Apr 25, 2023

Webrevs

Copy link
Member

@tstuefe tstuefe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Why did you steer away from the i-hash solution though, I thought that was rather neat.

@openjdk
Copy link

openjdk bot commented Apr 25, 2023

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

8306774: Make runtime/Monitor/GuaranteedAsyncDeflationIntervalTest.java more reliable

Reviewed-by: stuefe, dcubed

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 12 new commits pushed to the master branch:

  • 44d9f55: 8306072: Open source several AWT MouseInfo related tests
  • cc894d8: 8303466: C2: failed: malformed control flow. Limit type made precise with MaxL/MinL
  • ed1ebd2: 8306652: Open source AWT MenuItem related tests
  • f3e8bd1: 8306755: Open source few Swing JComponent and AbstractButton tests
  • 1c1a73f: 8302908: RISC-V: Support masked vector arithmetic instructions for Vector API
  • adf62fe: 8304918: Remove unused decl field from AnnotatedType implementations
  • 00b1eac: 8306031: Update IANA Language Subtag Registry to Version 2023-04-13
  • 88d9ebf: 8306752: Open source several container and component AWT tests
  • 1c2dadc: 8306683: Open source several clipboard and color AWT tests
  • b372f28: 8306753: Open source several container AWT tests
  • ... and 2 more: https://git.openjdk.org/jdk/compare/28829f308fe6314388c9a47b91273bcf81eb806c...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 Apr 25, 2023
@shipilev
Copy link
Member Author

LGTM. Why did you steer away from the i-hash solution though, I thought that was rather neat.

Previous version of this PR used the take-IHC-while-locked trick to inflate the monitors, but I figured it would not work after JDK-8291555: Implement alternative fast-locking scheme is here, and would quite probably be even less reliable as Lilliput progresses towards off-side IHC table.

@dcubed-ojdk
Copy link
Member

LGTM. Why did you steer away from the i-hash solution though, I thought that was rather neat.

Previous version of this PR used the take-IHC-while-locked trick to inflate the monitors, but I figured it would not work after JDK-8291555: Implement alternative fast-locking scheme is here, and would quite probably be even less reliable as Lilliput progresses towards off-side IHC table.

Hmmm... I don't remember seeing anything in JDK-8291555 that would break the
take-IHC-while-locked trick. I use that trick in some of my monitor stress tests...
It would be sad to see that go away...

Copy link
Member

@dcubed-ojdk dcubed-ojdk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a reasonable fix so thumbs up.
I'm testing in Mach5 now.

@dcubed-ojdk
Copy link
Member

Mach5 Tier1 testing passed. It doesn't look like the test is
executed in Tier[23].

@shipilev
Copy link
Member Author

Previous version of this PR used the take-IHC-while-locked trick to inflate the monitors, but I figured it would not work after JDK-8291555: Implement alternative fast-locking scheme is here, and would quite probably be even less reliable as Lilliput progresses towards off-side IHC table.

Hmmm... I don't remember seeing anything in JDK-8291555 that would break the take-IHC-while-locked trick. I use that trick in some of my monitor stress tests... It would be sad to see that go away...

Perhaps I was too cautious about this. I figured that the practical reason to inflate the stack-locked object when IHC is requested is to deal with various races about the IHC installation in the displaced header. And since JDK-8291555 changes the stack-locking to not replace the header fully (only changing a bit, AFAIU), then IHC installation becomes much easier. But after reading the description again, I think JDK-8291555 only takes care of IHC on fastpath, i.e. when it is already installed. So take-IHC-while-locked might still work.

Still, I don't feel quite safe with relying on it, because it seems (famous last words) an easy future change to allow IHC installation into stack-locked object header after JDK-8291555, and I think there is a tentative plan to move IHC out of the header completely with 32-bit headers, which would make inflation even less of the practical behavior. So I believe wait(1) remains the only future-proof way to inflate the monitors, before we start to mess with JVM settings.

@shipilev
Copy link
Member Author

Mach5 Tier1 testing passed. It doesn't look like the test is executed in Tier[23].

Thank you! I'll re-run some local testing and then integrate.

@shipilev
Copy link
Member Author

Local testing looks good. GHAs look good. I am integrating now.

/integrate

@openjdk
Copy link

openjdk bot commented Apr 26, 2023

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

  • c5910fa: 8306749: Make CardTable::invalidate non-virtual
  • 86f41a4: 8306735: G1: G1FullGCScope remove unnecessary member _explicit_gc
  • d747698: 8306823: Native memory leak in SharedRuntime::notify_jvmti_unmount/mount.
  • 8d89992: 8298189: Regression in SPECjvm2008-MonteCarlo for pre-Cascade Lake Intel processors
  • 44d9f55: 8306072: Open source several AWT MouseInfo related tests
  • cc894d8: 8303466: C2: failed: malformed control flow. Limit type made precise with MaxL/MinL
  • ed1ebd2: 8306652: Open source AWT MenuItem related tests
  • f3e8bd1: 8306755: Open source few Swing JComponent and AbstractButton tests
  • 1c1a73f: 8302908: RISC-V: Support masked vector arithmetic instructions for Vector API
  • adf62fe: 8304918: Remove unused decl field from AnnotatedType implementations
  • ... and 6 more: https://git.openjdk.org/jdk/compare/28829f308fe6314388c9a47b91273bcf81eb806c...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Apr 26, 2023

@shipilev Pushed as commit 9ad6dc8.

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

@shipilev shipilev deleted the JDK-8306774-async-test branch May 3, 2023 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-runtime hotspot-runtime-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

3 participants