Closed vchernogorov closed 4 years ago
@vchernogorov Added this item to investigate, most likely it is a bug
Hi @vchernogorov! What java library are you using that is generating these http requests?
http://msd365fp-mr-dev-storage-westus.documents.azure.com/addresses/?$resolveFor=dbs&$filter=protocol eq rntbd
We instrument several http clients (Apache HttpClient, Okhttp, HttpURLConnection, Netty) and trying to understand which one is causing this issue, and how we can reproduce the issue.
@trask I'm following this issue as I saw the same in our logs. We use spring boot 2.2.6.RELEASE with the embedded tomcat which is the default.
The request to the external system is done with org.apache.http.client (used by the OKTA sdk library to execute so I had to dig a bit)
Thanks @jwyseu! Any chance you can pull out the particular code that is using Apache HttpClient in that case, so we can try to build a standalone repro?
Did a quick test if I could extract some code and I was able to reproduce it in a quite minimal way Using the dependency
I added the following code in a dummy spring RestController HttpClientBuilder httpClientBuilder = HttpClientBuilder.create(); CloseableHttpClient httpClient = httpClientBuilder.build();
HttpRequestBase httpRequest = new HttpGet("http://google.be/?q=test%20request");
HttpResponse httpResponse = httpClient.execute(httpRequest);
Which gives me the following log: 2020-09-24 08:15:26.989+02 ERROR c.m.a.agent.Exporter - Illegal character in query at index 24: http://google.be/?q=test request
Should I zip and send you the project sources?
Nice! If you can zip and attach your repro that would be great!
Just enabled the self-diagnostics, which gives a bit more logging:
2020-09-24 08:23:47.454+02 DEBUG c.m.a.agent.Exporter - exporting span: SpanWrapper{delegate=io.opentelemetry.sdk.trace.RecordEventsReadableSpan@70847e54, resolvedLinks=[], resolvedEvents=[], attributes={net.peer.name=AttributeValueString{stringValue=google.be}, http.status_code=AttributeValueLong{longValue=200}, http.url=AttributeValueString{stringValue=http://google.be/?q=test request}, http.method=AttributeValueString{stringValue=GET}}, totalAttributeCount=4, totalRecordedEvents=0, status=Status{canonicalCode=OK, description=null}}
2020-09-24 08:23:47.455+02 ERROR c.m.a.agent.Exporter - Illegal character in query at index 24: http://google.be/?q=test request
2020-09-24 08:23:47.455+02 DEBUG c.m.a.agent.Exporter - Illegal character in query at index 24: http://google.be/?q=test request
java.net.URISyntaxException: Illegal character in query at index 24: http://google.be/?q=test request
at java.net.URI$Parser.fail(URI.java:2848)
at java.net.URI$Parser.checkChars(URI.java:3021)
at java.net.URI$Parser.parseHierarchical(URI.java:3111)
at java.net.URI$Parser.parse(URI.java:3053)
at java.net.URI.
Sample code sample.zip You'll still need to add the azure agent jar as I removed that from the azure folder.
Thanks so much! we'll check it out tomorrow
This also happens for a pipe sign '|'.
Hi @spaykit, are you on Preview.7 already? What java library are you using that is generating these http requests?
We instrument several http clients (Apache HttpClient, Okhttp, HttpURLConnection, Netty) and need to understand which one is causing the issue, and also how we can reproduce the issue.
Hi @trask, sorry that I mislead you, I'm using codeless attach for java via Azure App Service.
I'm using 'quarkus-rest-client' which uses 'RESTEasy' which uses 'Apache HttpClient'.
[INFO] +- io.quarkus:quarkus-rest-client:jar:1.8.3.Final:compile [INFO] | +- io.quarkus:quarkus-resteasy-common:jar:1.8.3.Final:compile [INFO] | | +- org.jboss.resteasy:resteasy-core:jar:4.5.6.Final:compile [INFO] | | | +- org.jboss.spec.javax.ws.rs:jboss-jaxrs-api_2.1_spec:jar:2.0.1.Final:compile [INFO] | | | +- org.jboss.resteasy:resteasy-core-spi:jar:4.5.6.Final:compile [INFO] | | | - com.ibm.async:asyncutil:jar:0.1.0:compile [INFO] | | - com.sun.activation:jakarta.activation:jar:1.2.1:compile [INFO] | +- org.jboss.resteasy:resteasy-client-microprofile:jar:4.5.6.Final:compile [INFO] | | +- org.jboss.resteasy:resteasy-client:jar:4.5.6.Final:compile [INFO] | | | - org.jboss.resteasy:resteasy-client-api:jar:4.5.6.Final:compile [INFO] | | - org.eclipse.microprofile.rest.client:microprofile-rest-client-api:jar:1.4.1:compile [INFO] | +- jakarta.interceptor:jakarta.interceptor-api:jar:1.2.5:compile [INFO] | +- org.apache.httpcomponents:httpasyncclient:jar:4.1.4:compile [INFO] | | - org.apache.httpcomponents:httpcore-nio:jar:4.4.13:compile [INFO] | - org.jboss.logging:commons-logging-jboss-logging:jar:1.0.0.Final:compile
Log
2020-10-18T00:08:17.336987725Z 2020-10-18 00:08:17.336Z ERROR c.m.a.agent.Exporter - Illegal character in query at index 111: https://liquipedia.net/dota2/api.php?format=json&api_version=3&action=askargs&conditions=Has_teams::Team_Secret|Has_map_date::>2020-10-18T00:00:00Z&printouts=Has+teamid|Has+region|Has+name|Has+team+left|Has+team+right|Modification+date|Is+active|Has+map+date|Has+timezone|Has+game+count|Has+exact+time|Has+team+left+score|Has+team+right+score|Has+tournament|Has+tournament+name|Has+tournament+tier|Has+winner|Is+finished|Is+map+number|Has+city|Has+country|Has+date|Has+start+date|Has+end+date|Has+start+patch|Has+end+patch|Has+game|Match+length¶meters=|sort=Has_map_date|order=desc
No worries, that makes sense. I'm not sure rollout schedule for PREVIEW.7 on App Services, cc: @MS-jgol
@MS-jgol , is there any plan to release a fix for codeless attach?
@spaykit Application Insights Java 3.0 version will be in App Service some time during this Spring - this is largely due to release cycles. Meanwhile, you can use the standalone agent: https://docs.microsoft.com/en-us/azure/azure-monitor/app/java-in-process-agent
Expected behavior
I expect that telemetry for requests with spaces in the URL will be handled well.
Actual behavior
I see and ERROR in the agent's logs:
Illegal character in query at index 64: https://graph.microsoft.com/v1.0/servicePrincipals?$filter=appId eq '<UUID>'
. And I don't see the request in Azure Search dashboard.To Reproduce
Steps to reproduce the behavior:
java -javaagent:path/to/applicationinsights-agent-3.0.0-PREVIEW.5 -jar app.jar
command.tail -f /var/log/applicationinsights/applicationinsights.log
System information
Please provide the following information:
applicationinsights-agent-3.0.0-PREVIEW.5
macOS Catalina 10.15.5 (19F101)
org.apache.tomcat.emded:tomcat-embed-core:9.0.36
2.3.1-RELEASE
Logs