RFR: 8306774: Make runtime/Monitor/GuaranteedAsyncDeflationIntervalTest.java more reliable [v3]

Aleksey Shipilev shade at openjdk.org
Wed Apr 26 08:17:59 UTC 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:
>  - [x] Ad-hoc runs of the test, 100 iterations without trouble.

Aleksey Shipilev has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:

 - Merge branch 'master' into JDK-8306774-async-test
 - Drop redundant field
 - Parallel inflation instead of relying on hashCode
 - Drop MUDT to 1 to increase the chances
 - Fix

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/13634/files
  - new: https://git.openjdk.org/jdk/pull/13634/files/76fa7114..044c835c

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=13634&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13634&range=01-02

  Stats: 8658 lines in 83 files changed: 8053 ins; 346 del; 259 mod
  Patch: https://git.openjdk.org/jdk/pull/13634.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/13634/head:pull/13634

PR: https://git.openjdk.org/jdk/pull/13634


More information about the hotspot-runtime-dev mailing list