Repository navigation
Closed
Description
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
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
}
}Minimal pom:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test</groupId>
<artifactId>test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.netbeans.modules</groupId>
<artifactId>org-netbeans-lib-profiler</artifactId>
<version>RELEASE180</version>
</dependency>
</dependencies>
</project>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
Activity
mbien commentedon Nov 19, 2023
@thurka you are probably the most qualified to take a look at this since you wrote it. I suppose the heapdump format changed?
32kda commentedon Jun 10, 2026
I think the same issue here, while trying to get retained size:
Fix apache#6357: unresolved sticky class GC roots
Fix apache#6357: retain sticky class GC roots by ID
Fix apache#6357: retain sticky class GC roots by ID
Fix apache#6357: retain sticky class GC roots by ID
Fix apache#6357: retain sticky class GC roots by ID