New relic java agent 7.5.0 throws NullPointerException and freezes the application
See original GitHub issueDescription
NullPointerException is thrown by new relic java agent, when version 7.5.0 is enabled for my web application. When I invoke an endpoint that does some processing, it freezes the application fatally. The only way out to recover from this error is to restart the pod. This is a blocker / show stopper so I downgraded to version 6.5.3. Version 7.4.3 also has similar problem. The stack trace is as follows
Exception in thread "sdk-async-response-17-0" java.lang.NullPointerException
at util.TokenAndRefUtils.setThreadTokenAndRefCount(TokenAndRefUtils.java:29)
at util.TokenAwareRunnable.run(TokenAwareRunnable.java:27)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at java.base/java.lang.Thread.run(Thread.java:832)
Exception in thread "Thread-5980" java.lang.NullPointerException
at util.TokenAndRefUtils.setThreadTokenAndRefCount(TokenAndRefUtils.java:29)
at util.TokenAwareRunnable.run(TokenAwareRunnable.java:27)
at java.base/java.lang.Thread.run(Thread.java:832)
Exception in thread "sdk-async-response-14-0" Exception in thread "Thread-5981" java.lang.NullPointerException
at util.TokenAndRefUtils.setThreadTokenAndRefCount(TokenAndRefUtils.java:29)
at util.TokenAwareRunnable.run(TokenAwareRunnable.java:27)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at java.base/java.lang.Thread.run(Thread.java:832)
java.lang.NullPointerException
at util.TokenAndRefUtils.clearThreadTokenAndRefCountAndTxn(TokenAndRefUtils.java:36)
at util.TokenAwareRunnable.run(TokenAwareRunnable.java:32)
at java.base/java.lang.Thread.run(Thread.java:832)
Expected Behavior
The application continue to work flawlessly without any disruption or denial of service, caused by new relic agent. I was under the impression that https://github.com/newrelic/newrelic-java-agent/pull/530 would fix this problem but I am wrong.
Your Environment
New relic java agent version: 7.5.0 New relic logging version: 2.3.1 Java: OpenJDK version 11.0.12 JVM: OpenJDK 64-Bit Server VM Zulu11.50+19-CA Scala: 2.13.6 Akka: 2.6.14 Akka HTTP: 10.2.4 Cats: 2.6.1 Cats effect: 3.2.2 Logback: 1.2.3
Additional context
See https://github.com/newrelic/newrelic-java-agent/issues/544
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (4 by maintainers)
My apologies for the late response. Here’s the sample code that you requested. This is from a controller that offers real health check by verifying database connectivity along with an actor system check. When this endpoint was invoked by k8s liveliness probe, the container froze in an irrecoverable failure; which could only be recoverred via a restart of pod.
where HealthCheckService is as shown below
Relevant snippet from newrelic.yml configuration file is as shown below
fixed on #859