JDK-8214932 : Implement more checks for archiving object subgraphs
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 12
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2018-12-06
  • Updated: 2023-01-12
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.
Other
tbdUnresolved
Related Reports
Relates :  
Relates :  
Relates :  
Description
The following is moved from JDK-8207381 for tracking the subgraph validation/guard work:

We need a mechanism to validate that the new sub-graph for archiving is 'preservable'. There are following starter approaches: 

Approach 1) 
Author driven approach. The author who's adding a new sub-graph archiving need to specify all classes included in the graph are 'preservable'. Method for how to specify 'preservable' state is not determined yet currently. 

Approach 2) 
Add guards to the archived sub-graph during dump time. When archiving a sub-graph, checks can be done for the objects within the sub-graph to make sure they are not the ones with known issues (such as Thread, etc). 

Approach 3) 
This is suggested by Ioi. Dump time can consult a list of classes maintained internally by the sub-graph archiving mechanism. Only instances of classes on the list can be included in the archived sub-graph. When new sub-graphs are archived, new classes may be added to the list. Only classes with no runtime dependencies should be added to the list.

I'm in favor of the third option, augmented with the following optimization to limit the size of the list: 

If an object's class is a sub-type of Serializable, the object is allowed to be part of an archived sub-graph, otherwise the list is consulted at dump time. Only classes that are not Serializable and have no dependencies on runtime context need to be maintained in the list (when their instances are part of archived sub-graphs). 

In the future, when any of the classes in the list become sub-types of Serializable, they can be removed from the list.
Comments
We should consider specs in Leyden that makes it safe to archive Java heap objects.
12-01-2023