Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ThreadSanitizer reports data race in AtomicCell::compare_exchange if it is not lock-free #644

Closed
taiki-e opened this issue Jan 5, 2021 · 7 comments · Fixed by #591
Closed

Comments

@taiki-e
Copy link
Member

taiki-e commented Jan 5, 2021

Run the following command:

RUSTFLAGS="-Z sanitizer=thread --cfg crossbeam_sanitize" \
cargo test -Z build-std --release --target x86_64-unknown-linux-gnu -p crossbeam-channel --test tick -- --test-threads=1

ThreadSanitizer reports data race:

output
     Running target/x86_64-unknown-linux-gnu/release/deps/tick-ad2808fb9d249901

running 12 tests
test capacity ... ok
test fairness ... ok
test fairness_duplicates ... ok
test fire ... ok
test intervals ... ok
test len_empty_full ... ok
test recv ... ok
test recv_race ... ok
==================
WARNING: ThreadSanitizer: data race (pid=28791)
  Write of size 8 at 0x7b0c000000d0 by thread T2:
    #0 crossbeam_utils::atomic::atomic_cell::AtomicCell<T>::compare_exchange :? (tick-ad2808fb9d249901+0xa35b3)
    #1 crossbeam_channel::flavors::tick::Channel::try_recv tick.1mqhsnvi-cgu.1:? (tick-ad2808fb9d249901+0x97d42)
    #2 <crossbeam_channel::channel::Receiver<T> as crossbeam_channel::select::SelectHandle>::try_select ??:? (tick-ad2808fb9d249901+0x95652)
    #3 crossbeam_channel::select::run_select ??:? (tick-ad2808fb9d249901+0x11030b)
    #4 core::ops::function::FnOnce::call_once{{vtable-shim}} tick.1mqhsnvi-cgu.6:? (tick-ad2808fb9d249901+0xa6446)
    #5 std::sys_common::backtrace::__rust_begin_short_backtrace :? (tick-ad2808fb9d249901+0x9ad97)
    #6 _ZN3std9panicking3try7do_call17hc5c870465619690dE.llvm.8341137377273167841 ??:? (tick-ad2808fb9d249901+0x9ca40)
    #7 __rust_try.llvm.8341137377273167841 :? (tick-ad2808fb9d249901+0x9d11c)
    #8 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0x9c638)
    #9 core::ops::function::FnOnce::call_once{{vtable-shim}} tick.1mqhsnvi-cgu.12:? (tick-ad2808fb9d249901+0x999a5)
    #10 <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once :? (tick-ad2808fb9d249901+0x12f93b)
    #11 std::sys::unix::thread::Thread::new::thread_start std.4y1imyn0-cgu.8:? (tick-ad2808fb9d249901+0x1562fc)

  Previous read of size 8 at 0x7b0c000000d0 by thread T1:
    #0 crossbeam_utils::atomic::atomic_cell::AtomicCell<T>::load :? (tick-ad2808fb9d249901+0xa3719)
    #1 <crossbeam_channel::channel::Receiver<T> as crossbeam_channel::select::SelectHandle>::register ??:? (tick-ad2808fb9d249901+0x96c8a)
    #2 crossbeam_channel::context::Context::with::{{closure}} crossbeam_channel.dnclaqj4-cgu.0:? (tick-ad2808fb9d249901+0x10f60b)
    #3 crossbeam_channel::select::run_select ??:? (tick-ad2808fb9d249901+0x1100f1)
    #4 core::ops::function::FnOnce::call_once{{vtable-shim}} tick.1mqhsnvi-cgu.6:? (tick-ad2808fb9d249901+0xa5d96)
    #5 std::sys_common::backtrace::__rust_begin_short_backtrace :? (tick-ad2808fb9d249901+0x9ad97)
    #6 _ZN3std9panicking3try7do_call17h5380285a5761ee30E.llvm.8341137377273167841 ??:? (tick-ad2808fb9d249901+0x9c7e0)
    #7 __rust_try.llvm.8341137377273167841 :? (tick-ad2808fb9d249901+0x9d11c)
    #8 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0x9c558)
    #9 core::ops::function::FnOnce::call_once{{vtable-shim}} tick.1mqhsnvi-cgu.12:? (tick-ad2808fb9d249901+0x99c85)
    #10 <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once :? (tick-ad2808fb9d249901+0x12f93b)
    #11 std::sys::unix::thread::Thread::new::thread_start std.4y1imyn0-cgu.8:? (tick-ad2808fb9d249901+0x1562fc)

  Location is heap block of size 48 at 0x7b0c000000c0 allocated by main thread:
    #0 malloc /rustc/llvm/src/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:652 (tick-ad2808fb9d249901+0x1f834)
    #1 __rdl_alloc :? (tick-ad2808fb9d249901+0x135f8c)
    #2 crossbeam_channel::channel::tick ??:? (tick-ad2808fb9d249901+0x111665)
    #3 core::ops::function::FnOnce::call_once tick.1mqhsnvi-cgu.0:? (tick-ad2808fb9d249901+0x94564)
    #4 test::__rust_begin_short_backtrace test.dt4s8qfr-cgu.14:? (tick-ad2808fb9d249901+0xb3d93)
    #5 core::ops::function::FnOnce::call_once{{vtable-shim}} test.dt4s8qfr-cgu.14:? (tick-ad2808fb9d249901+0xad7bd)
    #6 <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once :? (tick-ad2808fb9d249901+0xd2cf3)
    #7 _ZN3std9panicking3try7do_call17h4674e2ca3cde87d0E.llvm.15501654358489514047 ??:? (tick-ad2808fb9d249901+0xe50d0)
    #8 __rust_try.llvm.15501654358489514047 :? (tick-ad2808fb9d249901+0xe75dc)
    #9 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0xd3692)
    #10 test::run_test_in_process :? (tick-ad2808fb9d249901+0xb4009)
    #11 test::run_test_in_process :? (tick-ad2808fb9d249901+0xb4009)
    #12 test::run_test::run_test_inner test.dt4s8qfr-cgu.14:? (tick-ad2808fb9d249901+0xb3b78)
    #13 test::run_test ??:? (tick-ad2808fb9d249901+0xb31ce)
    #14 test::run_tests :? (tick-ad2808fb9d249901+0xb082c)
    #15 test::console::run_tests_console ??:? (tick-ad2808fb9d249901+0xc50ea)
    #16 test::test_main ??:? (tick-ad2808fb9d249901+0xaf51e)
    #17 test::test_main_static ??:? (tick-ad2808fb9d249901+0xaf74e)
    #18 tick::main tick.1mqhsnvi-cgu.0:? (tick-ad2808fb9d249901+0x953ec)
    #19 std::sys_common::backtrace::__rust_begin_short_backtrace :? (tick-ad2808fb9d249901+0x9ae13)
    #20 _ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17heb647d3d546ba7ffE.llvm.16568285768813341694 ??:? (tick-ad2808fb9d249901+0x986ed)
    #21 _ZN3std9panicking3try7do_call17hc16ff548790882f6E.llvm.10630154938325507013 :? (tick-ad2808fb9d249901+0x14ac85)
    #22 __rust_try.llvm.10630154938325507013 :? (tick-ad2808fb9d249901+0x14c5d5)
    #23 __rust_try.llvm.10630154938325507013 :? (tick-ad2808fb9d249901+0x14c5d5)
    #24 std::panicking::try :? (tick-ad2808fb9d249901+0x14ab40)
    #25 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0x13da55)
    #26 std::rt::lang_start_internal ??:? (tick-ad2808fb9d249901+0x14dd23)
    #27 main ??:? (tick-ad2808fb9d249901+0x95458)
    #28 __libc_start_main ??:? (libc.so.6+0x21bf6)
    #29 __libc_start_main ??:? (libc.so.6+0x21bf6)

  Thread T2 (tid=28797, running) created by main thread at:
    #0 pthread_create /rustc/llvm/src/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:966 (tick-ad2808fb9d249901+0x20deb)
    #1 std::sys::unix::thread::Thread::new ??:? (tick-ad2808fb9d249901+0x155f10)
    #2 std::thread::Builder::spawn :? (tick-ad2808fb9d249901+0x98e4b)
    #3 crossbeam_utils::thread::Scope::spawn :? (tick-ad2808fb9d249901+0xa40cc)
    #4 _ZN3std9panicking3try7do_call17h9bd19dcafdeee06fE.llvm.8341137377273167841 ??:? (tick-ad2808fb9d249901+0x9c9da)
    #5 __rust_try.llvm.8341137377273167841 :? (tick-ad2808fb9d249901+0x9d11c)
    #6 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0x9c719)
    #7 crossbeam_utils::thread::scope :? (tick-ad2808fb9d249901+0xa4c8a)
    #8 core::ops::function::FnOnce::call_once tick.1mqhsnvi-cgu.0:? (tick-ad2808fb9d249901+0x94599)
    #9 test::__rust_begin_short_backtrace test.dt4s8qfr-cgu.14:? (tick-ad2808fb9d249901+0xb3d93)
    #10 core::ops::function::FnOnce::call_once{{vtable-shim}} test.dt4s8qfr-cgu.14:? (tick-ad2808fb9d249901+0xad7bd)
    #11 <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once :? (tick-ad2808fb9d249901+0xd2cf3)
    #12 _ZN3std9panicking3try7do_call17h4674e2ca3cde87d0E.llvm.15501654358489514047 ??:? (tick-ad2808fb9d249901+0xe50d0)
    #13 __rust_try.llvm.15501654358489514047 :? (tick-ad2808fb9d249901+0xe75dc)
    #14 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0xd3692)
    #15 test::run_test_in_process :? (tick-ad2808fb9d249901+0xb4009)
    #16 test::run_test_in_process :? (tick-ad2808fb9d249901+0xb4009)
    #17 test::run_test::run_test_inner test.dt4s8qfr-cgu.14:? (tick-ad2808fb9d249901+0xb3b78)
    #18 test::run_test ??:? (tick-ad2808fb9d249901+0xb31ce)
    #19 test::run_tests :? (tick-ad2808fb9d249901+0xb082c)
    #20 test::console::run_tests_console ??:? (tick-ad2808fb9d249901+0xc50ea)
    #21 test::test_main ??:? (tick-ad2808fb9d249901+0xaf51e)
    #22 test::test_main_static ??:? (tick-ad2808fb9d249901+0xaf74e)
    #23 tick::main tick.1mqhsnvi-cgu.0:? (tick-ad2808fb9d249901+0x953ec)
    #24 std::sys_common::backtrace::__rust_begin_short_backtrace :? (tick-ad2808fb9d249901+0x9ae13)
    #25 _ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17heb647d3d546ba7ffE.llvm.16568285768813341694 ??:? (tick-ad2808fb9d249901+0x986ed)
    #26 _ZN3std9panicking3try7do_call17hc16ff548790882f6E.llvm.10630154938325507013 :? (tick-ad2808fb9d249901+0x14ac85)
    #27 __rust_try.llvm.10630154938325507013 :? (tick-ad2808fb9d249901+0x14c5d5)
    #28 __rust_try.llvm.10630154938325507013 :? (tick-ad2808fb9d249901+0x14c5d5)
    #29 std::panicking::try :? (tick-ad2808fb9d249901+0x14ab40)
    #30 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0x13da55)
    #31 std::rt::lang_start_internal ??:? (tick-ad2808fb9d249901+0x14dd23)
    #32 main ??:? (tick-ad2808fb9d249901+0x95458)
    #33 __libc_start_main ??:? (libc.so.6+0x21bf6)
    #34 __libc_start_main ??:? (libc.so.6+0x21bf6)

  Thread T1 (tid=28796, running) created by main thread at:
    #0 pthread_create /rustc/llvm/src/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:966 (tick-ad2808fb9d249901+0x20deb)
    #1 std::sys::unix::thread::Thread::new ??:? (tick-ad2808fb9d249901+0x155f10)
    #2 std::thread::Builder::spawn :? (tick-ad2808fb9d249901+0x9929b)
    #3 crossbeam_utils::thread::Scope::spawn :? (tick-ad2808fb9d249901+0xa471c)
    #4 _ZN3std9panicking3try7do_call17h9bd19dcafdeee06fE.llvm.8341137377273167841 ??:? (tick-ad2808fb9d249901+0x9c9bd)
    #5 __rust_try.llvm.8341137377273167841 :? (tick-ad2808fb9d249901+0x9d11c)
    #6 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0x9c719)
    #7 crossbeam_utils::thread::scope :? (tick-ad2808fb9d249901+0xa4c8a)
    #8 core::ops::function::FnOnce::call_once tick.1mqhsnvi-cgu.0:? (tick-ad2808fb9d249901+0x94599)
    #9 test::__rust_begin_short_backtrace test.dt4s8qfr-cgu.14:? (tick-ad2808fb9d249901+0xb3d93)
    #10 core::ops::function::FnOnce::call_once{{vtable-shim}} test.dt4s8qfr-cgu.14:? (tick-ad2808fb9d249901+0xad7bd)
    #11 <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once :? (tick-ad2808fb9d249901+0xd2cf3)
    #12 _ZN3std9panicking3try7do_call17h4674e2ca3cde87d0E.llvm.15501654358489514047 ??:? (tick-ad2808fb9d249901+0xe50d0)
    #13 __rust_try.llvm.15501654358489514047 :? (tick-ad2808fb9d249901+0xe75dc)
    #14 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0xd3692)
    #15 test::run_test_in_process :? (tick-ad2808fb9d249901+0xb4009)
    #16 test::run_test_in_process :? (tick-ad2808fb9d249901+0xb4009)
    #17 test::run_test::run_test_inner test.dt4s8qfr-cgu.14:? (tick-ad2808fb9d249901+0xb3b78)
    #18 test::run_test ??:? (tick-ad2808fb9d249901+0xb31ce)
    #19 test::run_tests :? (tick-ad2808fb9d249901+0xb082c)
    #20 test::console::run_tests_console ??:? (tick-ad2808fb9d249901+0xc50ea)
    #21 test::test_main ??:? (tick-ad2808fb9d249901+0xaf51e)
    #22 test::test_main_static ??:? (tick-ad2808fb9d249901+0xaf74e)
    #23 tick::main tick.1mqhsnvi-cgu.0:? (tick-ad2808fb9d249901+0x953ec)
    #24 std::sys_common::backtrace::__rust_begin_short_backtrace :? (tick-ad2808fb9d249901+0x9ae13)
    #25 _ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17heb647d3d546ba7ffE.llvm.16568285768813341694 ??:? (tick-ad2808fb9d249901+0x986ed)
    #26 _ZN3std9panicking3try7do_call17hc16ff548790882f6E.llvm.10630154938325507013 :? (tick-ad2808fb9d249901+0x14ac85)
    #27 __rust_try.llvm.10630154938325507013 :? (tick-ad2808fb9d249901+0x14c5d5)
    #28 __rust_try.llvm.10630154938325507013 :? (tick-ad2808fb9d249901+0x14c5d5)
    #29 std::panicking::try :? (tick-ad2808fb9d249901+0x14ab40)
    #30 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0x13da55)
    #31 std::rt::lang_start_internal ??:? (tick-ad2808fb9d249901+0x14dd23)
    #32 main ??:? (tick-ad2808fb9d249901+0x95458)
    #33 __libc_start_main ??:? (libc.so.6+0x21bf6)
    #34 __libc_start_main ??:? (libc.so.6+0x21bf6)

