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.

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

Commit messages:
 - 8381900: Test vmTestbase/nsk/jvmti/scenarios/allocation/AP03/ap03t001 does 
not handle frequent GC gracefully

Changes: https://git.openjdk.org/jdk/pull/30644/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=30644&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8381900
  Stats: 9 lines in 1 file changed: 9 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/30644.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/30644/head:pull/30644

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

Reply via email to