Flaky: trace_context_lookup_does_not_enable_callsites fails under parallel test execution (global callsite registry)
- Dominant language
- Rust
- Stars
- 32.7k
- Forks
- 4.3k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 253
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 005b5b819a ("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](https://claude.com/claude-code)
Contributor guide
Assessment
This issue has not been assessed yet.