Spring Boot app cannot connect to Daemon in Docker container
- Dominant language
- Go
- Stars
- 193
- Forks
- 73
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 3
Description
I have instrumented a Spring Boot application with XRay. I run a Docker container with a proxy to XRay using the instructions on https://docs.aws.amazon.com/xray/latest/devguide/xray-daemon-local.html. But my application cannot connect to the XRay daemon in the docker container. The daemon in the docker container start up logs the following:
```
2022-02-01T10:51:23Z [Info] Initializing AWS X-Ray daemon 3.3.3
2022-02-01T10:51:23Z [Info] Using buffer memory limit of 19 MB
2022-02-01T10:51:23Z [Info] 304 segment buffers allocated
2022-02-01T10:51:23Z [Info] Using region: eu-central-1
2022-02-01T10:51:23Z [Info] HTTP Proxy server using X-Ray Endpoint : https://xray.eu-central-1.amazonaws.com
2022-02-01T10:51:23Z [Info] Starting proxy http server on 127.0.0.1:2000
```
My application tries to connect but fails with the following exception:
```
2022-02-01 11:52:59.150 ERROR 48013 --- [pool-2-thread-1] c.a.x.s.sampling.pollers.RulePoller : Encountered error polling GetSamplingRules:
com.amazonaws.xray.internal.XrayClientException: Could not serialize and send request.
at com.amazonaws.xray.internal.UnsignedXrayClient.sendRequest(UnsignedXrayClient.java:142)
at com.amazonaws.xray.internal.UnsignedXrayClient.getSamplingRules(UnsignedXrayClient.java:112)
at com.amazonaws.xray.strategy.sampling.pollers.RulePoller.pollRule(RulePoller.java:100)
at com.amazonaws.xray.strategy.sampling.pollers.RulePoller.lambda$start$0(RulePoller.java:72)
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 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:829)
Caused by: java.net.ConnectException: Connection refused (Connection refused)
```
When I run the xray daemon locally on my system everything works and traces are uploaded to AWS. Anyone an idea?
Contributor guide
Research direction
Start with the AWS X-Ray daemon Docker instructions linked in the issue and compare them with the Spring Boot application's connection settings. Investigate the daemon log showing the proxy bound to 127.0.0.1:2000 and the application's Connection refused error. Done means the application connects to the container and traces are uploaded to AWS.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, docker, java, spring-boot
- Domain
- backend, cloud, devops, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100