JDK-8326820 : Metadata artificially kept alive
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 23
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-02-27
  • Updated: 2024-10-15
  • Resolved: 2024-06-27
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 23 JDK 24
23Fixed 24 b05Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
Most iteration through CLDG currently keeps the metadata alive by loading the holder and creates a handle to it. 

For most task this looks seemingly too restrictive and unnecessary. We should evaluate where this is needed and try to remove the artificial lifetime extension that can occur.

The CLDG iterator can also become far less restrictive after JDK-8307106 (and JDK-8308387) which made the CLDG list concurrent. 

Holding `ClassLoaderDataGraph_lock` may still be required for some uses but it is not a requirement for the iterator. 

In JDK-8326005 we observe that metadata for some ~160K transient LambdaForm are kept alive while a last ditch metaspace GC is performed, leading to an metaspace out of memory. 

Added this as a bug so we do not lose track of this issue. 
This effects generational ZGC the most as the last ditch metaspace GCs are concurrent and it only does reference processing (and by extension class unloading) for the old generation in major collections. 
Comments
This caused a regression, see JDK-8340586.
15-10-2024

Maybe related to JDK-8325594?
09-07-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/19929 Date: 2024-06-27 14:30:43 +0000
27-06-2024

Changeset: 5909d541 Author: Axel Boldt-Christmas <aboldtch@openjdk.org> Date: 2024-06-27 14:21:34 +0000 URL: https://git.openjdk.org/jdk/commit/5909d54147355dd7da5786ff39ead4c15816705c
27-06-2024

This is the cause of various issues. Changing this to Bug instead of Enh and using P2 to reflect the most sever relates-to bug.
18-06-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/19769 Date: 2024-06-18 12:25:36 +0000
18-06-2024

JDK-8280454 has been a specific similar issue.
28-02-2024

JDK-8326005 is most likely a symptom of this issue.
27-02-2024