Skip to content

Profiling samples not correctly attributed to spans when using thread pools #44

Description

@dordor12

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

  1. OTel context propagates via Java ThreadLocals when work moves between threads
  2. Async-profiler uses native pthread thread-local storage for span correlation
  3. These two are not synchronized on thread context switches

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions