RFR[S] 8210289 ArchivedKlassSubGraphInfoRecord is incomplete
Ioi Lam
ioi.lam at oracle.com
Sun Sep 2 01:08:06 UTC 2018
https://bugs.openjdk.java.net/browse/JDK-8210289
http://cr.openjdk.java.net/~iklam/jdk12/8210289-subgraph-record-incomplete.v01/
Description
===========
I found this bug while trying to merge my code for CDS support of Lambda
classes (JDK-8198698).
When heapShared.cpp dumps a sub-graph of heap objects, it attempts to
record all the classes of all the objects that are referenced by
this sub-graph. However, if one of these objects have already been visited
while a previous sub-graph was dumped, then this object's class is not
recorded in the current sub-graph.
At runtime, if the current sub-graph is restored before any other
sub-graphs, we will end up with a live object in the Java heap with
an uninitialized class.
Fix
===
Now I create the sub-graph's klasses list after all sub-graphs have dumped.
For each class that has archived sub-graph(s), I do a heap walk to discover
all klasses that are reachable from this archived fields of this class.
This is sub-optimal but suffice for now because we just have a very small
number of sub-graphs. The worst case its O(N^2) where N is the number of
objects in the archived heap.
In the future, we might need to implement a more efficient algorithm that
walks the heap once and computes all the klasses lists of all the
sub-graphs at the same time.
Testing
=======
hs-tier[1,2,3]
Thanks
- Ioi
More information about the hotspot-runtime-dev
mailing list