JDK-7031614 : jmap -permstat fails with java.lang.InternalError in sun.jvm.hotspot.oops.OopField.getValue
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: hs21
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2011-03-28
  • Updated: 2012-02-01
  • Resolved: 2011-04-25
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 7 Other
7Fixed hs21Fixed
Related Reports
Duplicate :  
Relates :  
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 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.
30-03-2011

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

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.
28-03-2011