RFR: 8352116: Deadlock with GCLocker and JVMTI after JDK-8192647
Albert Mingkun Yang
ayang at openjdk.org
Fri Apr 4 09:12:23 UTC 2025
Using a new lock (`JNICritical_lock`) in `GCLocker::block` to resolve a deadlock issue. The root cause of the deadlock is that holding `Heap_lock` while waiting in `GCLocker::block` is unsafe.
The new lock is held from the start of `GCLocker::block` to the end of `GCLocker::unblock`. This requires adjusting `Heap_lock`'s rank to allow acquiring `Heap_lock` while holding `JNICritical_lock`. The most important changes are in `gcVMOperations.cpp` and `mutexLocker.cpp`.
Test: tier1-8; verified failure can be observed 2/2000 and pass 8000 iterations.
-------------
Commit messages:
- tmp
- gclocker-nested
Changes: https://git.openjdk.org/jdk/pull/24407/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24407&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8352116
Stats: 31 lines in 4 files changed: 20 ins; 7 del; 4 mod
Patch: https://git.openjdk.org/jdk/pull/24407.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/24407/head:pull/24407
PR: https://git.openjdk.org/jdk/pull/24407
More information about the hotspot-gc-dev
mailing list