SUMMARY: ThreadSanitizer: data race :? in crossbeam_utils::atomic::atomic_cell::AtomicCell<T>::compare_exchange
==================
==================
WARNING: ThreadSanitizer: data race (pid=28791)
  Write of size 8 at 0x7b0c000000d8 by thread T2:
    #0 crossbeam_utils::atomic::atomic_cell::AtomicCell<T>::compare_exchange :? (tick-ad2808fb9d249901+0xa35c4)
    #1 crossbeam_channel::flavors::tick::Channel::try_recv tick.1mqhsnvi-cgu.1:? (tick-ad2808fb9d249901+0x97d42)
    #2 <crossbeam_channel::channel::Receiver<T> as crossbeam_channel::select::SelectHandle>::try_select ??:? (tick-ad2808fb9d249901+0x95652)
    #3 crossbeam_channel::select::run_select ??:? (tick-ad2808fb9d249901+0x11030b)
    #4 core::ops::function::FnOnce::call_once{{vtable-shim}} tick.1mqhsnvi-cgu.6:? (tick-ad2808fb9d249901+0xa6446)
    #5 std::sys_common::backtrace::__rust_begin_short_backtrace :? (tick-ad2808fb9d249901+0x9ad97)
    #6 _ZN3std9panicking3try7do_call17hc5c870465619690dE.llvm.8341137377273167841 ??:? (tick-ad2808fb9d249901+0x9ca40)
    #7 __rust_try.llvm.8341137377273167841 :? (tick-ad2808fb9d249901+0x9d11c)
    #8 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0x9c638)
    #9 core::ops::function::FnOnce::call_once{{vtable-shim}} tick.1mqhsnvi-cgu.12:? (tick-ad2808fb9d249901+0x999a5)
    #10 <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once :? (tick-ad2808fb9d249901+0x12f93b)
    #11 std::sys::unix::thread::Thread::new::thread_start std.4y1imyn0-cgu.8:? (tick-ad2808fb9d249901+0x1562fc)

  Previous read of size 8 at 0x7b0c000000d8 by thread T1:
    [failed to restore the stack]

  Location is heap block of size 48 at 0x7b0c000000c0 allocated by main thread:
    #0 malloc /rustc/llvm/src/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:652 (tick-ad2808fb9d249901+0x1f834)
    #1 __rdl_alloc :? (tick-ad2808fb9d249901+0x135f8c)
    #2 crossbeam_channel::channel::tick ??:? (tick-ad2808fb9d249901+0x111665)
    #3 core::ops::function::FnOnce::call_once tick.1mqhsnvi-cgu.0:? (tick-ad2808fb9d249901+0x94564)
    #4 test::__rust_begin_short_backtrace test.dt4s8qfr-cgu.14:? (tick-ad2808fb9d249901+0xb3d93)
    #5 core::ops::function::FnOnce::call_once{{vtable-shim}} test.dt4s8qfr-cgu.14:? (tick-ad2808fb9d249901+0xad7bd)
    #6 <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once :? (tick-ad2808fb9d249901+0xd2cf3)
    #7 _ZN3std9panicking3try7do_call17h4674e2ca3cde87d0E.llvm.15501654358489514047 ??:? (tick-ad2808fb9d249901+0xe50d0)
    #8 __rust_try.llvm.15501654358489514047 :? (tick-ad2808fb9d249901+0xe75dc)
    #9 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0xd3692)
    #10 test::run_test_in_process :? (tick-ad2808fb9d249901+0xb4009)
    #11 test::run_test_in_process :? (tick-ad2808fb9d249901+0xb4009)
    #12 test::run_test::run_test_inner test.dt4s8qfr-cgu.14:? (tick-ad2808fb9d249901+0xb3b78)
    #13 test::run_test ??:? (tick-ad2808fb9d249901+0xb31ce)
    #14 test::run_tests :? (tick-ad2808fb9d249901+0xb082c)
    #15 test::console::run_tests_console ??:? (tick-ad2808fb9d249901+0xc50ea)
    #16 test::test_main ??:? (tick-ad2808fb9d249901+0xaf51e)
    #17 test::test_main_static ??:? (tick-ad2808fb9d249901+0xaf74e)
    #18 tick::main tick.1mqhsnvi-cgu.0:? (tick-ad2808fb9d249901+0x953ec)
    #19 std::sys_common::backtrace::__rust_begin_short_backtrace :? (tick-ad2808fb9d249901+0x9ae13)
    #20 _ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17heb647d3d546ba7ffE.llvm.16568285768813341694 ??:? (tick-ad2808fb9d249901+0x986ed)
    #21 _ZN3std9panicking3try7do_call17hc16ff548790882f6E.llvm.10630154938325507013 :? (tick-ad2808fb9d249901+0x14ac85)
    #22 __rust_try.llvm.10630154938325507013 :? (tick-ad2808fb9d249901+0x14c5d5)
    #23 __rust_try.llvm.10630154938325507013 :? (tick-ad2808fb9d249901+0x14c5d5)
    #24 std::panicking::try :? (tick-ad2808fb9d249901+0x14ab40)
    #25 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0x13da55)
    #26 std::rt::lang_start_internal ??:? (tick-ad2808fb9d249901+0x14dd23)
    #27 main ??:? (tick-ad2808fb9d249901+0x95458)
    #28 __libc_start_main ??:? (libc.so.6+0x21bf6)
    #29 __libc_start_main ??:? (libc.so.6+0x21bf6)

  Thread T2 (tid=28797, running) created by main thread at:
    #0 pthread_create /rustc/llvm/src/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:966 (tick-ad2808fb9d249901+0x20deb)
    #1 std::sys::unix::thread::Thread::new ??:? (tick-ad2808fb9d249901+0x155f10)
    #2 std::thread::Builder::spawn :? (tick-ad2808fb9d249901+0x98e4b)
    #3 crossbeam_utils::thread::Scope::spawn :? (tick-ad2808fb9d249901+0xa40cc)
    #4 _ZN3std9panicking3try7do_call17h9bd19dcafdeee06fE.llvm.8341137377273167841 ??:? (tick-ad2808fb9d249901+0x9c9da)
    #5 __rust_try.llvm.8341137377273167841 :? (tick-ad2808fb9d249901+0x9d11c)
    #6 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0x9c719)
    #7 crossbeam_utils::thread::scope :? (tick-ad2808fb9d249901+0xa4c8a)
    #8 core::ops::function::FnOnce::call_once tick.1mqhsnvi-cgu.0:? (tick-ad2808fb9d249901+0x94599)
    #9 test::__rust_begin_short_backtrace test.dt4s8qfr-cgu.14:? (tick-ad2808fb9d249901+0xb3d93)
    #10 core::ops::function::FnOnce::call_once{{vtable-shim}} test.dt4s8qfr-cgu.14:? (tick-ad2808fb9d249901+0xad7bd)
    #11 <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once :? (tick-ad2808fb9d249901+0xd2cf3)
    #12 _ZN3std9panicking3try7do_call17h4674e2ca3cde87d0E.llvm.15501654358489514047 ??:? (tick-ad2808fb9d249901+0xe50d0)
    #13 __rust_try.llvm.15501654358489514047 :? (tick-ad2808fb9d249901+0xe75dc)
    #14 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0xd3692)
    #15 test::run_test_in_process :? (tick-ad2808fb9d249901+0xb4009)
    #16 test::run_test_in_process :? (tick-ad2808fb9d249901+0xb4009)
    #17 test::run_test::run_test_inner test.dt4s8qfr-cgu.14:? (tick-ad2808fb9d249901+0xb3b78)
    #18 test::run_test ??:? (tick-ad2808fb9d249901+0xb31ce)
    #19 test::run_tests :? (tick-ad2808fb9d249901+0xb082c)
    #20 test::console::run_tests_console ??:? (tick-ad2808fb9d249901+0xc50ea)
    #21 test::test_main ??:? (tick-ad2808fb9d249901+0xaf51e)
    #22 test::test_main_static ??:? (tick-ad2808fb9d249901+0xaf74e)
    #23 tick::main tick.1mqhsnvi-cgu.0:? (tick-ad2808fb9d249901+0x953ec)
    #24 std::sys_common::backtrace::__rust_begin_short_backtrace :? (tick-ad2808fb9d249901+0x9ae13)
    #25 _ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17heb647d3d546ba7ffE.llvm.16568285768813341694 ??:? (tick-ad2808fb9d249901+0x986ed)
    #26 _ZN3std9panicking3try7do_call17hc16ff548790882f6E.llvm.10630154938325507013 :? (tick-ad2808fb9d249901+0x14ac85)
    #27 __rust_try.llvm.10630154938325507013 :? (tick-ad2808fb9d249901+0x14c5d5)
    #28 __rust_try.llvm.10630154938325507013 :? (tick-ad2808fb9d249901+0x14c5d5)
    #29 std::panicking::try :? (tick-ad2808fb9d249901+0x14ab40)
    #30 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0x13da55)
    #31 std::rt::lang_start_internal ??:? (tick-ad2808fb9d249901+0x14dd23)
    #32 main ??:? (tick-ad2808fb9d249901+0x95458)
    #33 __libc_start_main ??:? (libc.so.6+0x21bf6)
    #34 __libc_start_main ??:? (libc.so.6+0x21bf6)

  Thread T1 (tid=28796, running) created by main thread at:
    #0 pthread_create /rustc/llvm/src/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:966 (tick-ad2808fb9d249901+0x20deb)
    #1 std::sys::unix::thread::Thread::new ??:? (tick-ad2808fb9d249901+0x155f10)
    #2 std::thread::Builder::spawn :? (tick-ad2808fb9d249901+0x9929b)
    #3 crossbeam_utils::thread::Scope::spawn :? (tick-ad2808fb9d249901+0xa471c)
    #4 _ZN3std9panicking3try7do_call17h9bd19dcafdeee06fE.llvm.8341137377273167841 ??:? (tick-ad2808fb9d249901+0x9c9bd)
    #5 __rust_try.llvm.8341137377273167841 :? (tick-ad2808fb9d249901+0x9d11c)
    #6 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0x9c719)
    #7 crossbeam_utils::thread::scope :? (tick-ad2808fb9d249901+0xa4c8a)
    #8 core::ops::function::FnOnce::call_once tick.1mqhsnvi-cgu.0:? (tick-ad2808fb9d249901+0x94599)
    #9 test::__rust_begin_short_backtrace test.dt4s8qfr-cgu.14:? (tick-ad2808fb9d249901+0xb3d93)
    #10 core::ops::function::FnOnce::call_once{{vtable-shim}} test.dt4s8qfr-cgu.14:? (tick-ad2808fb9d249901+0xad7bd)
    #11 <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once :? (tick-ad2808fb9d249901+0xd2cf3)
    #12 _ZN3std9panicking3try7do_call17h4674e2ca3cde87d0E.llvm.15501654358489514047 ??:? (tick-ad2808fb9d249901+0xe50d0)
    #13 __rust_try.llvm.15501654358489514047 :? (tick-ad2808fb9d249901+0xe75dc)
    #14 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0xd3692)
    #15 test::run_test_in_process :? (tick-ad2808fb9d249901+0xb4009)
    #16 test::run_test_in_process :? (tick-ad2808fb9d249901+0xb4009)
    #17 test::run_test::run_test_inner test.dt4s8qfr-cgu.14:? (tick-ad2808fb9d249901+0xb3b78)
    #18 test::run_test ??:? (tick-ad2808fb9d249901+0xb31ce)
    #19 test::run_tests :? (tick-ad2808fb9d249901+0xb082c)
    #20 test::console::run_tests_console ??:? (tick-ad2808fb9d249901+0xc50ea)
    #21 test::test_main ??:? (tick-ad2808fb9d249901+0xaf51e)
    #22 test::test_main_static ??:? (tick-ad2808fb9d249901+0xaf74e)
    #23 tick::main tick.1mqhsnvi-cgu.0:? (tick-ad2808fb9d249901+0x953ec)
    #24 std::sys_common::backtrace::__rust_begin_short_backtrace :? (tick-ad2808fb9d249901+0x9ae13)
    #25 _ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17heb647d3d546ba7ffE.llvm.16568285768813341694 ??:? (tick-ad2808fb9d249901+0x986ed)
    #26 _ZN3std9panicking3try7do_call17hc16ff548790882f6E.llvm.10630154938325507013 :? (tick-ad2808fb9d249901+0x14ac85)
    #27 __rust_try.llvm.10630154938325507013 :? (tick-ad2808fb9d249901+0x14c5d5)
    #28 __rust_try.llvm.10630154938325507013 :? (tick-ad2808fb9d249901+0x14c5d5)
    #29 std::panicking::try :? (tick-ad2808fb9d249901+0x14ab40)
    #30 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0x13da55)
    #31 std::rt::lang_start_internal ??:? (tick-ad2808fb9d249901+0x14dd23)
    #32 main ??:? (tick-ad2808fb9d249901+0x95458)
    #33 __libc_start_main ??:? (libc.so.6+0x21bf6)
    #34 __libc_start_main ??:? (libc.so.6+0x21bf6)

