Skip to content

[HeapViewer] failed to show threads when heap dump contains virtual threads (JDK 22) #539

@alexmenkov

Description

@alexmenkov

JDK 22 adds support of virtual threads in heap dumps (thread objects/stack traces/stack references):
https://bugs.openjdk.org/browse/JDK-8316691
https://bugs.openjdk.org/browse/JDK-8299426

VisualVM fails to show threads if heap dump contains virtual threads:

  • open the heap dump;
  • switch to "Threads";
    error:
    java.lang.NullPointerException
    at org.graalvm.visualvm.heapviewer.java.impl.JavaThreadsProvider.getThreadName(JavaThreadsProvider.java:89)

The reason is JavaThreadsProvider expects Thread object has non-null "holder" field.
VirtualThread objects have null "holder" field (virtual threads are always daemon threads, they have fixed priority that cannot be changed, thread status is stored in VirtualThread object).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions