I was attempting to load a hprof from visualvm 2.1.6 in the netbeans profiler. Instead of loading, it threw an NPE
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "org.netbeans.lib.profiler.heap.Instance.getInstanceId()" because the return value of "org.netbeans.lib.profiler.heap.GCRoot.getInstance()" is null
at org.netbeans.lib.profiler.heap.HprofGCRoots.getGCRoot(HprofGCRoots.java:96)
at org.netbeans.lib.profiler.heap.NearestGCRoot.writeConnection(NearestGCRoot.java:311)
at org.netbeans.lib.profiler.heap.NearestGCRoot.writeClassConnection(NearestGCRoot.java:294)
at org.netbeans.lib.profiler.heap.NearestGCRoot.computeOneLevel(NearestGCRoot.java:219)
at org.netbeans.lib.profiler.heap.NearestGCRoot.computeGCRoots(NearestGCRoot.java:109)
at org.netbeans.lib.profiler.heap.NearestGCRoot.getLeaves(NearestGCRoot.java:373)
at org.netbeans.lib.profiler.heap.HprofHeap.computeRetainedSize(HprofHeap.java:704)
at org.netbeans.lib.profiler.heap.HprofHeap.getBiggestObjectsByRetainedSize(HprofHeap.java:186)
How to reproduce
Minimal code:
package simpletest;
import java.io.File;
import org.netbeans.lib.profiler.heap.HeapFactory;
public class Test {
public static void main(String[] args) throws Exception {
HeapFactory.createHeap(new File(args[0])).getBiggestObjectsByRetainedSize(15); // number doesn't matter
}
}
I narrowed it down to the tags from computeGCRootsFor(heap.getHeapTagBound(HprofHeap.ROOT_STICKY_CLASS), rootList); being somehow wrong. Commenting out the sticky class in HprofGCRoots avoids the crash, but obviously isn't correct.
Apache NetBeans version
Apache NetBeans 18
What happened
I was attempting to load a hprof from visualvm 2.1.6 in the netbeans profiler. Instead of loading, it threw an NPE
How to reproduce
Minimal code:
Minimal pom:
Dump causing issues: triggering-dump.zip
I narrowed it down to the tags from
computeGCRootsFor(heap.getHeapTagBound(HprofHeap.ROOT_STICKY_CLASS), rootList);
being somehow wrong. Commenting out the sticky class in HprofGCRoots avoids the crash, but obviously isn't correct.Did this work correctly in an earlier version?
No / Don't know
Operating System
RHEL8.8
JDK
openjdk 1.8.0.372 && oracle 17.0.6
Apache NetBeans packaging
Other
Anything else
From maven jars.
Triggering hprof: triggering-dump.zip
Are you willing to submit a pull request?
No