SUMMARY: ThreadSanitizer: data race :? in crossbeam_utils::atomic::atomic_cell::AtomicCell<T>::compare_exchange
==================
==================
WARNING: ThreadSanitizer: data race (pid=28791)
  Write of size 8 at 0x7b0c00000100 by thread T2:
    #0 crossbeam_utils::atomic::atomic_cell::AtomicCell<T>::compare_exchange :? (tick-ad2808fb9d249901+0xa35b3)
    #1 crossbeam_channel::flavors::tick::Channel::try_recv tick.1mqhsnvi-cgu.1:? (tick-ad2808fb9d249901+0x97d42)
    #2 <crossbeam_channel::channel::Receiver<T> as crossbeam_channel::select::SelectHandle>::try_select ??:? (tick-ad2808fb9d249901+0x95652)
    #3 crossbeam_channel::select::run_select ??:? (tick-ad2808fb9d249901+0x10ff3f)
    #4 core::ops::function::FnOnce::call_once{{vtable-shim}} tick.1mqhsnvi-cgu.6:? (tick-ad2808fb9d249901+0xa6446)
    #5 std::sys_common::backtrace::__rust_begin_short_backtrace :? (tick-ad2808fb9d249901+0x9ad97)
    #6 _ZN3std9panicking3try7do_call17hc5c870465619690dE.llvm.8341137377273167841 ??:? (tick-ad2808fb9d249901+0x9ca40)
    #7 __rust_try.llvm.8341137377273167841 :? (tick-ad2808fb9d249901+0x9d11c)
    #8 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0x9c638)
    #9 core::ops::function::FnOnce::call_once{{vtable-shim}} tick.1mqhsnvi-cgu.12:? (tick-ad2808fb9d249901+0x999a5)
    #10 <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once :? (tick-ad2808fb9d249901+0x12f93b)
    #11 std::sys::unix::thread::Thread::new::thread_start std.4y1imyn0-cgu.8:? (tick-ad2808fb9d249901+0x1562fc)

  Previous read of size 8 at 0x7b0c00000100 by thread T1:
    [failed to restore the stack]

  Location is heap block of size 48 at 0x7b0c000000f0 allocated by main thread:
    #0 malloc /rustc/llvm/src/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:652 (tick-ad2808fb9d249901+0x1f834)
    #1 __rdl_alloc :? (tick-ad2808fb9d249901+0x135f8c)
    #2 crossbeam_channel::channel::tick ??:? (tick-ad2808fb9d249901+0x111665)
    #3 core::ops::function::FnOnce::call_once tick.1mqhsnvi-cgu.0:? (tick-ad2808fb9d249901+0x94533)
    #4 test::__rust_begin_short_backtrace test.dt4s8qfr-cgu.14:? (tick-ad2808fb9d249901+0xb3d93)
    #5 core::ops::function::FnOnce::call_once{{vtable-shim}} test.dt4s8qfr-cgu.14:? (tick-ad2808fb9d249901+0xad7bd)
    #6 <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once :? (tick-ad2808fb9d249901+0xd2cf3)
    #7 _ZN3std9panicking3try7do_call17h4674e2ca3cde87d0E.llvm.15501654358489514047 ??:? (tick-ad2808fb9d249901+0xe50d0)
    #8 __rust_try.llvm.15501654358489514047 :? (tick-ad2808fb9d249901+0xe75dc)
    #9 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0xd3692)
    #10 test::run_test_in_process :? (tick-ad2808fb9d249901+0xb4009)
    #11 test::run_test_in_process :? (tick-ad2808fb9d249901+0xb4009)
    #12 test::run_test::run_test_inner test.dt4s8qfr-cgu.14:? (tick-ad2808fb9d249901+0xb3b78)
    #13 test::run_test ??:? (tick-ad2808fb9d249901+0xb31ce)
    #14 test::run_tests :? (tick-ad2808fb9d249901+0xb082c)
    #15 test::console::run_tests_console ??:? (tick-ad2808fb9d249901+0xc50ea)
    #16 test::test_main ??:? (tick-ad2808fb9d249901+0xaf51e)
    #17 test::test_main_static ??:? (tick-ad2808fb9d249901+0xaf74e)
    #18 tick::main tick.1mqhsnvi-cgu.0:? (tick-ad2808fb9d249901+0x953ec)
    #19 std::sys_common::backtrace::__rust_begin_short_backtrace :? (tick-ad2808fb9d249901+0x9ae13)
    #20 _ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17heb647d3d546ba7ffE.llvm.16568285768813341694 ??:? (tick-ad2808fb9d249901+0x986ed)
    #21 _ZN3std9panicking3try7do_call17hc16ff548790882f6E.llvm.10630154938325507013 :? (tick-ad2808fb9d249901+0x14ac85)
    #22 __rust_try.llvm.10630154938325507013 :? (tick-ad2808fb9d249901+0x14c5d5)
    #23 __rust_try.llvm.10630154938325507013 :? (tick-ad2808fb9d249901+0x14c5d5)
    #24 std::panicking::try :? (tick-ad2808fb9d249901+0x14ab40)
    #25 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0x13da55)
    #26 std::rt::lang_start_internal ??:? (tick-ad2808fb9d249901+0x14dd23)
    #27 main ??:? (tick-ad2808fb9d249901+0x95458)
    #28 __libc_start_main ??:? (libc.so.6+0x21bf6)
    #29 __libc_start_main ??:? (libc.so.6+0x21bf6)

  Thread T2 (tid=28797, running) created by main thread at:
    #0 pthread_create /rustc/llvm/src/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:966 (tick-ad2808fb9d249901+0x20deb)
    #1 std::sys::unix::thread::Thread::new ??:? (tick-ad2808fb9d249901+0x155f10)
    #2 std::thread::Builder::spawn :? (tick-ad2808fb9d249901+0x98e4b)
    #3 crossbeam_utils::thread::Scope::spawn :? (tick-ad2808fb9d249901+0xa40cc)
    #4 _ZN3std9panicking3try7do_call17h9bd19dcafdeee06fE.llvm.8341137377273167841 ??:? (tick-ad2808fb9d249901+0x9c9da)
    #5 __rust_try.llvm.8341137377273167841 :? (tick-ad2808fb9d249901+0x9d11c)
    #6 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0x9c719)
    #7 crossbeam_utils::thread::scope :? (tick-ad2808fb9d249901+0xa4c8a)
    #8 core::ops::function::FnOnce::call_once tick.1mqhsnvi-cgu.0:? (tick-ad2808fb9d249901+0x94599)
    #9 test::__rust_begin_short_backtrace test.dt4s8qfr-cgu.14:? (tick-ad2808fb9d249901+0xb3d93)
    #10 core::ops::function::FnOnce::call_once{{vtable-shim}} test.dt4s8qfr-cgu.14:? (tick-ad2808fb9d249901+0xad7bd)
    #11 <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once :? (tick-ad2808fb9d249901+0xd2cf3)
    #12 _ZN3std9panicking3try7do_call17h4674e2ca3cde87d0E.llvm.15501654358489514047 ??:? (tick-ad2808fb9d249901+0xe50d0)
    #13 __rust_try.llvm.15501654358489514047 :? (tick-ad2808fb9d249901+0xe75dc)
    #14 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0xd3692)
    #15 test::run_test_in_process :? (tick-ad2808fb9d249901+0xb4009)
    #16 test::run_test_in_process :? (tick-ad2808fb9d249901+0xb4009)
    #17 test::run_test::run_test_inner test.dt4s8qfr-cgu.14:? (tick-ad2808fb9d249901+0xb3b78)
    #18 test::run_test ??:? (tick-ad2808fb9d249901+0xb31ce)
    #19 test::run_tests :? (tick-ad2808fb9d249901+0xb082c)
    #20 test::console::run_tests_console ??:? (tick-ad2808fb9d249901+0xc50ea)
    #21 test::test_main ??:? (tick-ad2808fb9d249901+0xaf51e)
    #22 test::test_main_static ??:? (tick-ad2808fb9d249901+0xaf74e)
    #23 tick::main tick.1mqhsnvi-cgu.0:? (tick-ad2808fb9d249901+0x953ec)
    #24 std::sys_common::backtrace::__rust_begin_short_backtrace :? (tick-ad2808fb9d249901+0x9ae13)
    #25 _ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17heb647d3d546ba7ffE.llvm.16568285768813341694 ??:? (tick-ad2808fb9d249901+0x986ed)
    #26 _ZN3std9panicking3try7do_call17hc16ff548790882f6E.llvm.10630154938325507013 :? (tick-ad2808fb9d249901+0x14ac85)
    #27 __rust_try.llvm.10630154938325507013 :? (tick-ad2808fb9d249901+0x14c5d5)
    #28 __rust_try.llvm.10630154938325507013 :? (tick-ad2808fb9d249901+0x14c5d5)
    #29 std::panicking::try :? (tick-ad2808fb9d249901+0x14ab40)
    #30 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0x13da55)
    #31 std::rt::lang_start_internal ??:? (tick-ad2808fb9d249901+0x14dd23)
    #32 main ??:? (tick-ad2808fb9d249901+0x95458)
    #33 __libc_start_main ??:? (libc.so.6+0x21bf6)
    #34 __libc_start_main ??:? (libc.so.6+0x21bf6)

  Thread T1 (tid=28796, running) created by main thread at:
    #0 pthread_create /rustc/llvm/src/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:966 (tick-ad2808fb9d249901+0x20deb)
    #1 std::sys::unix::thread::Thread::new ??:? (tick-ad2808fb9d249901+0x155f10)
    #2 std::thread::Builder::spawn :? (tick-ad2808fb9d249901+0x9929b)
    #3 crossbeam_utils::thread::Scope::spawn :? (tick-ad2808fb9d249901+0xa471c)
    #4 _ZN3std9panicking3try7do_call17h9bd19dcafdeee06fE.llvm.8341137377273167841 ??:? (tick-ad2808fb9d249901+0x9c9bd)
    #5 __rust_try.llvm.8341137377273167841 :? (tick-ad2808fb9d249901+0x9d11c)
    #6 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0x9c719)
    #7 crossbeam_utils::thread::scope :? (tick-ad2808fb9d249901+0xa4c8a)
    #8 core::ops::function::FnOnce::call_once tick.1mqhsnvi-cgu.0:? (tick-ad2808fb9d249901+0x94599)
    #9 test::__rust_begin_short_backtrace test.dt4s8qfr-cgu.14:? (tick-ad2808fb9d249901+0xb3d93)
    #10 core::ops::function::FnOnce::call_once{{vtable-shim}} test.dt4s8qfr-cgu.14:? (tick-ad2808fb9d249901+0xad7bd)
    #11 <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once :? (tick-ad2808fb9d249901+0xd2cf3)
    #12 _ZN3std9panicking3try7do_call17h4674e2ca3cde87d0E.llvm.15501654358489514047 ??:? (tick-ad2808fb9d249901+0xe50d0)
    #13 __rust_try.llvm.15501654358489514047 :? (tick-ad2808fb9d249901+0xe75dc)
    #14 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0xd3692)
    #15 test::run_test_in_process :? (tick-ad2808fb9d249901+0xb4009)
    #16 test::run_test_in_process :? (tick-ad2808fb9d249901+0xb4009)
    #17 test::run_test::run_test_inner test.dt4s8qfr-cgu.14:? (tick-ad2808fb9d249901+0xb3b78)
    #18 test::run_test ??:? (tick-ad2808fb9d249901+0xb31ce)
    #19 test::run_tests :? (tick-ad2808fb9d249901+0xb082c)
    #20 test::console::run_tests_console ??:? (tick-ad2808fb9d249901+0xc50ea)
    #21 test::test_main ??:? (tick-ad2808fb9d249901+0xaf51e)
    #22 test::test_main_static ??:? (tick-ad2808fb9d249901+0xaf74e)
    #23 tick::main tick.1mqhsnvi-cgu.0:? (tick-ad2808fb9d249901+0x953ec)
    #24 std::sys_common::backtrace::__rust_begin_short_backtrace :? (tick-ad2808fb9d249901+0x9ae13)
    #25 _ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17heb647d3d546ba7ffE.llvm.16568285768813341694 ??:? (tick-ad2808fb9d249901+0x986ed)
    #26 _ZN3std9panicking3try7do_call17hc16ff548790882f6E.llvm.10630154938325507013 :? (tick-ad2808fb9d249901+0x14ac85)
    #27 __rust_try.llvm.10630154938325507013 :? (tick-ad2808fb9d249901+0x14c5d5)
    #28 __rust_try.llvm.10630154938325507013 :? (tick-ad2808fb9d249901+0x14c5d5)
    #29 std::panicking::try :? (tick-ad2808fb9d249901+0x14ab40)
    #30 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0x13da55)
    #31 std::rt::lang_start_internal ??:? (tick-ad2808fb9d249901+0x14dd23)
    #32 main ??:? (tick-ad2808fb9d249901+0x95458)
    #33 __libc_start_main ??:? (libc.so.6+0x21bf6)
    #34 __libc_start_main ??:? (libc.so.6+0x21bf6)

