Integrated: 8351921: G1: Pinned regions with pinned objects only reachable by native code crash VM

Thomas Schatzl tschatzl at openjdk.org
Tue Mar 18 09:32:20 UTC 2025


On Fri, 14 Mar 2025 13:56:06 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

This pull request has now been integrated.

Changeset: 558c015c
Author:    Thomas Schatzl <tschatzl at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/558c015c995dbe65d876c1c5761030588773271c
Stats:     123 lines in 4 files changed: 108 ins; 7 del; 8 mod

8351921: G1: Pinned regions with pinned objects only reachable by native code crash VM

Reviewed-by: ayang, iwalulya

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

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


More information about the hotspot-gc-dev mailing list