Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NEWRELIC-6338 NullPointerException thrown when calling addCustomAttributes #1141

Merged
merged 1 commit into from
Feb 1, 2023

Conversation

tbradellis
Copy link
Contributor

[Before contributing, please read our contributing guidelines and code of conduct.](https://issues.newrelic.com/browse/NEWRELIC-6338)

Overview

null guards shouldAddAttribute

Related Github Issue

Include a link to the related GitHub issue, if applicable

[NOTE]: # In a least one use case, a NullPointerExeception is thrown when calling any of the addCustomAttribute or addCustomAttributes method on TracedMethod. The exception is being thrown in the shouldAddAttribute() of AbstractTracer.

Description

If the following is true then a NullPointerExeception is thrown by the Agent, The async token is created but no transaction is started (No-op token created). If a method is called with the @trace attribute async set to true and the token is linked then if you try to add an attribute to TracedMethod it results in a NullPointerExeception. This seems to happen because when the resulting TransactionActivity is created its Transaction object is set to null.
In some cases it results in the application not working properly.

Testing

Testing against provided repro app

Checks

[ ] Are your contributions backwards compatible with relevant frameworks and APIs?
[ ] Does your code contain any breaking changes? Please describe.
[ ] Does your code introduce any new dependencies? Please describe.

@tbradellis
Copy link
Contributor Author

confirmed resolved in repro app attached here:
#1115

Copy link
Contributor

@jtduffy jtduffy left a comment

Choose a reason for hiding this comment

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

+1

@tbradellis tbradellis merged commit 04fb027 into main Feb 1, 2023
@tbradellis tbradellis deleted the null-guard-customattributes branch February 1, 2023 15:04
@tbradellis tbradellis changed the title NullPointerException thrown when calling addCustomAttributes NEWRELIC-6338 NullPointerException thrown when calling addCustomAttributes Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants