You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add ThreadContext.invalidate() to flip record valid byte in place
When an SDK finishes a span, calling clearContext() on the current
async-context frame detaches the ThreadContext only from that frame.
Sibling and detached-continuation frames that already inherited the
reference keep holding the same JS object — and with it the same
underlying native record — so an out-of-process reader sampling those
threads still sees the finished span's trace / span IDs as active.
invalidate() writes 0 to the record's `valid` header byte in place,
using the same volatile+atomic_signal_fence protocol the constructor
and AppendAttributes() use for header bytes readers may race with.
Because every async-context frame holding this ThreadContext
reference observes the same shared record buffer, a single
invalidate() drops the record out of scope for every such frame at
once — readers see valid=0 and MUST ignore the record per OTEP-4947.
The method is idempotent, safe under repeated calls, and orthogonal
to attrs_data mutation: appendAttributes after invalidate is still
observable in the record bytes, but readers honor the valid=0 flag
regardless.
0 commit comments