Skip to content

Conversation

@kanderson250
Copy link
Contributor

Resolves #1774

Customers were seeing NPEs after upgrading to version 8.9.0 of the agent, which added support for vertx 4.5.1. The NPEs were happening inside our AsyncHandlerWrapper class.

This PR updates the instrumentation to prevent the creation of an AsyncHandlerWrapper if the original resultHandler is null. A further null check is added to AsyncHandlerWrapper itself to safeguard against the possibility that handle might get called twice somewhere later in the code.

I added a unit test where the resultHandler is null. However, this test isn't a "true" test because the existing NPE doesn't cause the test to fail (this NPE occurs off the main thread). Instead, an ugly SEVERE message appears in the stack trace without the fix.

I wasn't able to find a way to improve the test to truly capture the NPE, but decided to leave it in just to verify that the transaction and future handling still works as expected.

@kanderson250 kanderson250 reopened this Jun 4, 2024
@kanderson250 kanderson250 requested review from jtduffy and meiao June 4, 2024 21:08
@codecov-commenter
Copy link

codecov-commenter commented Jun 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.67%. Comparing base (5dcd0a8) to head (fc2a52f).
Report is 9 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1927      +/-   ##
============================================
+ Coverage     70.66%   70.67%   +0.01%     
- Complexity     9858     9860       +2     
============================================
  Files           826      826              
  Lines         39804    39792      -12     
  Branches       6062     6061       -1     
============================================
- Hits          28127    28123       -4     
+ Misses         8951     8946       -5     
+ Partials       2726     2723       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kanderson250 kanderson250 merged commit a418735 into main Jun 5, 2024
jgoulard added a commit to jgoulard/newrelic-java-agent that referenced this pull request Apr 22, 2025
jtduffy added a commit that referenced this pull request May 19, 2025
Backporting changes made in PR #1927 to older versions of the vertx-core implementation

All tests passed in #2362

@jgoulard  Thanks for the contribution!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Add vertx-core-4.5.3 AsyncHandlerWrapper instrumentation

5 participants