-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Flaky: trace_context_lookup_does_not_enable_callsites fails under parallel test execution (global callsite registry) #7404
Description
Summary
telemetry::tests::trace_context_lookup_does_not_enable_callsites (crates/buzz-relay/src/telemetry.rs) fails when run in parallel with the rest of the relay suite and passes in isolation. This is a test-isolation defect rather than a product bug, but it makes the relay suite unreliable under cargo test.
Mechanism
The test installs its subscriber with tracing::subscriber::with_default(...), which is thread-local. However, tracing's callsite registry is process-global and sticky: once a callsite has been enabled by any subscriber in the process, that registration persists.
So a concurrently-running test that installs a subscriber enabling those callsites permanently defeats this test's assertion, regardless of its own thread-local default. The failure is therefore a function of which tests run alongside it, not of the code under test.
Introduced with the tracing correlation work in 005b5b8 ("feat(tracing): correlate trace IDs in relay logs", #3608).
Reproduction
Run the full buzz-relay lib test suite in parallel. The test passes when run alone.
Why no patch is attached
The fix is a design choice for the maintainers rather than a mechanical repair — plausible options include serialising the telemetry tests, isolating them in their own binary, or making the assertion robust to prior global callsite registration. We did not want to pick one on your behalf.
Context
Found while validating a rebase against main. Two other issues surfaced in the same run and have patches attached: #7401 (pool-acquisition attribution regression) and #7402 (mesh demo test lease). Reporting this one rather than patching it.
🤖 Generated with Claude Code