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 check missing in agent instrumentation code #506

Closed
debugthings opened this issue Dec 25, 2017 · 3 comments
Closed

NULL check missing in agent instrumentation code #506

debugthings opened this issue Dec 25, 2017 · 3 comments
Assignees
Labels
Milestone

Comments

@debugthings
Copy link
Contributor

When the agent attempts to view the existing correlation headers it does not perform a NULL check here.

This can throw an exception during the filter pipeline and lead to an internal server error.

It is recommended that we add a check similar to this one to avoid a nullref exception.

It was see recently on a struts application using thew new 2.0.0-BETA SDK and form based security with j_security_check.

@dhaval24 dhaval24 added the Bug label Dec 25, 2017
@dhaval24 dhaval24 added this to the 2.0.1 milestone Jan 8, 2018
@nicolehaugen
Copy link
Member

nicolehaugen commented Jan 18, 2018

I have also hit this issue. Here are the repro steps:

1.) Follow these steps to setup AI for dependencies: https://docs.microsoft.com/en-us/azure/application-insights/app-insights-java-agent

2.) Use the ToDo List sample app which is a Java SpringBoot app that uses the Azure Document DB library and App Insights library. Specifically, fork the code in the ai branch: https://github.com/Microsoft/todo-app-java-on-azure/tree/ai.

3.) Follow the ReadMe's steps to build and run the app (as shown here: https://github.com/Microsoft/todo-app-java-on-azure). When attempting to run the app, you'll get the following exception:

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.microsoft.azure.documentdb.DocumentClient]: Factory method 'documentClient' threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) ~[spring-beans-4.3.12.RELEASE.jar!/:4.3.12.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ~[spring-beans-4.3.12.RELEASE.jar!/:4.3.12.RELEASE]
... 88 common frames omitted
Caused by: java.lang.NullPointerException: null
at com.microsoft.applicationinsights.web.internal.correlation.TelemetryCorrelationUtils.retrieveCorrelationContext(TelemetryCorrelationUtils.java:140) ~[applicationinsights-web-2.0.0-BETA.jar!/:na

@grlima
Copy link
Contributor

grlima commented Feb 2, 2018

@nicolehaugen79 - is it possible you have not configured the necessary Beans to have the AppInsights filter properly configured. We were able to repro this issue when the filter was not properly configured in Spring Boot. See step 4 of this guide on how to configure AppInsights Filter in spring boot: https://github.com/AzureCAT-GSI/DevCamp/tree/master/HOL/java/06-appinsights

@grlima
Copy link
Contributor

grlima commented Feb 2, 2018

Closing issue as the fix has been merged. #541

@grlima grlima closed this as completed Feb 2, 2018
@ghost ghost locked as resolved and limited conversation to collaborators Jul 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants