JDK-8289257 : Some custom loader tests failed due to symbol refcount not decremented
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 20
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2022-06-28
  • Updated: 2022-10-04
  • Resolved: 2022-07-01
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 17 JDK 20
17.0.6-oracleFixed 20 b05Fixed
Related Reports
Relates :  
Relates :  
Sub Tasks
JDK-8289258 :  
Description
Failing tests:

runtime/cds/appcds/customLoader/HelloCustom.java 
 runtime/cds/appcds/customLoader/HelloCustom_JFR.java
 runtime/cds/appcds/dynamicArchive/HelloDynamicCustomUnload.java

In Windows, Linux and MacOS.

Comments
Fix request [17u] I backport this for parity with 17.0.6-oracle. No risk, only a test change. Clean backport except for ProblemLIst. Depends on JDK-8288651. Tests mentioned above pass. SAP nightly testing passed.
01-10-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk17u-dev/pull/756 Date: 2022-09-29 14:19:49 +0000
29-09-2022

Changeset: c43bdf71 Author: Calvin Cheung <ccheung@openjdk.org> Date: 2022-07-01 16:11:17 +0000 URL: https://git.openjdk.org/jdk/commit/c43bdf716596053ebe473c3b3bd5cf89482b9b01
01-07-2022

Why isn't the refcount decremented? Ok, assume that it's because concurrent symbol table cleaning hasn't happened yet. I linked another bug to this. I think triggerUnloading() is wholly insufficient for making sure classes are unloaded. Not sure what the fix is. Maybe adding WB.fullGC() to triggerUnloading()?
01-07-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/9340 Date: 2022-06-30 22:28:26 +0000
30-06-2022

The failure with ParallelGC is intermittent; I couldn't reproduce it running 20 times on the same host.
29-06-2022

Here's a log file snippet for the jdk-20+4-164-tier3 sighting: runtime/cds/appcds/dynamicArchive/HelloDynamicCustomUnload.java [0.277s][info ][class,load] java.lang.invoke.LambdaForm$MH/0x0000000801005c00 source: __JVM_LookupDefineClass__ Refcount of symbol HelloClassLoader1656512778654 is 2 [0.307s][info ][class,unload] unloading class CustomLoadee 0x0000000801002000 [0.321s][info ][class,load ] java.lang.invoke.LambdaForm$MH/0x0000000801002000 source: __JVM_LookupDefineClass__ [0.322s][info ][class,load ] java.lang.invoke.LambdaForm$MH/0x0000000801002400 source: __JVM_LookupDefineClass__ [0.323s][info ][class,load ] java.lang.invoke.LambdaForm$MH/0x0000000801006000 source: __JVM_LookupDefineClass__ [0.323s][info ][class,load ] java.lang.invoke.LambdaForm$MH/0x0000000801006400 source: __JVM_LookupDefineClass__ [0.324s][info ][class,load ] java.lang.invoke.LambdaForm$MH/0x0000000801006800 source: __JVM_LookupDefineClass__ Is CustomLoadee alive? false Refcount of symbol HelloClassLoader1656512778654 is 2 [0.326s][info ][class,load ] java.util.concurrent.locks.AbstractQueuedSynchronizer$ExclusiveNode source: shared objects file (top) [0.326s][info ][class,load ] java.io.RandomAccessFile$1 source: shared objects file [0.327s][info ][class,load ] java.lang.invoke.LambdaForm$MH/0x0000000801006c00 source: __JVM_LookupDefineClass__ [0.327s][info ][class,load ] java.lang.Throwable$PrintStreamOrWriter source: jrt:/java.base [0.327s][info ][class,load ] java.lang.Throwable$WrappedPrintStream source: jrt:/java.base [0.328s][info ][class,load ] java.util.IdentityHashMap$IdentityHashMapIterator source: shared objects file [0.328s][info ][class,load ] java.util.IdentityHashMap$KeyIterator source: shared objects file [0.329s][info ][class,load ] java.lang.Shutdown source: shared objects file [0.329s][info ][class,load ] java.lang.Shutdown$Lock source: shared objects file ]; stderr: [Exception in thread "main" jdk.test.lib.classloader.ClassUnloadCommon$TestFailure: Test failed: Refcount must be decremented at jdk.test.lib.classloader.ClassUnloadCommon.failIf(ClassUnloadCommon.java:50) at HelloUnload.main(HelloUnload.java:116) ] exitValue = 1 java.lang.RuntimeException: Expected to get exit value of [0], exit value is: [1] at jdk.test.lib.process.OutputAnalyzer.shouldHaveExitValue(OutputAnalyzer.java:490) at HelloDynamicCustomUnload.lambda$doTest$1(HelloDynamicCustomUnload.java:93) at jdk.test.lib.cds.CDSTestUtils$Result.assertNormalExit(CDSTestUtils.java:149) at HelloDynamicCustomUnload.doTest(HelloDynamicCustomUnload.java:90) at HelloDynamicCustomUnload.testDefaultBase(HelloDynamicCustomUnload.java:57) at DynamicArchiveTestBase.runTest(DynamicArchiveTestBase.java:76) at HelloDynamicCustomUnload.main(HelloDynamicCustomUnload.java:52) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) at java.base/java.lang.reflect.Method.invoke(Method.java:578) at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127) at java.base/java.lang.Thread.run(Thread.java:1589) JavaTest Message: Test threw exception: java.lang.RuntimeException: Expected to get exit value of [0], exit value is: [1] JavaTest Message: shutting down test STATUS:Failed.`main' threw exception: java.lang.RuntimeException: Expected to get exit value of [0], exit value is: [1] ----------rerun:(37/9653)*---------- The test task's JVM args are: -XX:+CreateCoredumpOnCrash -XX:+UseParallelGC -XX:+UseNUMA so this bug also happens with ParallelGC.
29-06-2022

Will problem list it in ProblemList-zgc.txt.
28-06-2022

Failures only reproducible with ZGC. class CustomLoadee java.net.URLClassLoader@6b884d57 Refcount of symbol HelloClassLoader1656391539612 is 2 Is CustomLoadee alive? false Refcount of symbol HelloClassLoader1656391539612 is 2 Exception in thread "main" jdk.test.lib.classloader.ClassUnloadCommon$TestFailure: Test failed: Refcount must be decremented at jdk.test.lib.classloader.ClassUnloadCommon.failIf(ClassUnloadCommon.java:50) at HelloUnload.main(HelloUnload.java:116) ] exitValue = 1
28-06-2022