SUMMARY: ThreadSanitizer: data race :? in crossbeam_utils::atomic::atomic_cell::AtomicCell<T>::compare_exchange
==================
==================
WARNING: ThreadSanitizer: data race (pid=28791)
  Write of size 8 at 0x7b0c00000108 by thread T2:
    #0 crossbeam_utils::atomic::atomic_cell::AtomicCell<T>::compare_exchange :? (tick-ad2808fb9d249901+0xa35c4)
    #1 crossbeam_channel::flavors::tick::Channel::try_recv tick.1mqhsnvi-cgu.1:? (tick-ad2808fb9d249901+0x97d42)
    #2 <crossbeam_channel::channel::Receiver<T> as crossbeam_channel::select::SelectHandle>::try_select ??:? (tick-ad2808fb9d249901+0x95652)
    #3 crossbeam_channel::select::run_select ??:? (tick-ad2808fb9d249901+0x10ff3f)
    #4 core::ops::function::FnOnce::call_once{{vtable-shim}} tick.1mqhsnvi-cgu.6:? (tick-ad2808fb9d249901+0xa6446)
    #5 std::sys_common::backtrace::__rust_begin_short_backtrace :? (tick-ad2808fb9d249901+0x9ad97)
    #6 _ZN3std9panicking3try7do_call17hc5c870465619690dE.llvm.8341137377273167841 ??:? (tick-ad2808fb9d249901+0x9ca40)
    #7 __rust_try.llvm.8341137377273167841 :? (tick-ad2808fb9d249901+0x9d11c)
    #8 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0x9c638)
    #9 core::ops::function::FnOnce::call_once{{vtable-shim}} tick.1mqhsnvi-cgu.12:? (tick-ad2808fb9d249901+0x999a5)
    #10 <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once :? (tick-ad2808fb9d249901+0x12f93b)
    #11 std::sys::unix::thread::Thread::new::thread_start std.4y1imyn0-cgu.8:? (tick-ad2808fb9d249901+0x1562fc)

  Previous read of size 8 at 0x7b0c00000108 by thread T1:
    [failed to restore the stack]

  Location is heap block of size 48 at 0x7b0c000000f0 allocated by main thread:
    #0 malloc /rustc/llvm/src/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:652 (tick-ad2808fb9d249901+0x1f834)
    #1 __rdl_alloc :? (tick-ad2808fb9d249901+0x135f8c)
    #2 crossbeam_channel::channel::tick ??:? (tick-ad2808fb9d249901+0x111665)
    #3 core::ops::function::FnOnce::call_once tick.1mqhsnvi-cgu.0:? (tick-ad2808fb9d249901+0x94533)
    #4 test::__rust_begin_short_backtrace test.dt4s8qfr-cgu.14:? (tick-ad2808fb9d249901+0xb3d93)
    #5 core::ops::function::FnOnce::call_once{{vtable-shim}} test.dt4s8qfr-cgu.14:? (tick-ad2808fb9d249901+0xad7bd)
    #6 <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once :? (tick-ad2808fb9d249901+0xd2cf3)
    #7 _ZN3std9panicking3try7do_call17h4674e2ca3cde87d0E.llvm.15501654358489514047 ??:? (tick-ad2808fb9d249901+0xe50d0)
    #8 __rust_try.llvm.15501654358489514047 :? (tick-ad2808fb9d249901+0xe75dc)
    #9 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0xd3692)
    #10 test::run_test_in_process :? (tick-ad2808fb9d249901+0xb4009)
    #11 test::run_test_in_process :? (tick-ad2808fb9d249901+0xb4009)
    #12 test::run_test::run_test_inner test.dt4s8qfr-cgu.14:? (tick-ad2808fb9d249901+0xb3b78)
    #13 test::run_test ??:? (tick-ad2808fb9d249901+0xb31ce)
    #14 test::run_tests :? (tick-ad2808fb9d249901+0xb082c)
    #15 test::console::run_tests_console ??:? (tick-ad2808fb9d249901+0xc50ea)
    #16 test::test_main ??:? (tick-ad2808fb9d249901+0xaf51e)
    #17 test::test_main_static ??:? (tick-ad2808fb9d249901+0xaf74e)
    #18 tick::main tick.1mqhsnvi-cgu.0:? (tick-ad2808fb9d249901+0x953ec)
    #19 std::sys_common::backtrace::__rust_begin_short_backtrace :? (tick-ad2808fb9d249901+0x9ae13)
    #20 _ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17heb647d3d546ba7ffE.llvm.16568285768813341694 ??:? (tick-ad2808fb9d249901+0x986ed)
    #21 _ZN3std9panicking3try7do_call17hc16ff548790882f6E.llvm.10630154938325507013 :? (tick-ad2808fb9d249901+0x14ac85)
    #22 __rust_try.llvm.10630154938325507013 :? (tick-ad2808fb9d249901+0x14c5d5)
    #23 __rust_try.llvm.10630154938325507013 :? (tick-ad2808fb9d249901+0x14c5d5)
    #24 std::panicking::try :? (tick-ad2808fb9d249901+0x14ab40)
    #25 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0x13da55)
    #26 std::rt::lang_start_internal ??:? (tick-ad2808fb9d249901+0x14dd23)
    #27 main ??:? (tick-ad2808fb9d249901+0x95458)
    #28 __libc_start_main ??:? (libc.so.6+0x21bf6)
    #29 __libc_start_main ??:? (libc.so.6+0x21bf6)

  Thread T2 (tid=28797, running) created by main thread at:
    #0 pthread_create /rustc/llvm/src/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:966 (tick-ad2808fb9d249901+0x20deb)
    #1 std::sys::unix::thread::Thread::new ??:? (tick-ad2808fb9d249901+0x155f10)
    #2 std::thread::Builder::spawn :? (tick-ad2808fb9d249901+0x98e4b)
    #3 crossbeam_utils::thread::Scope::spawn :? (tick-ad2808fb9d249901+0xa40cc)
    #4 _ZN3std9panicking3try7do_call17h9bd19dcafdeee06fE.llvm.8341137377273167841 ??:? (tick-ad2808fb9d249901+0x9c9da)
    #5 __rust_try.llvm.8341137377273167841 :? (tick-ad2808fb9d249901+0x9d11c)
    #6 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0x9c719)
    #7 crossbeam_utils::thread::scope :? (tick-ad2808fb9d249901+0xa4c8a)
    #8 core::ops::function::FnOnce::call_once tick.1mqhsnvi-cgu.0:? (tick-ad2808fb9d249901+0x94599)
    #9 test::__rust_begin_short_backtrace test.dt4s8qfr-cgu.14:? (tick-ad2808fb9d249901+0xb3d93)
    #10 core::ops::function::FnOnce::call_once{{vtable-shim}} test.dt4s8qfr-cgu.14:? (tick-ad2808fb9d249901+0xad7bd)
    #11 <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once :? (tick-ad2808fb9d249901+0xd2cf3)
    #12 _ZN3std9panicking3try7do_call17h4674e2ca3cde87d0E.llvm.15501654358489514047 ??:? (tick-ad2808fb9d249901+0xe50d0)
    #13 __rust_try.llvm.15501654358489514047 :? (tick-ad2808fb9d249901+0xe75dc)
    #14 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0xd3692)
    #15 test::run_test_in_process :? (tick-ad2808fb9d249901+0xb4009)
    #16 test::run_test_in_process :? (tick-ad2808fb9d249901+0xb4009)
    #17 test::run_test::run_test_inner test.dt4s8qfr-cgu.14:? (tick-ad2808fb9d249901+0xb3b78)
    #18 test::run_test ??:? (tick-ad2808fb9d249901+0xb31ce)
    #19 test::run_tests :? (tick-ad2808fb9d249901+0xb082c)
    #20 test::console::run_tests_console ??:? (tick-ad2808fb9d249901+0xc50ea)
    #21 test::test_main ??:? (tick-ad2808fb9d249901+0xaf51e)
    #22 test::test_main_static ??:? (tick-ad2808fb9d249901+0xaf74e)
    #23 tick::main tick.1mqhsnvi-cgu.0:? (tick-ad2808fb9d249901+0x953ec)
    #24 std::sys_common::backtrace::__rust_begin_short_backtrace :? (tick-ad2808fb9d249901+0x9ae13)
    #25 _ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17heb647d3d546ba7ffE.llvm.16568285768813341694 ??:? (tick-ad2808fb9d249901+0x986ed)
    #26 _ZN3std9panicking3try7do_call17hc16ff548790882f6E.llvm.10630154938325507013 :? (tick-ad2808fb9d249901+0x14ac85)
    #27 __rust_try.llvm.10630154938325507013 :? (tick-ad2808fb9d249901+0x14c5d5)
    #28 __rust_try.llvm.10630154938325507013 :? (tick-ad2808fb9d249901+0x14c5d5)
    #29 std::panicking::try :? (tick-ad2808fb9d249901+0x14ab40)
    #30 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0x13da55)
    #31 std::rt::lang_start_internal ??:? (tick-ad2808fb9d249901+0x14dd23)
    #32 main ??:? (tick-ad2808fb9d249901+0x95458)
    #33 __libc_start_main ??:? (libc.so.6+0x21bf6)
    #34 __libc_start_main ??:? (libc.so.6+0x21bf6)

  Thread T1 (tid=28796, running) created by main thread at:
    #0 pthread_create /rustc/llvm/src/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:966 (tick-ad2808fb9d249901+0x20deb)
    #1 std::sys::unix::thread::Thread::new ??:? (tick-ad2808fb9d249901+0x155f10)
    #2 std::thread::Builder::spawn :? (tick-ad2808fb9d249901+0x9929b)
    #3 crossbeam_utils::thread::Scope::spawn :? (tick-ad2808fb9d249901+0xa471c)
    #4 _ZN3std9panicking3try7do_call17h9bd19dcafdeee06fE.llvm.8341137377273167841 ??:? (tick-ad2808fb9d249901+0x9c9bd)
    #5 __rust_try.llvm.8341137377273167841 :? (tick-ad2808fb9d249901+0x9d11c)
    #6 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0x9c719)
    #7 crossbeam_utils::thread::scope :? (tick-ad2808fb9d249901+0xa4c8a)
    #8 core::ops::function::FnOnce::call_once tick.1mqhsnvi-cgu.0:? (tick-ad2808fb9d249901+0x94599)
    #9 test::__rust_begin_short_backtrace test.dt4s8qfr-cgu.14:? (tick-ad2808fb9d249901+0xb3d93)
    #10 core::ops::function::FnOnce::call_once{{vtable-shim}} test.dt4s8qfr-cgu.14:? (tick-ad2808fb9d249901+0xad7bd)
    #11 <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once :? (tick-ad2808fb9d249901+0xd2cf3)
    #12 _ZN3std9panicking3try7do_call17h4674e2ca3cde87d0E.llvm.15501654358489514047 ??:? (tick-ad2808fb9d249901+0xe50d0)
    #13 __rust_try.llvm.15501654358489514047 :? (tick-ad2808fb9d249901+0xe75dc)
    #14 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0xd3692)
    #15 test::run_test_in_process :? (tick-ad2808fb9d249901+0xb4009)
    #16 test::run_test_in_process :? (tick-ad2808fb9d249901+0xb4009)
    #17 test::run_test::run_test_inner test.dt4s8qfr-cgu.14:? (tick-ad2808fb9d249901+0xb3b78)
    #18 test::run_test ??:? (tick-ad2808fb9d249901+0xb31ce)
    #19 test::run_tests :? (tick-ad2808fb9d249901+0xb082c)
    #20 test::console::run_tests_console ??:? (tick-ad2808fb9d249901+0xc50ea)
    #21 test::test_main ??:? (tick-ad2808fb9d249901+0xaf51e)
    #22 test::test_main_static ??:? (tick-ad2808fb9d249901+0xaf74e)
    #23 tick::main tick.1mqhsnvi-cgu.0:? (tick-ad2808fb9d249901+0x953ec)
    #24 std::sys_common::backtrace::__rust_begin_short_backtrace :? (tick-ad2808fb9d249901+0x9ae13)
    #25 _ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17heb647d3d546ba7ffE.llvm.16568285768813341694 ??:? (tick-ad2808fb9d249901+0x986ed)
    #26 _ZN3std9panicking3try7do_call17hc16ff548790882f6E.llvm.10630154938325507013 :? (tick-ad2808fb9d249901+0x14ac85)
    #27 __rust_try.llvm.10630154938325507013 :? (tick-ad2808fb9d249901+0x14c5d5)
    #28 __rust_try.llvm.10630154938325507013 :? (tick-ad2808fb9d249901+0x14c5d5)
    #29 std::panicking::try :? (tick-ad2808fb9d249901+0x14ab40)
    #30 std::panic::catch_unwind :? (tick-ad2808fb9d249901+0x13da55)
    #31 std::rt::lang_start_internal ??:? (tick-ad2808fb9d249901+0x14dd23)
    #32 main ??:? (tick-ad2808fb9d249901+0x95458)
    #33 __libc_start_main ??:? (libc.so.6+0x21bf6)
    #34 __libc_start_main ??:? (libc.so.6+0x21bf6)

