Skip to content

NPE in profiler trying to display thread dump#9228

Merged
mbien merged 1 commit intoapache:masterfrom
jglick:hprof-thread
Feb 25, 2026
Merged

NPE in profiler trying to display thread dump#9228
mbien merged 1 commit intoapache:masterfrom
jglick:hprof-thread

Conversation

@jglick
Copy link
Contributor

@jglick jglick commented Feb 24, 2026

Without this patch, opening a particular 16Gb heap dump I have (taken from Java 21) and clicking on the hyperlink to show threads fails with

java.lang.NullPointerException: Cannot invoke "java.lang.Boolean.booleanValue()" because "daemon" is null
	at org.netbeans.modules.profiler.heapwalk.OverviewController.getStackTrace(OverviewController.java:467)
	at org.netbeans.modules.profiler.heapwalk.OverviewController.computeThreads(OverviewController.java:277)
	at org.netbeans.modules.profiler.heapwalk.ui.OverviewControllerUI$1.run(OverviewControllerUI.java:125)
	at …

Why the daemon field would not be present, I do not know.

With the patch, the threads (about 400) are displayed, although the GUI freezes for a couple minutes

"AWT-EventQueue-0" #39 [54712] prio=6 os_prio=0 cpu=93980.19ms elapsed=119.05s tid=0x00007921680cb860 nid=54712 runnable  [0x0000792189dfc000]
   java.lang.Thread.State: RUNNABLE
	at sun.text.RuleBasedBreakIterator.handleNext(java.base@21.0.10/RuleBasedBreakIterator.java:940)
	at sun.text.RuleBasedBreakIterator.previous(java.base@21.0.10/RuleBasedBreakIterator.java:639)
	at sun.text.RuleBasedBreakIterator.preceding(java.base@21.0.10/RuleBasedBreakIterator.java:792)
	at javax.swing.text.GlyphView.getBreakSpot(java.desktop@21.0.10/GlyphView.java:792)
	at javax.swing.text.GlyphView.getBreakWeight(java.desktop@21.0.10/GlyphView.java:717)
	at javax.swing.text.html.InlineView.getBreakWeight(java.desktop@21.0.10/InlineView.java:150)
	at javax.swing.text.FlowView$LogicalView.getPreferredSpan(java.desktop@21.0.10/FlowView.java:754)
	at javax.swing.text.FlowView.calculateMinorAxisRequirements(java.desktop@21.0.10/FlowView.java:241)
	at javax.swing.text.ParagraphView.calculateMinorAxisRequirements(java.desktop@21.0.10/ParagraphView.java:709)
	at javax.swing.text.html.ParagraphView.calculateMinorAxisRequirements(java.desktop@21.0.10/ParagraphView.java:162)
	at javax.swing.text.BoxView.checkRequests(java.desktop@21.0.10/BoxView.java:936)
	at javax.swing.text.BoxView.getPreferredSpan(java.desktop@21.0.10/BoxView.java:546)
	at javax.swing.text.html.ParagraphView.getPreferredSpan(java.desktop@21.0.10/ParagraphView.java:258)
	at javax.swing.text.html.LineView.getMinimumSpan(java.desktop@21.0.10/LineView.java:74)
	at javax.swing.text.BoxView.calculateMinorAxisRequirements(java.desktop@21.0.10/BoxView.java:904)
	at javax.swing.text.html.BlockView.calculateMinorAxisRequirements(java.desktop@21.0.10/BlockView.java:146)
	at javax.swing.text.BoxView.checkRequests(java.desktop@21.0.10/BoxView.java:936)
	at javax.swing.text.BoxView.getMinimumSpan(java.desktop@21.0.10/BoxView.java:569)
	at javax.swing.text.html.BlockView.getMinimumSpan(java.desktop@21.0.10/BlockView.java:378)
	at javax.swing.text.BoxView.calculateMinorAxisRequirements(java.desktop@21.0.10/BoxView.java:904)
	at javax.swing.text.html.BlockView.calculateMinorAxisRequirements(java.desktop@21.0.10/BlockView.java:146)
	at javax.swing.text.BoxView.checkRequests(java.desktop@21.0.10/BoxView.java:936)
	at javax.swing.text.BoxView.getMinimumSpan(java.desktop@21.0.10/BoxView.java:569)
	at javax.swing.text.html.BlockView.getMinimumSpan(java.desktop@21.0.10/BlockView.java:378)
	at javax.swing.text.BoxView.calculateMinorAxisRequirements(java.desktop@21.0.10/BoxView.java:904)
	at javax.swing.text.html.BlockView.calculateMinorAxisRequirements(java.desktop@21.0.10/BlockView.java:146)
	at javax.swing.text.BoxView.checkRequests(java.desktop@21.0.10/BoxView.java:936)
	at javax.swing.text.BoxView.setSpanOnAxis(java.desktop@21.0.10/BoxView.java:344)
	at javax.swing.text.BoxView.layout(java.desktop@21.0.10/BoxView.java:709)
	at javax.swing.text.BoxView.setSize(java.desktop@21.0.10/BoxView.java:398)
	at javax.swing.plaf.basic.BasicTextUI$RootView.setSize(java.desktop@21.0.10/BasicTextUI.java:1839)
	at javax.swing.plaf.basic.BasicTextUI.getPreferredSize(java.desktop@21.0.10/BasicTextUI.java:959)
	at com.formdev.flatlaf.ui.FlatEditorPaneUI.getPreferredSize(FlatEditorPaneUI.java:223)
	at javax.swing.JComponent.getPreferredSize(java.desktop@21.0.10/JComponent.java:1734)
	at javax.swing.JEditorPane.getPreferredSize(java.desktop@21.0.10/JEditorPane.java:1392)
	at org.netbeans.lib.profiler.ui.components.HTMLTextArea.getPreferredSize(HTMLTextArea.java:654)
	at javax.swing.ScrollPaneLayout.layoutContainer(java.desktop@21.0.10/ScrollPaneLayout.java:799)
	at com.formdev.flatlaf.ui.FlatScrollPaneUI$FlatScrollPaneLayout.layoutContainer(FlatScrollPaneUI.java:563)
	at java.awt.Container.layout(java.desktop@21.0.10/Container.java:1541)
	at java.awt.Container.doLayout(java.desktop@21.0.10/Container.java:1530)
	at java.awt.Container.validateTree(java.desktop@21.0.10/Container.java:1725)
	at java.awt.Container.validate(java.desktop@21.0.10/Container.java:1660)
	- locked <0x000000041a4b0208> (a java.awt.Component$AWTTreeLock)
	at javax.swing.RepaintManager$3.run(java.desktop@21.0.10/RepaintManager.java:757)
	at …

