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. 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).
This pull request has now been integrated.
Changeset: e8c77d16
Author: Joel Sikström <[email protected]>
URL:
https://git.openjdk.org/jdk/commit/e8c77d16c41b9e4569c888f87e97fa48a24f1498
Stats: 9 lines in 1 file changed: 9 ins; 0 del; 0 mod
8381900: Test vmTestbase/nsk/jvmti/scenarios/allocation/AP03/ap03t001 does not
handle frequent GC gracefully
Reviewed-by: aboldtch, sspitsyn
-------------
PR: https://git.openjdk.org/jdk/pull/30644