SUMMARY: ThreadSanitizer: data race :? in crossbeam_utils::atomic::atomic_cell::AtomicCell<T>::compare_exchange
==================
test recv_two ... ok
test select ... ok
test stress_default ... ok
test try_recv ... ok

test result: ok. 12 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 4.54s
ThreadSanitizer: reported 4 warnings

error: test failed, to rerun pass '-p crossbeam-channel --test tick'

Found in #591 (https://github.com/crossbeam-rs/crossbeam/runs/1647950214?check_suite_focus=true)

@taiki-e
Copy link
Member Author

taiki-e commented Jan 5, 2021

Seems this only happens if AtomicCell is not lock-free.

The AtomicCell<Instant> used inside tick is not lock-free on Linux.

/// The instant at which the next message will be delivered.
delivery_time: AtomicCell<Instant>,

However, AtomicCell<Instant> is lock-free on macOS, and data race does not reported when running ThreadSanitizer on macOS.

RUSTFLAGS="-Z sanitizer=thread --cfg crossbeam_sanitize" \
cargo test -Z build-std --release --target x86_64-apple-darwin -p crossbeam-channel --test tick -- --test-threads=1

@taiki-e taiki-e changed the title ThreadSanitizer reports data race in AtomicCell::compare_exchange ThreadSanitizer reports data race in AtomicCell::compare_exchange if it is not lock-free Jan 5, 2021
@tomtomjhj
Copy link
Contributor

