GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix JfrConverter.excludeStack() NullPointerException by cklin · Pull Request #1792 · async-profiler/async-profiler

Conversation

@cklin

@cklin cklin commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Description

This PR fixes a NullPointerException in JfrConverter.excludeStack() by adding a null check.

Related issues

None

Motivation and context

Sometimes an event stackTraceId may not have a corresponding stack trace, and various parts of the converter (for example JfrToPprof and JfrToFlame) already perform null checks when accessing jfr.stackTraces. But JfrConverter.excludeStack() does not have such a null check, which sometimes causes NullPointerException during conversion with exclusions (from async-profiler 4.5):

java.lang.NullPointerException: Cannot read field "methods" because "<local7>" is null
	at one.convert.JfrConverter.excludeStack(JfrConverter.java:158)
	at one.convert.JfrToPprof$1.visit(JfrToPprof.java:41)
	at one.convert.JfrConverter$AggregatedEventVisitor.visit(JfrConverter.java:368)
	at one.jfr.event.EventAggregator.forEach(EventAggregator.java:86)
	at one.convert.JfrToPprof.convertChunk(JfrToPprof.java:36)
	at one.convert.JfrConverter.convert(JfrConverter.java:47)
	at one.convert.JfrToPprof.convert(JfrToPprof.java:150)
	at one.convert.Main.convert(Main.java:87)
	at one.convert.Main.main(Main.java:75)

How has this been tested?

The fixed jfrconv successfully converts a JFR file that causes the aforementioned crash with async-profiler 4.5 and also on master.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@cklin
Fix JfrConverter.excludeStack() NullPointerException
9526f57
Sometimes an event stackTraceId may not have a corresponding stack trace, and
various parts of the converter (for example JfrToPprof and JfrToFlame) already
perform null checks when accessing jfr.stackTraces. But
JfrConverter.excludeStack() does not have such a null check, which sometimes
causes NullPointerException during conversion with exclusions.

This commit fixes the NullPointerException by adding a null check.
@github-actions

github-actions Bot commented Aug 24, 2026

Copy link
Copy Markdown

linux-x64

File Base (KiB) Treatment (KiB) Delta (KiB) % Change
bin/asprof 81.72 81.72 +0.00 +0.00%
bin/jfrconv 136.51 136.52 +0.01 +0.01%
lib/libasyncProfiler.so 576.69 576.69 +0.00 +0.00%

linux-arm64

File Base (KiB) Treatment (KiB) Delta (KiB) % Change
bin/asprof 89.59 89.59 +0.00 +0.00%
bin/jfrconv 136.51 136.52 +0.01 +0.01%
lib/libasyncProfiler.so 603.62 603.62 +0.00 +0.00%

macos

File Base (KiB) Treatment (KiB) Delta (KiB) % Change
bin/asprof 116.74 116.74 +0.00 +0.00%
bin/jfrconv 136.51 136.52 +0.01 +0.01%
lib/libasyncProfiler.dylib 953.05 953.05 +0.00 +0.00%
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@apangin
apangin merged commit 55441a2 into async-profiler:master Aug 24, 2026
25 of 26 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@apangin

apangin commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Thank you for the fix. Merged.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cklin
cklin deleted the fix-jfr-excludestack-npe branch August 24, 2026 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@cklin @apangin
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.