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

Thomas Schatzl tschatzl at openjdk.org
Fri Mar 21 11:16:57 UTC 2025


On Fri, 21 Mar 2025 08:07:35 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

> Hi all,
> 
>   please review this change that re-implements the fix for [JDK-8351921](https://bugs.openjdk.org/browse/JDK-8351921); in that fix we (think we) forgot to consider the same situation with optional regions.
> 
> I.e. the previous fix only fixed the situation occurring during initial evacuation, however as we add regions due to optional evacuation, the same situation can still happen.
> 
> So this change adds some work to every evacuation phase that marks all pinned regions in the current collection set as evacuation failed/pinned instead of only doing this work once in the pre evacuation phase.
> 
> As for testing, it is extremely hard to induce a situation where there is a pinned region with no apparent live objects in an optional collection set, so I gave up and just added the original test again.
> 
> Testing: gha, test
> 
> Thanks,
>   Thomas

[This test](https://github.com/openjdk/jdk/compare/master...tschatzl:jdk:8351921a-induced-test-failure?expand=1) using some VM hacking (also in that patch) shows the additional failure in optional evacuation.
I.e. with the old fix, the `TestPinnedEvacEmpty.java` test succeeds while the new test `TestPinnedEvacEmptyOptional.java` fails.

This change, with the appropriate hack, passes both tests.

Fwiw, I asked the reporter to try this fix on their private failing test, going to wait for their result too.

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

PR Comment: https://git.openjdk.org/jdk/pull/24147#issuecomment-2743050999
PR Comment: https://git.openjdk.org/jdk/pull/24147#issuecomment-2743053802


More information about the hotspot-gc-dev mailing list