Non-lock-free AtomicCell uses SeqLock which uses Release/Acquire fence, which tsan doesn't understand.

@taiki-e
Copy link
Member Author

taiki-e commented Jan 5, 2021

That's true. ...So I think we can close this.

@jeehoonkang
Copy link
Contributor

@tomtomjhj do you happen to have enhanced tsan to support those fences?

@tomtomjhj
Copy link
Contributor

@jeehoonkang I guess you're talking about loom. I'll send a PR to loom later and cc you. BTW it's about a simple implementation of Release/SeqCst fence, the correctness of which is unclear yet.

@cynecx
Copy link
Contributor

cynecx commented Jan 5, 2021

BTW it's about a simple implementation of Release/SeqCst fence, the correctness of which is unclear yet.

JFYI: loom did have SeqCst fences support (you can still go back and search for the old implementation), however that part was removed because it was broken iirc.

@tomtomjhj
Copy link
Contributor

@cynecx Loom had SeqCst accesses, but not fences. That implementation is indeed incorrect. However, in some alternative memory model for C/C++ without SeqCst accesses (= all SeqCst operations are fence(SeqCst)) , that implementation seems to be correct. So my plan was to suggest dropping the support for SeqCst accesses (panic on SeqCst accesses) and support fence(SeqCst) instead. I think this is ok because algorithms using SeqCst accesses (probably) can be ported to use SeqCst fences only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

4 participants