On Thu, 9 Apr 2026 08:47:36 GMT, Joel Sikström <[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.

Seems like a pragmatic solution.

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

Marked as reviewed by aboldtch (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/30644#pullrequestreview-4083005491

Reply via email to