United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7031614 jmap -permstat fails with java.lang.InternalError in sun.jvm.hotspot.oops.OopField.getValue
JDK-7031614 : jmap -permstat fails with java.lang.InternalError in sun.jvm.hotspot.oops.OopField.getValue

Details
Type:
Bug
Submit Date:
2011-03-28
Status:
Closed
Updated Date:
2012-02-01
Project Name:
JDK
Resolved Date:
2011-04-25
Component:
hotspot
OS:
generic
Sub-Component:
runtime
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
hs21
Fixed Versions:
hs21 (b07)

Related Reports
Backport:
Duplicate:
Relates:

Sub Tasks

Description
jmap -permstat and jmap -finalizerinfo fail with exception starting HS 21 b06:
...
please wait.. computing liveness....Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:613)
        at sun.tools.jmap.JMap.runTool(JMap.java:197)
        at sun.tools.jmap.JMap.main(JMap.java:128)
Caused by: java.lang.InternalError
        at sun.jvm.hotspot.oops.OopField.getValue(OopField.java:45)
        at sun.jvm.hotspot.utilities.ReversePtrsAnalysis$2.doOop(ReversePtrsAnalysis.java:244)
        at sun.jvm.hotspot.oops.InstanceKlass.visitField(InstanceKlass.java:747)
        at sun.jvm.hotspot.oops.InstanceKlass.iterateFields(InstanceKlass.java:471)
        at sun.jvm.hotspot.oops.Oop.iterate(Oop.java:167)
        at sun.jvm.hotspot.utilities.ReversePtrsAnalysis.markAndTraverse(ReversePtrsAnalysis.java:241)
        at sun.jvm.hotspot.utilities.ReversePtrsAnalysis.access$200(ReversePtrsAnalysis.java:43)
        at sun.jvm.hotspot.utilities.ReversePtrsAnalysis$RootVisitor.visitAddress(ReversePtrsAnalysis.java:282)
        at sun.jvm.hotspot.runtime.JNIHandleBlock.oopsDo(JNIHandleBlock.java:85)
        at sun.jvm.hotspot.utilities.ReversePtrsAnalysis.doJNIHandleBlock(ReversePtrsAnalysis.java:306)
        at sun.jvm.hotspot.utilities.ReversePtrsAnalysis.run(ReversePtrsAnalysis.java:110)
        at sun.jvm.hotspot.tools.PermStat.printClassLoaderStatistics(PermStat.java:174)
        at sun.jvm.hotspot.tools.PermStat.run(PermStat.java:67)
        at sun.jvm.hotspot.tools.Tool.start(Tool.java:221)
        at sun.jvm.hotspot.tools.PermStat.main(PermStat.java:46)
        ... 6 more

                                    

Comments
EVALUATION

InstanceKlass.java is still visiting the static fields for the InstanceKlass instead of when visiting the java mirror which causes oop iteration to fail.
                                     
2011-03-28
EVALUATION

http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot/rev/63997f575155
                                     
2011-03-30
EVALUATION

7031614: jmap -permstat fails with java.lang.InternalError in sun.jvm.hotspot.oops.OopField.getValue
Reviewed-by: kvn, dcubed

There were some places that were finding static fields by iterating
over the InstanceKlass object which I missed in my original changes.
I added an iterateStaticFields that hides the owner the static fields
and uses the OopVisitor.getObj to return the proper object.  I
inspected all the iterateFields call sites to make sure I didn't miss
any.  Additionally iteration of the mirror wasn't visiting the static
fields so some roots might be missed by the reverse pointers analysis.
There is heap iteration code in the SA and the InstanceMirrorKlass
wasn't plugged into the the oop sizing logic in the SA which caused
some searches to fail.  I needed to add access to oop_size so I moved
the java_lang_Class style utilities into their own class and made them
like normal SA style classes.  Tested with the full tmtools suite that
showed these issues plus some other which don't appear to have been
reported.
                                     
2011-03-30



Hardware and Software, Engineered to Work Together