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

NullPointerException being thrown in "com.newrelic.agent.Transaction.finishSegment" #36

Open
gillesbergerp opened this issue Oct 15, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@gillesbergerp
Copy link

Description

We experience NullPointerExceptions when using the coroutine extension with Java agent version 8.15.0. Removing the extension (but staying on the same agent version) does not result in the problem

Relevant Logs / Console output

java.lang.NullPointerException:
 Cannot invoke 
"com.newrelic.agent.Transaction.finishSegment(com.newrelic.agent.Segment,
 java.lang.Throwable, com.newrelic.agent.tracers.Tracer, String)" 
because the return value of 
"com.newrelic.agent.TransactionActivity.getTransaction()" is null
	at com.newrelic.agent.Segment$1.run(Segment.java:203)
	at 
com.newrelic.agent.ExpirationService.expireSegmentInline(ExpirationService.java:47)
	at com.newrelic.agent.Segment.finish(Segment.java:215)
	at com.newrelic.agent.Segment.end(Segment.java:144)
	at 
com.nr.agent.mongo.NRCallbackWrapper.onResult(NRCallbackWrapper.java:48)
	at 
com.mongodb.internal.async.ErrorHandlingResultCallback.onResult(ErrorHandlingResultCallback.java:47)
	at 
com.mongodb.internal.async.function.AsyncCallbackSupplier.lambda$whenComplete$1(AsyncCallbackSupplier.java:97)
	at 
com.mongodb.internal.async.function.RetryingAsyncCallbackSupplier$RetryingCallback.onResult(RetryingAsyncCallbackSupplier.java:116)
	at 
com.mongodb.internal.async.ErrorHandlingResultCallback.onResult(ErrorHandlingResultCallback.java:47)
	at 
com.mongodb.internal.async.function.AsyncCallbackSupplier.lambda$whenComplete$1(AsyncCallbackSupplier.java:97)
	at 
com.mongodb.internal.async.ErrorHandlingResultCallback.onResult(ErrorHandlingResultCallback.java:47)
	at 
com.mongodb.internal.async.function.AsyncCallbackSupplier.lambda$whenComplete$1(AsyncCallbackSupplier.java:97)
	at 
com.mongodb.internal.operation.FindOperation.lambda$exceptionTransformingCallback$6(FindOperation.java:369)
	at 
com.mongodb.internal.operation.AsyncOperationHelper.lambda$transformingReadCallback$19(AsyncOperationHelper.java:442)
	at 
com.mongodb.internal.async.ErrorHandlingResultCallback.onResult(ErrorHandlingResultCallback.java:47)
	at 
com.mongodb.internal.connection.LoadBalancedServer$LoadBalancedServerProtocolExecutor.lambda$executeAsync$0(LoadBalancedServer.java:186)
	at 
com.mongodb.internal.async.ErrorHandlingResultCallback.onResult(ErrorHandlingResultCallback.java:47)
	at 
com.mongodb.internal.connection.CommandProtocolImpl.lambda$executeAsync$0(CommandProtocolImpl.java:88)
	at 
com.mongodb.internal.connection.DefaultConnectionPool$PooledConnection.lambda$sendAndReceiveAsync$1(DefaultConnectionPool.java:802)
	at 
com.mongodb.internal.connection.UsageTrackingInternalConnection.lambda$sendAndReceiveAsync$1(UsageTrackingInternalConnection.java:155)
	at 
com.mongodb.internal.async.ErrorHandlingResultCallback.onResult(ErrorHandlingResultCallback.java:47)
	at 
com.mongodb.internal.connection.InternalStreamConnection.lambda$sendCommandMessageAsync$0(InternalStreamConnection.java:555)
	at 
com.mongodb.internal.connection.InternalStreamConnection$MessageHeaderCallback$MessageCallback.onResult(InternalStreamConnection.java:849)
	at 
com.mongodb.internal.connection.InternalStreamConnection$MessageHeaderCallback$MessageCallback.onResult(InternalStreamConnection.java:812)
	at 
com.mongodb.internal.connection.InternalStreamConnection$3.completed(InternalStreamConnection.java:671)
	at 
com.mongodb.internal.connection.InternalStreamConnection$3.completed(InternalStreamConnection.java:668)
	at 
com.mongodb.internal.connection.AsynchronousChannelStream$BasicCompletionHandler.completed(AsynchronousChannelStream.java:252)
	at 
com.mongodb.internal.connection.AsynchronousChannelStream$BasicCompletionHandler.completed(AsynchronousChannelStream.java:235)
	at java.base/sun.nio.ch.Invoker.invokeUnchecked(Unknown Source)
	at java.base/sun.nio.ch.Invoker.invokeDirect(Unknown Source)
	at 
java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.implRead(Unknown 
Source)
	at java.base/sun.nio.ch.AsynchronousSocketChannelImpl.read(Unknown 
Source)
	at java.base/sun.nio.ch.AsynchronousSocketChannelImpl.read(Unknown 
Source)
	at 
com.mongodb.internal.connection.AsynchronousSocketChannelStream$AsynchronousSocketChannelAdapter.read(AsynchronousSocketChannelStream.java:148)
	at 
com.mongodb.internal.connection.AsynchronousChannelStream.readAsync(AsynchronousChannelStream.java:124)
	at 
com.mongodb.internal.connection.AsynchronousChannelStream.readAsync(AsynchronousChannelStream.java:113)
	at 
com.mongodb.internal.connection.InternalStreamConnection.readAsync(InternalStreamConnection.java:668)
	at 
com.mongodb.internal.connection.InternalStreamConnection.access$600(InternalStreamConnection.java:98)
	at 
com.mongodb.internal.connection.InternalStreamConnection$MessageHeaderCallback.onResult(InternalStreamConnection.java:802)
	at 
com.mongodb.internal.connection.InternalStreamConnection$MessageHeaderCallback.onResult(InternalStreamConnection.java:786)
	at 
com.mongodb.internal.connection.InternalStreamConnection$3.completed(InternalStreamConnection.java:671)
	at 
com.mongodb.internal.connection.InternalStreamConnection$3.completed(InternalStreamConnection.java:668)
	at 
com.mongodb.internal.connection.AsynchronousChannelStream$BasicCompletionHandler.completed(AsynchronousChannelStream.java:252)
	at 
com.mongodb.internal.connection.AsynchronousChannelStream$BasicCompletionHandler.comple<!--EndFragment-->

Your Environment

  • NewRelic Java Agent 8.15.0
  • JRE 17
  • Kotlin 1.9.20
@gillesbergerp gillesbergerp added the bug Something isn't working label Oct 15, 2024
@dhilpipre
Copy link
Contributor

We are working on this problem. it results from problems with the Java Agent and the Kotlin-Coroutines-Suspends.jar.
As a workaround, remove the Kotlin-Coroutines-Suspends.jar from the extensions directory and restart. This should eliminate the problem but will result in Suspend methods not being tracked.

All other extension are fine and do not cause problems.

@gillesbergerp
Copy link
Author

Thanks for the fast reply. Is there an ETA for when a fix might be available?

@dhilpipre
Copy link
Contributor

The problem seems to stem from a problem when the Java Agent retransforms some Kotlin classes. I can't give an ETA until I have been able to work with them on fixing that problem but indications are that it might be a while.

@gillesbergerp
Copy link
Author

@dhilpipre, can you share an update on this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants