RFR: 8351921: G1: Pinned regions with pinned objects only reachable by native code crash VM
Thomas Schatzl
tschatzl at openjdk.org
Mon Mar 17 15:47:34 UTC 2025
Hi all,
please review this fix for a crash in G1 where it tries to reclaim a pinned region that does not have any reference visible to the VM any more and there are no other reachable pinnable objects in the same region. This can happen e.g. when JNI code is the only holder for a reference.
This has been reported this in a real application, but the attached test case (that uses WhiteBox to simulate a lone pinnable object in a region where the GC does not have a reference any more) shows the principle as well.
The solution involves unconditionally adding pinned regions in the collection set to the set of evacuation failed regions, instead of only doing that when G1 first encounters a reachable pinnable object in that pinned region.
Testing: gha, tier1-5
Thanks,
Thomas
-------------
Commit messages:
- * fix copyright date
- * remove debug code
- * keep regular evacuation failure working...
- * fix
- * crashing test case
Changes: https://git.openjdk.org/jdk/pull/24060/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24060&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8351921
Stats: 124 lines in 4 files changed: 109 ins; 7 del; 8 mod
Patch: https://git.openjdk.org/jdk/pull/24060.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/24060/head:pull/24060
PR: https://git.openjdk.org/jdk/pull/24060
More information about the hotspot-gc-dev
mailing list