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 in servlet instrumentation (AsyncListener) #7449

Closed
pellmont opened this issue Dec 19, 2022 · 0 comments · Fixed by #7498
Closed

NullPointerException in servlet instrumentation (AsyncListener) #7449

pellmont opened this issue Dec 19, 2022 · 0 comments · Fixed by #7498
Labels
bug Something isn't working

Comments

@pellmont
Copy link
Contributor

Describe the bug
We are doing long polling through an async Endpoint. Due to misconfiguration of our client the client had a timeout before the server sent a response. This led to a NullPointerException in Servlet3Accessor:

The following uncaught exception was thrown by the AsyncListener: [io.opentelemetry.javaagent.instrumentation.servlet.v3_0.Servlet3Accessor$Listener] during onComplete: [java.lang.NullPointerException: Cannot invoke "javax.servlet.http.HttpServletResponse.isCommitted()" because "response" is null at io.opentelemetry.javaagent.instrumentation.servlet.v3_0.Servlet3Accessor.isResponseCommitted(Servlet3Accessor.java:70) at io.opentelemetry.javaagent.instrumentation.servlet.v3_0.Servlet3Accessor.isResponseCommitted(Servlet3Accessor.java:19) at io.opentelemetry.javaagent.instrumentation.servlet.ServletHttpAttributesGetter.statusCode(ServletHttpAttributesGetter.java:72) at io.opentelemetry.javaagent.instrumentation.servlet.ServletHttpAttributesGetter.statusCode(ServletHttpAttributesGetter.java:12) at io.opentelemetry.javaagent.shaded.instrumentation.api.instrumenter.http.HttpCommonAttributesExtractor.onEnd(HttpCommonAttributesExtractor.java:65) at io.opentelemetry.javaagent.shaded.instrumentation.api.instrumenter.http.HttpServerAttributesExtractor.onEnd(HttpServerAttributesExtractor.java:132) at io.opentelemetry.javaagent.shaded.instrumentation.api.instrumenter.Instrumenter.doEnd(Instrumenter.java:224) at io.opentelemetry.javaagent.shaded.instrumentation.api.instrumenter.Instrumenter.end(Instrumenter.java:144) at io.opentelemetry.javaagent.instrumentation.servlet.AsyncRequestCompletionListener.onComplete(AsyncRequestCompletionListener.java:37) at io.opentelemetry.javaagent.instrumentation.servlet.v3_0.Servlet3Accessor$Listener.onComplete(Servlet3Accessor.java:82) at com.ibm.ws.webcontainer.async.AsyncListenerEntry.invokeOnComplete(AsyncListenerEntry.java:87) at com.ibm.ws.webcontainer.async.CompleteRunnable.invokeOnComplete(CompleteRunnable.java:94) at com.ibm.ws.webcontainer.async.CompleteRunnable.run(CompleteRunnable.java:57) at com.ibm.ws.webcontainer.async.ServiceWrapper.wrapAndRun(ServiceWrapper.java:236) at com.ibm.ws.webcontainer.async.ContextWrapper.run(ContextWrapper.java:28) at com.ibm.ws.threading.internal.ExecutorServiceImpl$RunnableWrapper.run(ExecutorServiceImpl.java:245) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:833) ]

This seems to be caused by an AsyncEvent without a response object (which seems to be the case on dropped connections at least in recent openliberty server releases)

The result is a missing span (and therefore a invalid parent span in the trace).

Servlet5Accessor seems to have the same problemn, too (although I didn't verify that)

What version are you using?
v1.19.2

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

Successfully merging a pull request may close this issue.

1 participant