On Thu, 9 Apr 2026 14:18:03 GMT, Axel Boldt-Christmas <[email protected]>
wrote:
>> Hello,
>>
>> In the development of Automatic Heap Sizing (AHS) for ZGC we have seen
>> vmTestbase/nsk/jvmti/scenarios/allocation/AP03/ap03t001 fail intermittently.
>> The main thing in AHS affecting this test is the number of GCs being run.
>> The ap03t001 test seems to not be able to reliably handle GC at any moment.
>>
>> A naive solution to this problem is to just increase the min/initial heap
>> size to give the test more headroom, but I think we should go with a more
>> robust approach. What we're seeing in failing runs is that not only the
>> "holder" object is beeing freed, but the test-object itself as well.
>>
>>
>>
>> public static int run(String argv[], PrintStream out) {
>> return new ap03t001().runThis(argv, out);
>> }
>>
>> // ...
>>
>> private int runThis(String argv[], PrintStream out) {
>> // ...
>> ap03t001 holder = new ap03t001();
>> // ...
>> }
>>
>>
>> I propose we ignore ObjectFree events after having verified that the holder
>> object has been resurrected into the catcher object, which is what this test
>> is all about. Another alternative could be to disable ObjectFree events
>> entirely after we're done, but I think this approach is easier to follow.
>>
>> Testing:
>> * Local testing with AHS, and in mainline, that this test passes when
>> running a bunch of GC. Running with flags: `-Xcomp -XX:-TieredCompilation`
>> and `-XX:+ZCollectionIntervalOnly -XX:ZCollectionIntervalMajor=0.001` to
>> trigger a lot of GCs.
>> * Oracle's tier1
>>
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Seems like a pragmatic solution.
Thank you for the reviews @xmas92 and @sspitsyn! I reran testing and updated
the PR description to match that.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/30644#issuecomment-4235041032