aws / aws-xray-java-agent

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

X-Ray Errors #65

Closed cynicaljoy closed 2 years ago

cynicaljoy commented 3 years ago

I'm going to create an AWS Support case too but just sharing with the agent team as there might be something here 🤷

I'm betting this is something with the underlying X-Ray SDK/Service but calling it out in hopes that somebody can point me in a direction as to how to resolve the issue. We added the X-Ray Java Agent a few weeks ago and it's been running great. But the last 2 days we've seen the following error 11 times in our production account:

com.amazonaws.xray.internal.XrayClientException: Could not read response code.
    at com.amazonaws.xray.internal.UnsignedXrayClient.sendRequest(UnsignedXrayClient.java:149)
    at com.amazonaws.xray.internal.UnsignedXrayClient.getSamplingTargets(UnsignedXrayClient.java:116)
    at com.amazonaws.xray.strategy.sampling.pollers.TargetPoller.pollManifest(TargetPoller.java:101)
    at com.amazonaws.xray.strategy.sampling.pollers.TargetPoller.lambda$start$0(TargetPoller.java:67)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
    at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
    at software.amazon.disco.agent.concurrent.decorate.DecoratedRunnableScheduledFuture.run(DecoratedRunnableScheduledFuture.java:68)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at software.amazon.disco.agent.concurrent.decorate.DecoratedRunnable.run(DecoratedRunnable.java:60)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.net.SocketTimeoutException: Read timed out
    at java.base/java.net.SocketInputStream.socketRead0(Native Method)
    at java.base/java.net.SocketInputStream.socketRead(SocketInputStream.java:115)
    at java.base/java.net.SocketInputStream.read(SocketInputStream.java:168)
    at java.base/java.net.SocketInputStream.read(SocketInputStream.java:140)
    at java.base/java.io.BufferedInputStream.fill(BufferedInputStream.java:252)
    at java.base/java.io.BufferedInputStream.read1(BufferedInputStream.java:292)
    at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:351)
    at java.base/sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:754)
    at java.base/sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:689)
    at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1615)
    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.internal.UnsignedXrayClient.sendRequest(UnsignedXrayClient.java:147)
    ... 11 common frames omitted
wangzlei commented 3 years ago

Hi, XRay SDK periodically sends http requests to Xray for refreshing sampling rules and updating sampling related statistic, now the timeout out setting is 2 sec. So, when you got this exception it is not related to xray java agent but like a network problem.

Usually if just randomly getting this exception it is fine because the request will be retried in next 10 seconds, will finally refresh sampling config. This exception does not block the xray sdk functionality.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs in next 7 days. Thank you for your contributions.