spring-cloud/spring-cloud-sleuth

After @Async is included in rpc, traceId loss and confusion occur under a large number of requests.

zjypyj opened this issue · 4 comments

zjypyj commented

springcloud-sleuth version 2.2.8
When using @async to call remote services, when there are a large number of requests, the traceId may be lost or the traceIds of different threads may cross.There is a chance that he will appear.

code
image
image

Use jmeter to perform concurrent access to the interface, as shown below
result
The situations where loss occurs are as follows:
image

The situation where confusion occurs is as follows:
image

What are the reasons for this to happen?

This project is out of OSS support (https://spring.io/projects/spring-cloud-sleuth#support). Please check https://tanzu.vmware.com/spring-runtime to get commercial support.

zjypyj commented

Can you give me some troubleshooting ideas?

You would need to look into the TraceAsyncAspect I guess. I would start there + remember that the executor service that is used to schedule tasks most likely also is instrumented.

zjypyj commented

thanks