The test triggers frequent System.gc() calls which in some cases may aggressively shrink the heap, and subsequent allocations lead to full-GC. This may affect the usefulness of the test, but should not be considered a test failure.
The following test failed in the JDK23 CI:
vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_inMemoryCompilation_keep_cl/TestDescription.java
Here's a snippet from the log file:
#section:main
----------messages:(7/1060)----------
command: main -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+UseG1GC -XX:+ExplicitGCInvokesConcurrent -Xbootclasspath/a:classPool.jar -Xlog:gc:gc.log -XX:-UseGCOverheadLimit gc.g1.unloading.UnloadingTest -keepRefMode STATIC_FIELD_OF_ROOT_CLASS -inMemoryCompilation -keep classloader -numberOfChecksLimit 4 -stressTime 180
reason: User specified action: run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+UseG1GC -XX:+ExplicitGCInvokesConcurrent -Xbootclasspath/a:classPool.jar -Xlog:gc:gc.log -XX:-UseGCOverheadLimit gc.g1.unloading.UnloadingTest -keepRefMode STATIC_FIELD_OF_ROOT_CLASS -inMemoryCompilation -keep classloader -numberOfChecksLimit 4 -stressTime 180
started: Sun Feb 18 22:33:06 UTC 2024
Mode: othervm [/othervm specified]
Additional options from @modules: --add-modules java.base --add-exports java.base/jdk.internal.misc=ALL-UNNAMED --add-exports java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED
finished: Sun Feb 18 22:33:48 UTC 2024
elapsed time (seconds): 42.244
----------configuration:(5/210)----------
<snip>
----------System.out:(209/10886)----------
Stress time: 180 seconds
Stress iterations factor: 1
Stress threads factor: 1
Stress runs factor: 1
Max memory: 1073741824
Sleep time: 500
Iterations: 0
Number of threads: 24
Run GC thread: false
Run mem diag thread: false
Run forever: false
releaseRefMode = NONE
whatToKeep = CLASSLOADER
classlodingMethod = REFLECTION
numberOfGCsBeforeCheck = 50
keepRefMode = STATIC_FIELD_OF_ROOT_CLASS
humongousClass = false
compilationLevel = 0
compilationNumber = 2
redefineClasses = false
inMemoryCompilation = false
numberOfChecksLimit = 4
For random generator using seed: -9189803049408108649
To re-run test with same seed value please add "-Djdk.test.lib.random.seed=-9189803049408108649" to command line.
In method of generated class. Random.nextDouble = 0.7275636800328681
Printing bytesToReplace0 bytesToReplace2
In method of generated class. Random.nextDouble = 0.7275636800328681
Printing bytesToReplace0 bytesToReplace2
In method of generated class. Random.nextDouble = 0.7275636800328681
Printing bytesToReplace0 bytesToReplace2
<snip>
In constructor of Class0
In method of generated class. Random.nextDouble = 0.7275636800328681
Printing bytesToReplace0 bytesToReplace2
In method of generated class. Random.nextDouble = 0.7275636800328681
Printing bytesToReplace0 bytesToReplace2
In method of generated class. Random.nextDouble = 0.7275636800328681
Printing bytesToReplace0 bytesToReplace2
Check OK, class gc.g1.unloading.loading.ClassAbc_0___________, isAlive = false, shouldBeAlive = false
In method of generated class. Random.nextDouble = 0.7275636800328681
Printing bytesToReplace0 bytesToReplace2
In constructor of Class0
Check OK, class gc.g1.unloading.loading.ClassAbc_1___________, isAlive = false, shouldBeAlive = false
In method of generated class. Random.nextDouble = 0.7275636800328681
Printing bytesToReplace0 bytesToReplace2
In constructor of Class0
Check OK, class gc.g1.unloading.loading.ClassAbc_2___________, isAlive = true, shouldBeAlive = true
In method of generated class. Random.nextDouble = 0.7275636800328681
Printing bytesToReplace0 bytesToReplace2
In constructor of Class0
Check OK, class gc.g1.unloading.loading.ClassAbc_3___________, isAlive = false, shouldBeAlive = false
In method of generated class. Random.nextDouble = 0.7275636800328681
Printing bytesToReplace0 bytesToReplace2
In constructor of Class0
Check OK, class gc.g1.unloading.loading.ClassAbc_4___________, isAlive = true, shouldBeAlive = true
In method of generated class. Random.nextDouble = 0.7275636800328681
Printing bytesToReplace0 bytesToReplace2
Check OK, class gc.g1.unloading.loading.ClassAbc_5___________, isAlive = false, shouldBeAlive = false
In method of generated class. Random.nextDouble = 0.7275636800328681
Printing bytesToReplace0 bytesToReplace2
In constructor of Class0
Check OK, class gc.g1.unloading.loading.ClassAbc_6___________, isAlive = false, shouldBeAlive = false
In method of generated class. Random.nextDouble = 0.7275636800328681
Printing bytesToReplace0 bytesToReplace2
In constructor of Class0
Check OK, class gc.g1.unloading.loading.ClassAbc_7___________, isAlive = false, shouldBeAlive = false
In method of generated class. Random.nextDouble = 0.7275636800328681
Printing bytesToReplace0 bytesToReplace2
In constructor of Class0
Check OK, class gc.g1.unloading.loading.ClassAbc_8___________, isAlive = true, shouldBeAlive = true
In method of generated class. Random.nextDouble = 0.7275636800328681
Printing bytesToReplace0 bytesToReplace2
In constructor of Class0
Check OK, class gc.g1.unloading.loading.ClassAbc_9___________, isAlive = false, shouldBeAlive = false
In method of generated class. Random.nextDouble = 0.7275636800328681
Printing bytesToReplace0 bytesToReplace2
Check OK, class gc.g1.unloading.loading.ClassAbc_10__________, isAlive = true, shouldBeAlive = true
Exiting because numberOfChecksLimit exceeded.
ClassAssertion.getCounterOfCheckedAlive() = 4
ClassAssertion.getCounterOfCheckedUnloaded() = 7
bean.getName() = "G1 Young Generation", bean.getCollectionCount() = 66
bean.getName() = "G1 Concurrent GC", bean.getCollectionCount() = 122
bean.getName() = "G1 Old Generation", bean.getCollectionCount() = 1
java.lang.RuntimeException: Full gc happened. Test was useless.
at gc.g1.unloading.UnloadingTest.checkGCCounters(UnloadingTest.java:164)
at gc.g1.unloading.UnloadingTest.run(UnloadingTest.java:133)
at nsk.share.test.Tests$TestRunner.execute(Tests.java:82)
at nsk.share.test.Tests$TestRunner.run(Tests.java:96)
at nsk.share.test.Tests.runTest(Tests.java:102)
at gc.g1.unloading.UnloadingTest.main(UnloadingTest.java:67)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
at java.base/java.lang.Thread.run(Thread.java:1575)
----------System.err:(14/786)----------
nsk.share.TestFailure: Test exit code: 97
at nsk.share.test.Tests$TestRunner.execute(Tests.java:90)
at nsk.share.test.Tests$TestRunner.run(Tests.java:96)
at nsk.share.test.Tests.runTest(Tests.java:102)
at gc.g1.unloading.UnloadingTest.main(UnloadingTest.java:67)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
at java.base/java.lang.Thread.run(Thread.java:1575)
JavaTest Message: Test threw exception: nsk.share.TestFailure: Test exit code: 97
JavaTest Message: shutting down test
STATUS:Failed.`main' threw exception: nsk.share.TestFailure: Test exit code: 97
----------rerun:(51/8380)*----------