JDK-8321299 : runtime/logging/ClassLoadUnloadTest.java doesn't reliably trigger class unloading
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 22
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-12-04
  • Updated: 2024-10-25
  • Resolved: 2024-03-13
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 21 JDK 23
17.0.14Fixed 21.0.6-oracleFixed 23 b14Fixed
Related Reports
Relates :  
Description
runtime/logging/ClassLoadUnloadTest.java doesn't trigger unloading of test.Empty class.  

The test accidentally pass due to an unrelated class being unloaded:

$ java ... -Xlog:class+unload=info ... ClassLoadUnloadTest\$ClassUnloadTestMain
[0.113s][info][class,unload] unloading class java.lang.invoke.LambdaForm$MH/0x000007c001002000 0x000007c001002000

Comments
Fix request [21u] I backport this for parity with 21.0.6-oracle. No risk, only a test change Clean backport. Test passes. SAP nightly testing passed.
12-10-2024

Fix request [17u] Included in backport of JDK-8289184
12-10-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk17u-dev/pull/2937 Date: 2024-10-04 10:02:31 +0000
11-10-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk21u-dev/pull/1045 Date: 2024-10-11 11:07:47 +0000
11-10-2024

Changeset: 5cae7d20 Author: Matias Saavedra Silva <matsaave@openjdk.org> Date: 2024-03-13 16:54:53 +0000 URL: https://git.openjdk.org/jdk/commit/5cae7d20adf9828e05d3cd2823c6b95ee1ab6db4
13-03-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/18207 Date: 2024-03-11 21:21:24 +0000
11-03-2024

This needs detailed investigation as we use wb.fullGC() to trigger class unloading and the Empty class should be unloaded. I tweaked the test and can confirm that the only unloading is for the LambdaForm class as listed. Further investigation shows that the test.Empty class is being loaded by the normal AppLoader not the custom loader that is expected to load it. Loaded class: class test.Empty in classloader jdk.internal.loader.ClassLoaders$AppClassLoader@5ffd2b27 Current classloader is jdk.internal.loader.ClassLoaders$AppClassLoader@5ffd2b27 Yet I can't see why the custom loader would not be able to load it as the test.class.path value seems correct.
05-12-2023