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

Null pointer exception on missing headers using RabbitMQ instrumentation #8020

Closed
mellis3000 opened this issue Mar 9, 2023 · 0 comments · Fixed by #8021
Closed

Null pointer exception on missing headers using RabbitMQ instrumentation #8020

mellis3000 opened this issue Mar 9, 2023 · 0 comments · Fixed by #8021
Labels
bug Something isn't working

Comments

@mellis3000
Copy link

Describe the bug
Similar to #4902, we are getting null pointers for what seems to be missing headers for the request, looking at the stack trace. In our case, the null pointer is thrown in RabbitDeliveryAttributesGetter.java instead of DeliveryRequestGetter.java as in the linked issue which was fixed by adding a null check https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/4903/files

Steps to reproduce
Consume a RabbitMQ event without headers

What did you expect to see?
Proceeding by ignoring missing headers instead of throwing java.lang.NullPointerException

What did you see instead?

Consumer io.opentelemetry.javaagent.instrumentation.rabbitmq.TracedDelegatingConsumer@2d2c535a (***) method handleDelivery for channel AMQChannel(amqp://*****@***.***.***.***:5672/,1) threw an exception for channel AMQChannel(amqp://*****@***.***.***.***:5672/,1)
java.lang.NullPointerException: null
        at io.opentelemetry.javaagent.instrumentation.rabbitmq.RabbitDeliveryAttributesGetter.header(RabbitDeliveryAttributesGetter.java:93)
        at io.opentelemetry.javaagent.instrumentation.rabbitmq.RabbitDeliveryAttributesGetter.header(RabbitDeliveryAttributesGetter.java:14)
        at io.opentelemetry.javaagent.shaded.instrumentation.api.instrumenter.messaging.MessagingAttributesExtractor.onEnd(MessagingAttributesExtractor.java:111)
        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.rabbitmq.TracedDelegatingConsumer.handleDelivery(TracedDelegatingConsumer.java:76)
        at com.rabbitmq.client.impl.ConsumerDispatcher$5.run(ConsumerDispatcher.java:149)
        at com.rabbitmq.client.impl.ConsumerWorkService$WorkPoolRunnable.run(ConsumerWorkService.java:104)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:834)

What version are you using?
v1.22.1

Environment
Compiler: AdoptOpenJDK OpenJDK 64-Bit Server VM 11.0.3+7
OS: Ubuntu 20.04

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