RFR: 8351484: Race condition in max stats in MonitorList::add

Aleksey Shipilev shade at openjdk.org
Mon Mar 10 11:35:13 UTC 2025


See bug for the description of the race. New gtest test case reliably catches fire on my 5950X desktop without this fix.

I needed to add the proper constructor for `MonitorList` to make it testable. In our regular code, it is statically allocated, so its fields are implicitly initialized.

I also made counters `_relaxed` for completeness.

Additional testing:
 - [x] Linux x86_64 server fastdebug, new test now passes
 - [ ] GHA

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

Commit messages:
 - Test touchups
 - Comments
 - Fix

Changes: https://git.openjdk.org/jdk/pull/23961/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=23961&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8351484
  Stats: 45 lines in 3 files changed: 41 ins; 0 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/23961.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/23961/head:pull/23961

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


More information about the hotspot-runtime-dev mailing list