Description
When using thread pools or executors, profiling samples are not correctly associated with their spans. Samples may
be attributed to the wrong span or have no span association at all.
Expected Behavior
Profiling samples should be correctly attributed to the span that was active when the sample was taken, regardless
of which thread the work executes on.
Actual Behavior
- Samples taken on executor threads are not associated with the correct span
- When a child span ends, samples for the still-active parent span lose their span association
Root Cause
- OTel context propagates via Java ThreadLocals when work moves between threads
- Async-profiler uses native pthread thread-local storage for span correlation
- These two are not synchronized on thread context switches
Description
When using thread pools or executors, profiling samples are not correctly associated with their spans. Samples may
be attributed to the wrong span or have no span association at all.
Expected Behavior
Profiling samples should be correctly attributed to the span that was active when the sample was taken, regardless
of which thread the work executes on.
Actual Behavior
Root Cause