RFR: 8351921: G1: Pinned regions with pinned objects only reachable by native code crash VM [v2]

Albert Mingkun Yang ayang at openjdk.org
Mon Mar 17 19:53:08 UTC 2025


On Mon, 17 Mar 2025 16:33:39 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

>> 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
>
> Thomas Schatzl has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - * iwalulya review
>      * typos
>  - Update test/hotspot/jtreg/gc/g1/pinnedobjs/TestPinnedEvacEmpty.java

Marked as reviewed by ayang (Reviewer).

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

PR Review: https://git.openjdk.org/jdk/pull/24060#pullrequestreview-2691818928


More information about the hotspot-gc-dev mailing list