aws / aws-xray-java-agent

The official AWS X-Ray Auto Instrumentation Agent for Java.
Apache License 2.0
41 stars 18 forks source link

ECS Fargate Sidecar: X-Ray throws warnings at startup #62

Open cynicaljoy opened 4 years ago

cynicaljoy commented 4 years ago

I'm deploying my application as a container that's deployed to ECS Fargate w/X-Ray Daemon as a sidecar. All of the expected traces are showing up in X-Ray but my OCD is pained by the WARN logs that show up on startup 😂

At the startup of my application I get the following WARN logs:


java.net.ConnectException: Invalid argument (connect failed)
    at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
    at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
    at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
    at java.base/java.net.Socket.connect(Socket.java:609)
    at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:177)
    at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:474)
    at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:569)
    at java.base/sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
    at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:341)
    at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:362)
    at java.base/sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1253)
    at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1187)
    at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1081)
    at java.base/sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:1015)
    at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1592)
    at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1520)
    at java.base/java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:527)
    at com.amazonaws.xray.plugins.EC2MetadataFetcher.fetchString(EC2MetadataFetcher.java:159)
    at com.amazonaws.xray.plugins.EC2MetadataFetcher.fetchToken(EC2MetadataFetcher.java:123)
    at com.amazonaws.xray.plugins.EC2MetadataFetcher.fetch(EC2MetadataFetcher.java:72)
    at com.amazonaws.xray.plugins.EC2Plugin.<init>(EC2Plugin.java:72)
    at com.amazonaws.xray.plugins.EC2Plugin.<init>(EC2Plugin.java:67)
    at com.amazonaws.xray.AWSXRayRecorderBuilder.withDefaultPlugins(AWSXRayRecorderBuilder.java:216)
    at com.amazonaws.xray.agent.runtime.config.XRaySDKConfiguration.init(XRaySDKConfiguration.java:204)
    at com.amazonaws.xray.agent.runtime.config.XRaySDKConfiguration.init(XRaySDKConfiguration.java:158)
    at com.amazonaws.xray.agent.runtime.AgentRuntimeLoader.configureXRay(AgentRuntimeLoader.java:74)
    at com.amazonaws.xray.agent.runtime.AgentRuntimeLoader.init(AgentRuntimeLoader.java:53)
    at com.amazonaws.xray.agent.runtime.AgentRuntimeLoader.init(AgentRuntimeLoader.java:37)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at software.amazon.disco.agent.plugin.PluginDiscovery.apply(PluginDiscovery.java:172)
    at software.amazon.disco.agent.DiscoAgentTemplate.install(DiscoAgentTemplate.java:145)
    at software.amazon.disco.agent.DiscoAgentTemplate.install(DiscoAgentTemplate.java:107)
    at software.amazon.disco.agent.DiscoAgent.impl(DiscoAgent.java:91)
    at software.amazon.disco.agent.DiscoAgent.premain(DiscoAgent.java:52)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:513)
    at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:525)```
willarmiros commented 4 years ago

Hi @cynicaljoy, Glad to hear the agent is working well for you! Those logs look like they're from the EC2 plugin auto-detection. I'll lower those errors to debug level so they won't appear by default. Sorry for the inconvenience!