Monday, July 14, 2014

Openjdk bug that results in NullPointerException when taking a dump from jmap utility

When taking a heap dump using jmap utility, you might see a NPE thrown such as below:-

$jmap -dump:format=b,file=/tmp/dump <pid>
Debugger attached successfully.
Server compiler detected.
JVM version is 24.51-b03
Dumping heap to /tmp/asgportaldump ...
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:606)
        at sun.tools.jmap.JMap.runTool(JMap.java:197)
        at sun.tools.jmap.JMap.main(JMap.java:128)
Caused by: java.lang.NullPointerException
        at sun.jvm.hotspot.utilities.HeapHprofBinWriter.writeSymbolID(HeapHprofBinWriter.java:905)
        at sun.jvm.hotspot.utilities.HeapHprofBinWriter.writeFieldDescriptors(HeapHprofBinWriter.java:743)
        at sun.jvm.hotspot.utilities.HeapHprofBinWriter.writeClassDumpRecord(HeapHprofBinWriter.java:508)
        at sun.jvm.hotspot.utilities.HeapHprofBinWriter.access$000(HeapHprofBinWriter.java:297)
        at sun.jvm.hotspot.utilities.HeapHprofBinWriter$1.visit(HeapHprofBinWriter.java:446)
        at sun.jvm.hotspot.memory.SystemDictionary$2.visit(SystemDictionary.java:179)

Openjdk defect id - JDK-8023105

No comments:

Post a Comment