JDK-8326121 : vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_inMemoryCompilation_keep_cl failed with Full gc happened. Test was useless.
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 23
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows
  • CPU: x86_64
  • Submitted: 2024-02-19
  • Updated: 2024-09-24
  • Resolved: 2024-05-30
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 17 JDK 21 JDK 23
11.0.26-oracleFixed 17.0.14-oracleFixed 21.0.6-oracleFixed 23 b26Fixed
Related Reports
Relates :  
Description
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)*----------
Comments
Fix request [17u,21u] I backport this for parity with 17.0.14-oracle,21.0.6-oracle. No risk, only a test change. Clean backport. Tests using the modified files pass. SAP nightly testing passed.
20-09-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk21u-dev/pull/991 Date: 2024-09-19 14:08:50 +0000
19-09-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk17u-dev/pull/2896 Date: 2024-09-19 14:08:15 +0000
19-09-2024

Changeset: 2b4a4b7b Author: Ivan Walulya <iwalulya@openjdk.org> Date: 2024-05-30 08:32:15 +0000 URL: https://git.openjdk.org/jdk/commit/2b4a4b7bd84806f997adc107abbd4351425e8d1d
30-05-2024

Test: vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_inMemoryCompilation_keep_obj/TestDescription.java
28-05-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/19432 Date: 2024-05-28 15:51:54 +0000
28-05-2024

May also be caused by completely off eden sizing sometimes causing issues (JDK-8330847)
27-05-2024

Looks like a problem with heap sizing/random variation of heap usage.
19-02-2024