^Add meaningful description above

Click to collapse/expand PR instructions

By opening a pull request you confirm that, unless explicitly stated otherwise, the changes -

  • are all your own work, and you have the right to contribute them.
  • are contributed solely under the terms and conditions of the Apache License 2.0 (see section 5 of the license for more information).

Please make sure (eg. git log) that all commits have a valid name and email address for you in the Author field.

If you're a first time contributor, see the Contributing guidelines for more information.

If you're a committer, please label the PR before pressing "Create pull request" so that the right test jobs can run.

PR approval and merge checklist:

  1. Was this PR correctly labeled, did the right tests run? When did they run?
  2. Is this PR squashed?
  3. Are author name / email address correct? Are co-authors correctly listed? Do the commit messages need updates?
  4. Does the PR title and description still fit after the Nth iteration? Is the description sufficient to appear in the release notes?

If this PR targets the delivery branch: don't merge. (full wiki article)

@mbien mbien added Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) profiler labels Feb 24, 2026
@mbien mbien added this to the NB30 milestone Feb 24, 2026
@apache apache locked and limited conversation to collaborators Feb 24, 2026
@apache apache unlocked this conversation Feb 24, 2026
Copy link
Member

@mbien mbien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool!

@mbien mbien merged commit 7a5dc2c into apache:master Feb 25, 2026
92 of 100 checks passed
@jglick jglick deleted the hprof-thread branch February 25, 2026 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) profiler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants