From e2cf69ed56e890fdad0cc59d137942b04773c58b Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Tue, 6 Oct 2026 00:34:15 +1300 Subject: [PATCH] Suppress the documented Crossbeam queue-buffer race in ThreadSanitizer. --- .github/tsan-suppressions.txt | 8 ++++++++ .github/workflows/test.yml | 1 + context/implementation.md | 9 +++++++++ 3 files changed, 18 insertions(+) create mode 100644 .github/tsan-suppressions.txt diff --git a/.github/tsan-suppressions.txt b/.github/tsan-suppressions.txt new file mode 100644 index 0000000..b6726b7 --- /dev/null +++ b/.github/tsan-suppressions.txt @@ -0,0 +1,8 @@ +# Crossbeam speculatively reads queue slots before atomically validating the +# steal. Reads invalidated by concurrent writes are discarded without using or +# dropping the task. The non-atomic volatile accesses still violate Rust's +# memory model; this suppression accepts that known dependency limitation. +# https://github.com/crossbeam-rs/crossbeam/issues/589#issuecomment-720972996 +# Match only the queue buffer accesses, rather than all Crossbeam operations. +race:crossbeam_deque::deque::Buffer*::read +race:crossbeam_deque::deque::Buffer*::write diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5ad6fa9..b02d9ac 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -123,3 +123,4 @@ jobs: run: cargo test -Zbuild-std --target x86_64-unknown-linux-gnu --workspace --all-targets --locked -- --skip queue_publication_cannot_leave_a_worker_asleep env: RUSTFLAGS: -Zsanitizer=${{ matrix.sanitizer }} + TSAN_OPTIONS: suppressions=${{ github.workspace }}/.github/tsan-suppressions.txt diff --git a/context/implementation.md b/context/implementation.md index 2b893a9..9d06058 100644 --- a/context/implementation.md +++ b/context/implementation.md @@ -104,3 +104,12 @@ and Tokio-only feature combinations. The same TCP/file consumers exercise both implementations; Linux tests cover cancellation batches and shutdown races. CI covers Linux, macOS, Windows and FreeBSD, with separate Linux io_uring and sanitizer jobs; distinguish configured CI from executed results. + +ThreadSanitizer loads `.github/tsan-suppressions.txt` to suppress Crossbeam's +internal queue `Buffer::read` and `Buffer::write` race reports. Crossbeam reads +slots speculatively and discards values when atomic validation fails. Its +non-atomic volatile accesses remain a known Rust memory-model limitation; +the suppression accepts that limitation rather than fixing it. See the +[upstream discussion](https://github.com/crossbeam-rs/crossbeam/issues/589#issuecomment-720972996). +Keep suppression patterns scoped to those buffer accesses and reassess them +when updating Crossbeam. Other race reports continue to fail the sanitizer job.