-
Enhancement
-
Resolution: Won't Fix
-
P2
-
None
-
8u212
Running jmap with both -F and the live flag as below:
<JAVA_HOME>/bin/jmap -F -dump:live,format=b,file=heap.hprof <PID>
fails with:
Attaching to process ID <PID>, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.212-b10
Dumping heap to /opt/heapdumps/heap.hprof ...
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.tools.jmap.JMap.runTool(JMap.java:201)
at sun.tools.jmap.JMap.main(JMap.java:130)
Caused by: sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index -32767 51277
at sun.jvm.hotspot.utilities.Assert.that(Assert.java:32)
at sun.jvm.hotspot.oops.ConstantPool.indexOffset(ConstantPool.java:155)
at sun.jvm.hotspot.oops.ConstantPool.getAddressAtRaw(ConstantPool.java:169)
at sun.jvm.hotspot.oops.ConstantPool.getSymbolAt(ConstantPool.java:173)
at sun.jvm.hotspot.oops.InstanceKlass.getFieldName(InstanceKlass.java:263)
at sun.jvm.hotspot.oops.Field.<init>(Field.java:50)
at sun.jvm.hotspot.oops.IntField.<init>(IntField.java:41)
at sun.jvm.hotspot.oops.InstanceKlass.newField(InstanceKlass.java:932)
at sun.jvm.hotspot.oops.InstanceKlass.getFieldByIndex(InstanceKlass.java:703)
at sun.jvm.hotspot.oops.InstanceKlass.getImmediateFields(InstanceKlass.java:717)
at sun.jvm.hotspot.utilities.HeapHprofBinWriter.getInstanceFields(HeapHprofBinWriter.java:1021)
at sun.jvm.hotspot.utilities.HeapHprofBinWriter.writeClassDumpRecord(HeapHprofBinWriter.java:564)
at sun.jvm.hotspot.utilities.HeapHprofBinWriter.access$000(HeapHprofBinWriter.java:310)
at sun.jvm.hotspot.utilities.HeapHprofBinWriter$1.visit(HeapHprofBinWriter.java:524)
at sun.jvm.hotspot.memory.SystemDictionary$2.visit(SystemDictionary.java:179)
at sun.jvm.hotspot.memory.Dictionary.classesDo(Dictionary.java:68)
at sun.jvm.hotspot.memory.SystemDictionary.classesDo(SystemDictionary.java:190)
at sun.jvm.hotspot.memory.SystemDictionary.allClassesDo(SystemDictionary.java:183)
at sun.jvm.hotspot.utilities.HeapHprofBinWriter.writeClassDumpRecords(HeapHprofBinWriter.java:520)
at sun.jvm.hotspot.utilities.HeapHprofBinWriter.write(HeapHprofBinWriter.java:430)
at sun.jvm.hotspot.tools.HeapDumper.run(HeapDumper.java:62)
at sun.jvm.hotspot.tools.Tool.startInternal(Tool.java:260)
at sun.jvm.hotspot.tools.Tool.start(Tool.java:223)
at sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)
at sun.jvm.hotspot.tools.HeapDumper.main(HeapDumper.java:83)
... 6 more
Per the documentation, this is not supported:
https://docs.oracle.com/javase/8/docs/technotes/tools/unix/jmap.html
It explains:
"-F
Force. Use this option with the jmap -dump or jmap -histo option when the pid
does not respond. The live suboption is not supported in this mode."
Please return an user friendly error from jmap when the -F flag is
encountered with the live suboption rather resulting with an exception.
<JAVA_HOME>/bin/jmap -F -dump:live,format=b,file=heap.hprof <PID>
fails with:
Attaching to process ID <PID>, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.212-b10
Dumping heap to /opt/heapdumps/heap.hprof ...
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.tools.jmap.JMap.runTool(JMap.java:201)
at sun.tools.jmap.JMap.main(JMap.java:130)
Caused by: sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index -32767 51277
at sun.jvm.hotspot.utilities.Assert.that(Assert.java:32)
at sun.jvm.hotspot.oops.ConstantPool.indexOffset(ConstantPool.java:155)
at sun.jvm.hotspot.oops.ConstantPool.getAddressAtRaw(ConstantPool.java:169)
at sun.jvm.hotspot.oops.ConstantPool.getSymbolAt(ConstantPool.java:173)
at sun.jvm.hotspot.oops.InstanceKlass.getFieldName(InstanceKlass.java:263)
at sun.jvm.hotspot.oops.Field.<init>(Field.java:50)
at sun.jvm.hotspot.oops.IntField.<init>(IntField.java:41)
at sun.jvm.hotspot.oops.InstanceKlass.newField(InstanceKlass.java:932)
at sun.jvm.hotspot.oops.InstanceKlass.getFieldByIndex(InstanceKlass.java:703)
at sun.jvm.hotspot.oops.InstanceKlass.getImmediateFields(InstanceKlass.java:717)
at sun.jvm.hotspot.utilities.HeapHprofBinWriter.getInstanceFields(HeapHprofBinWriter.java:1021)
at sun.jvm.hotspot.utilities.HeapHprofBinWriter.writeClassDumpRecord(HeapHprofBinWriter.java:564)
at sun.jvm.hotspot.utilities.HeapHprofBinWriter.access$000(HeapHprofBinWriter.java:310)
at sun.jvm.hotspot.utilities.HeapHprofBinWriter$1.visit(HeapHprofBinWriter.java:524)
at sun.jvm.hotspot.memory.SystemDictionary$2.visit(SystemDictionary.java:179)
at sun.jvm.hotspot.memory.Dictionary.classesDo(Dictionary.java:68)
at sun.jvm.hotspot.memory.SystemDictionary.classesDo(SystemDictionary.java:190)
at sun.jvm.hotspot.memory.SystemDictionary.allClassesDo(SystemDictionary.java:183)
at sun.jvm.hotspot.utilities.HeapHprofBinWriter.writeClassDumpRecords(HeapHprofBinWriter.java:520)
at sun.jvm.hotspot.utilities.HeapHprofBinWriter.write(HeapHprofBinWriter.java:430)
at sun.jvm.hotspot.tools.HeapDumper.run(HeapDumper.java:62)
at sun.jvm.hotspot.tools.Tool.startInternal(Tool.java:260)
at sun.jvm.hotspot.tools.Tool.start(Tool.java:223)
at sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)
at sun.jvm.hotspot.tools.HeapDumper.main(HeapDumper.java:83)
... 6 more
Per the documentation, this is not supported:
https://docs.oracle.com/javase/8/docs/technotes/tools/unix/jmap.html
It explains:
"-F
Force. Use this option with the jmap -dump or jmap -histo option when the pid
does not respond. The live suboption is not supported in this mode."
Please return an user friendly error from jmap when the -F flag is
encountered with the live suboption rather resulting with an exception.