RFR: 8361952: Double-checked locking MethodData::extra_data_lock() misses synchronization on reader side

Thomas Schatzl tschatzl at openjdk.org
Fri Jul 11 09:53:16 UTC 2025


Hi all,

  please review this change that fixes some recently introduced double-checked locking missing the memory barrier (`load_acquire`) on the reader side. Without it the reader might get a valid pointer to the `Mutex` created on the fly, without it being initialized properly.

Found during code inspection for https://bugs.openjdk.org/browse/JDK-8361706 ; due to some suspicious hangs in the `MutexLocker` while cleaning klasses during class unloading in parallel (multiple threads hanging in `MethodData::clean_method_data`), executing the `vmTestbase/nsk/jvmti/RedefineClasses/StressRedefine/TestDescription.java` test.

Testing: gha

Thanks,
  Thomas

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

Commit messages:
 - 8361952

Changes: https://git.openjdk.org/jdk/pull/26262/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26262&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8361952
  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/26262.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/26262/head:pull/26262

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


More information about the hotspot-dev mailing list