Skip to content

Instantly share code, notes, and snippets.

@saghm
Created March 20, 2020 21:07
Show Gist options
  • Save saghm/55f47b64c52510c3399fe671f1b8d09a to your computer and use it in GitHub Desktop.
Save saghm/55f47b64c52510c3399fe671f1b8d09a to your computer and use it in GitHub Desktop.
WARNING: ThreadSanitizer: data race (pid=94179)
Write of size 8 at 0x7b0800000060 by main thread:
#0 free /rustc/llvm/src/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:706:3 (rust-scratch+0x11d58)
#1 alloc::alloc::dealloc::h99b6371ef57874e8 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/liballoc/alloc.rs:103:5 (rust-scratch+0x94188)
#2 _$LT$alloc..alloc..Global$u20$as$u20$core..alloc..AllocRef$GT$::dealloc::he32cdae226ac0a18 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/liballoc/alloc.rs:179:13 (rust-scratch+0x95105)
#3 alloc::sync::Arc$LT$T$GT$::drop_slow::hea1049624e02cfe9 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/liballoc/sync.rs:743:13 (rust-scratch+0x9916d)
#4 _$LT$alloc..sync..Arc$LT$T$GT$$u20$as$u20$core..ops..drop..Drop$GT$::drop::h26b5cd67741187fa /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/liballoc/sync.rs:1249:13 (rust-scratch+0x9974e)
#5 core::ptr::drop_in_place::h2b3ee6f7ae695029 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libcore/ptr/mod.rs:177:1 (rust-scratch+0x8cefb)
#6 tokio::runtime::shell::drop_waker::hb212024b6564381a /home/saghm/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/runtime/shell.rs:82:59 (rust-scratch+0x93537)
#7 _$LT$core..task..wake..Waker$u20$as$u20$core..ops..drop..Drop$GT$::drop::h5ca67639453ff63d /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libcore/task/wake.rs:307:18 (rust-scratch+0x902ff)
#8 core::ptr::drop_in_place::hfd305e6723876811 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libcore/ptr/mod.rs:177:1 (rust-scratch+0x8e617)
#9 core::ptr::drop_in_place::heeee9aa9cf2ba521 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libcore/ptr/mod.rs:177:1 (rust-scratch+0x8e3d0)
#10 core::ptr::drop_in_place::h6ba5c6389290ced2 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libcore/ptr/mod.rs:177:1 (rust-scratch+0x8daab)
#11 core::ptr::drop_in_place::h35682a91ed2a342a /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libcore/ptr/mod.rs:177:1 (rust-scratch+0x8d01b)
#12 rust_scratch::main::hdbc89cc6309c8f66 /home/saghm/code/rust-scratch/src/main.rs:7:14 (rust-scratch+0x8a530)
#13 std::rt::lang_start::_$u7b$$u7b$closure$u7d$$u7d$::h34904544d1260f39 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/rt.rs:67:34 (rust-scratch+0x8a111)
#14 std::rt::lang_start_internal::_$u7b$$u7b$closure$u7d$$u7d$::he55e3739ea41259e /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/rt.rs:52:13 (rust-scratch+0xed0be)
#15 std::panicking::try::do_call::h73e24f9817ae57df /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/panicking.rs:331:40 (rust-scratch+0xed0be)
#16 std::panicking::try::hd08eb281999526b6 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/panicking.rs:274:15 (rust-scratch+0xed0be)
#17 std::panic::catch_unwind::hc981e5be87497715 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/panic.rs:394:14 (rust-scratch+0xed0be)
#18 std::rt::lang_start_internal::h0962c0aa989e5c64 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/rt.rs:51:25 (rust-scratch+0xed0be)
#19 main <null> (rust-scratch+0x8a5ca)
Previous atomic write of size 8 at 0x7b0800000060 by thread T1:
#0 __tsan_atomic64_fetch_sub /rustc/llvm/src/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interface_atomic.cc:647:3 (rust-scratch+0x55941)
#1 core::sync::atomic::atomic_sub::he92b818fb8931e77 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libcore/sync/atomic.rs:2314:20 (rust-scratch+0xae809)
#2 core::sync::atomic::AtomicUsize::fetch_sub::h65db5bf91fb2bb0d /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libcore/sync/atomic.rs:1654:30 (rust-scratch+0xa4419)
#3 _$LT$alloc..sync..Arc$LT$T$GT$$u20$as$u20$core..ops..drop..Drop$GT$::drop::h26b5cd67741187fa /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/liballoc/sync.rs:1214:12 (rust-scratch+0x9970d)
#4 core::ptr::drop_in_place::h2b3ee6f7ae695029 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libcore/ptr/mod.rs:177:1 (rust-scratch+0x8cefb)
#5 tokio::runtime::shell::drop_waker::hb212024b6564381a /home/saghm/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/runtime/shell.rs:82:59 (rust-scratch+0x93537)
#6 _$LT$core..task..wake..Waker$u20$as$u20$core..ops..drop..Drop$GT$::drop::h77928d6cd976a202 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libcore/task/wake.rs:307:18 (rust-scratch+0xcc75f)
#7 core::ptr::drop_in_place::h6b2efb7e38be8a46 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libcore/ptr/mod.rs:177:1 (rust-scratch+0xc9097)
#8 core::ptr::drop_in_place::h7800e37ba22c6948 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libcore/ptr/mod.rs:177:1 (rust-scratch+0xc9302)
#9 core::ptr::drop_in_place::h7260aff750e3396d /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libcore/ptr/mod.rs:177:1 (rust-scratch+0xc91ab)
#10 core::ptr::drop_in_place::h015f40de88bb9302 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libcore/ptr/mod.rs:177:1 (rust-scratch+0xc827f)
#11 core::ptr::drop_in_place::h8d390388066958bd /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libcore/ptr/mod.rs:177:1 (rust-scratch+0xc95eb)
#12 core::ptr::drop_in_place::h89fcc77c83fbb597 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libcore/ptr/mod.rs:177:1 (rust-scratch+0xc952f)
#13 alloc::sync::Arc$LT$T$GT$::drop_slow::h7f197188a718ed4e /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/liballoc/sync.rs:739:9 (rust-scratch+0xd9729)
#14 _$LT$alloc..sync..Arc$LT$T$GT$$u20$as$u20$core..ops..drop..Drop$GT$::drop::h4e6c0f0bb4eda99e /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/liballoc/sync.rs:1249:13 (rust-scratch+0xda84e)
#15 core::ptr::drop_in_place::h4cbde1772138cbdd /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libcore/ptr/mod.rs:177:1 (rust-scratch+0xc8c2b)
#16 futures_timer::native::timer::Timer::remove::h6e73f73a12f0ec99 /home/saghm/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-timer-3.0.2/src/native/timer.rs:163:5 (rust-scratch+0xb69f4)
#17 _$LT$futures_timer..native..timer..Timer$u20$as$u20$core..future..future..Future$GT$::poll::h54f5085abc08d1a1 /home/saghm/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-timer-3.0.2/src/native/timer.rs:181:25 (rust-scratch+0xb702c)
#18 futures_timer::native::global::run::h07df39a7dae9b9c6 /home/saghm/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-timer-3.0.2/src/native/global.rs:63:17 (rust-scratch+0xb976e)
#19 futures_timer::native::global::HelperThread::new::_$u7b$$u7b$closure$u7d$$u7d$::h05f8c2b07ec730a2 /home/saghm/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-timer-3.0.2/src/native/global.rs:28:28 (rust-scratch+0xb921a)
#20 std::sys_common::backtrace::__rust_begin_short_backtrace::h8e8591708c46fd21 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/sys_common/backtrace.rs:130:5 (rust-scratch+0xc7be0)
#21 std::thread::Builder::spawn_unchecked::_$u7b$$u7b$closure$u7d$$u7d$::_$u7b$$u7b$closure$u7d$$u7d$::h22c8640f8bfe876a /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/thread/mod.rs:475:17 (rust-scratch+0xc5644)
#22 _$LT$std..panic..AssertUnwindSafe$LT$F$GT$$u20$as$u20$core..ops..function..FnOnce$LT$$LP$$RP$$GT$$GT$::call_once::h0b374bde16c5afce /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/panic.rs:318:9 (rust-scratch+0xc4594)
#23 std::panicking::try::do_call::h282dedbf2ea85d21 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/panicking.rs:331:40 (rust-scratch+0xb7e89)
#24 __rust_try <null> (rust-scratch+0xb9d4b)
#25 std::panicking::try::ha694bcbe7ad10ea7 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/panicking.rs:274:15 (rust-scratch+0xb7d49)
#26 std::panic::catch_unwind::h7dc96eede4c63726 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/panic.rs:394:14 (rust-scratch+0xc486a)
#27 std::thread::Builder::spawn_unchecked::_$u7b$$u7b$closure$u7d$$u7d$::ha687518591e07ecb /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/thread/mod.rs:474:30 (rust-scratch+0xc53e6)
#28 core::ops::function::FnOnce::call_once$u7b$$u7b$vtable.shim$u7d$$u7d$::h20b67eba1411c2a3 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libcore/ops/function.rs:232:5 (rust-scratch+0xc815b)
#29 _$LT$alloc..boxed..Box$LT$F$GT$$u20$as$u20$core..ops..function..FnOnce$LT$A$GT$$GT$::call_once::h1196c8e359cc899e /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/liballoc/boxed.rs:1017:9 (rust-scratch+0xe461e)
Thread T1 'futures-timer' (tid=94215, running) created by main thread at:
#0 pthread_create /rustc/llvm/src/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:967:3 (rust-scratch+0x12cab)
#1 std::sys::unix::thread::Thread::new::h4eb7bc22d6ade13e /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/sys/unix/thread.rs:68:19 (rust-scratch+0xee07d)
#2 std::thread::Builder::spawn::hcb0ec171a5d788f8 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/thread/mod.rs:386:18 (rust-scratch+0xc56fa)
#3 futures_timer::native::global::HelperThread::new::h8e6a7c792debb5cf /home/saghm/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-timer-3.0.2/src/native/global.rs:26:22 (rust-scratch+0xb8e1c)
#4 _$LT$futures_timer..native..timer..TimerHandle$u20$as$u20$core..default..Default$GT$::default::hc8aa0c4f949cecb7 /home/saghm/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-timer-3.0.2/src/native/timer.rs:281:32 (rust-scratch+0xb756e)
#5 futures_timer::native::delay::Delay::new::hbe1479342e222ced /home/saghm/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-timer-3.0.2/src/native/delay.rs:37:49 (rust-scratch+0x82791)
#6 rust_scratch::main::_$u7b$$u7b$closure$u7d$$u7d$::h1db66191c2f2da6d /home/saghm/code/rust-scratch/src/main.rs:9:19 (rust-scratch+0x81c26)
#7 _$LT$std..future..GenFuture$LT$T$GT$$u20$as$u20$core..future..future..Future$GT$::poll::h050bd0d655c93b53 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/future.rs:44:15 (rust-scratch+0x8c2b9)
#8 tokio::runtime::shell::Shell::block_on::h743d533da7701fbf /home/saghm/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/runtime/shell.rs:49:31 (rust-scratch+0x85eca)
#9 tokio::runtime::Runtime::block_on::_$u7b$$u7b$closure$u7d$$u7d$::hb2c135c2e0978b5a /home/saghm/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/runtime/mod.rs:411:34 (rust-scratch+0x8bd07)
#10 tokio::runtime::context::enter::hfa9d53417b4bce09 /home/saghm/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/runtime/context.rs:72:5 (rust-scratch+0x8a219)
#11 tokio::runtime::handle::Handle::enter::ha6cb21f5196f2629 /home/saghm/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/runtime/handle.rs:34:9 (rust-scratch+0x889f2)
#12 tokio::runtime::Runtime::block_on::h58569e9f46220f70 /home/saghm/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/runtime/mod.rs:410:9 (rust-scratch+0x8bc52)
#13 rust_scratch::main::hdbc89cc6309c8f66 /home/saghm/code/rust-scratch/src/main.rs:7:1 (rust-scratch+0x8a520)
#14 std::rt::lang_start::_$u7b$$u7b$closure$u7d$$u7d$::h34904544d1260f39 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/rt.rs:67:34 (rust-scratch+0x8a111)
#15 std::rt::lang_start_internal::_$u7b$$u7b$closure$u7d$$u7d$::he55e3739ea41259e /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/rt.rs:52:13 (rust-scratch+0xed0be)
#16 std::panicking::try::do_call::h73e24f9817ae57df /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/panicking.rs:331:40 (rust-scratch+0xed0be)
#17 std::panicking::try::hd08eb281999526b6 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/panicking.rs:274:15 (rust-scratch+0xed0be)
#18 std::panic::catch_unwind::hc981e5be87497715 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/panic.rs:394:14 (rust-scratch+0xed0be)
#19 std::rt::lang_start_internal::h0962c0aa989e5c64 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/rt.rs:51:25 (rust-scratch+0xed0be)
#20 main <null> (rust-scratch+0x8a5ca)
SUMMARY: ThreadSanitizer: data race /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/liballoc/alloc.rs:103:5 in alloc::alloc::dealloc::h99b6371ef57874e8
==================
==================
WARNING: ThreadSanitizer: data race (pid=94179)
Write of size 8 at 0x7b2400000000 by thread T1:
#0 free /rustc/llvm/src/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:706:3 (rust-scratch+0x11d58)
#1 alloc::alloc::dealloc::hdfe9c926a2c97292 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/liballoc/alloc.rs:103:5 (rust-scratch+0xcf3f8)
#2 _$LT$alloc..alloc..Global$u20$as$u20$core..alloc..AllocRef$GT$::dealloc::h66734b70812b1a80 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/liballoc/alloc.rs:179:13 (rust-scratch+0xd09d5)
#3 alloc::sync::Arc$LT$T$GT$::drop_slow::h7f197188a718ed4e /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/liballoc/sync.rs:743:13 (rust-scratch+0xd97fd)
#4 _$LT$alloc..sync..Arc$LT$T$GT$$u20$as$u20$core..ops..drop..Drop$GT$::drop::h4e6c0f0bb4eda99e /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/liballoc/sync.rs:1249:13 (rust-scratch+0xda84e)
#5 core::ptr::drop_in_place::h4cbde1772138cbdd /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libcore/ptr/mod.rs:177:1 (rust-scratch+0xc8c2b)
#6 futures_timer::native::timer::Timer::remove::h6e73f73a12f0ec99 /home/saghm/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-timer-3.0.2/src/native/timer.rs:163:5 (rust-scratch+0xb69f4)
#7 _$LT$futures_timer..native..timer..Timer$u20$as$u20$core..future..future..Future$GT$::poll::h54f5085abc08d1a1 /home/saghm/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-timer-3.0.2/src/native/timer.rs:181:25 (rust-scratch+0xb702c)
#8 futures_timer::native::global::run::h07df39a7dae9b9c6 /home/saghm/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-timer-3.0.2/src/native/global.rs:63:17 (rust-scratch+0xb976e)
#9 futures_timer::native::global::HelperThread::new::_$u7b$$u7b$closure$u7d$$u7d$::h05f8c2b07ec730a2 /home/saghm/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-timer-3.0.2/src/native/global.rs:28:28 (rust-scratch+0xb921a)
#10 std::sys_common::backtrace::__rust_begin_short_backtrace::h8e8591708c46fd21 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/sys_common/backtrace.rs:130:5 (rust-scratch+0xc7be0)
#11 std::thread::Builder::spawn_unchecked::_$u7b$$u7b$closure$u7d$$u7d$::_$u7b$$u7b$closure$u7d$$u7d$::h22c8640f8bfe876a /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/thread/mod.rs:475:17 (rust-scratch+0xc5644)
#12 _$LT$std..panic..AssertUnwindSafe$LT$F$GT$$u20$as$u20$core..ops..function..FnOnce$LT$$LP$$RP$$GT$$GT$::call_once::h0b374bde16c5afce /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/panic.rs:318:9 (rust-scratch+0xc4594)
#13 std::panicking::try::do_call::h282dedbf2ea85d21 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/panicking.rs:331:40 (rust-scratch+0xb7e89)
#14 __rust_try <null> (rust-scratch+0xb9d4b)
#15 std::panicking::try::ha694bcbe7ad10ea7 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/panicking.rs:274:15 (rust-scratch+0xb7d49)
#16 std::panic::catch_unwind::h7dc96eede4c63726 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/panic.rs:394:14 (rust-scratch+0xc486a)
#17 std::thread::Builder::spawn_unchecked::_$u7b$$u7b$closure$u7d$$u7d$::ha687518591e07ecb /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/thread/mod.rs:474:30 (rust-scratch+0xc53e6)
#18 core::ops::function::FnOnce::call_once$u7b$$u7b$vtable.shim$u7d$$u7d$::h20b67eba1411c2a3 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libcore/ops/function.rs:232:5 (rust-scratch+0xc815b)
#19 _$LT$alloc..boxed..Box$LT$F$GT$$u20$as$u20$core..ops..function..FnOnce$LT$A$GT$$GT$::call_once::h1196c8e359cc899e /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/liballoc/boxed.rs:1017:9 (rust-scratch+0xe461e)
Previous atomic write of size 8 at 0x7b2400000000 by main thread:
#0 __tsan_atomic64_fetch_sub /rustc/llvm/src/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interface_atomic.cc:647:3 (rust-scratch+0x55941)
#1 core::sync::atomic::atomic_sub::h615ea18f0983c82c /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libcore/sync/atomic.rs:2314:20 (rust-scratch+0xd3109)
#2 core::sync::atomic::AtomicUsize::fetch_sub::h076e2f3cd0076fc9 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libcore/sync/atomic.rs:1654:30 (rust-scratch+0xd3959)
#3 _$LT$alloc..sync..Arc$LT$T$GT$$u20$as$u20$core..ops..drop..Drop$GT$::drop::h4e6c0f0bb4eda99e /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/liballoc/sync.rs:1214:12 (rust-scratch+0xda80d)
#4 core::ptr::drop_in_place::h4cbde1772138cbdd /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libcore/ptr/mod.rs:177:1 (rust-scratch+0xc8c2b)
#5 core::ptr::drop_in_place::h86ff50707fccf11b /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libcore/ptr/mod.rs:177:1 (rust-scratch+0xc94db)
#6 core::ptr::drop_in_place::hd1fc51fa5a02fcb9 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libcore/ptr/mod.rs:177:1 (rust-scratch+0x85032)
#7 core::ptr::drop_in_place::hc65b1b631e46b795 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libcore/ptr/mod.rs:177:1 (rust-scratch+0x84f2b)
#8 core::ptr::drop_in_place::h8cffda62d11314c1 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libcore/ptr/mod.rs:177:1 (rust-scratch+0x84bf4)
#9 rust_scratch::main::_$u7b$$u7b$closure$u7d$$u7d$::h1db66191c2f2da6d /home/saghm/code/rust-scratch/src/main.rs:17:6 (rust-scratch+0x8214b)
#10 _$LT$std..future..GenFuture$LT$T$GT$$u20$as$u20$core..future..future..Future$GT$::poll::h050bd0d655c93b53 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/future.rs:44:15 (rust-scratch+0x8c2b9)
#11 tokio::runtime::shell::Shell::block_on::h743d533da7701fbf /home/saghm/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/runtime/shell.rs:49:31 (rust-scratch+0x85eca)
#12 tokio::runtime::Runtime::block_on::_$u7b$$u7b$closure$u7d$$u7d$::hb2c135c2e0978b5a /home/saghm/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/runtime/mod.rs:411:34 (rust-scratch+0x8bd07)
#13 tokio::runtime::context::enter::hfa9d53417b4bce09 /home/saghm/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/runtime/context.rs:72:5 (rust-scratch+0x8a219)
#14 tokio::runtime::handle::Handle::enter::ha6cb21f5196f2629 /home/saghm/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/runtime/handle.rs:34:9 (rust-scratch+0x889f2)
#15 tokio::runtime::Runtime::block_on::h58569e9f46220f70 /home/saghm/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/runtime/mod.rs:410:9 (rust-scratch+0x8bc52)
#16 rust_scratch::main::hdbc89cc6309c8f66 /home/saghm/code/rust-scratch/src/main.rs:7:1 (rust-scratch+0x8a520)
#17 std::rt::lang_start::_$u7b$$u7b$closure$u7d$$u7d$::h34904544d1260f39 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/rt.rs:67:34 (rust-scratch+0x8a111)
#18 std::rt::lang_start_internal::_$u7b$$u7b$closure$u7d$$u7d$::he55e3739ea41259e /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/rt.rs:52:13 (rust-scratch+0xed0be)
#19 std::panicking::try::do_call::h73e24f9817ae57df /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/panicking.rs:331:40 (rust-scratch+0xed0be)
#20 std::panicking::try::hd08eb281999526b6 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/panicking.rs:274:15 (rust-scratch+0xed0be)
#21 std::panic::catch_unwind::hc981e5be87497715 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/panic.rs:394:14 (rust-scratch+0xed0be)
#22 std::rt::lang_start_internal::h0962c0aa989e5c64 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/rt.rs:51:25 (rust-scratch+0xed0be)
#23 main <null> (rust-scratch+0x8a5ca)
Thread T1 'futures-timer' (tid=94215, running) created by main thread at:
#0 pthread_create /rustc/llvm/src/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:967:3 (rust-scratch+0x12cab)
#1 std::sys::unix::thread::Thread::new::h4eb7bc22d6ade13e /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/sys/unix/thread.rs:68:19 (rust-scratch+0xee07d)
#2 std::thread::Builder::spawn::hcb0ec171a5d788f8 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/thread/mod.rs:386:18 (rust-scratch+0xc56fa)
#3 futures_timer::native::global::HelperThread::new::h8e6a7c792debb5cf /home/saghm/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-timer-3.0.2/src/native/global.rs:26:22 (rust-scratch+0xb8e1c)
#4 _$LT$futures_timer..native..timer..TimerHandle$u20$as$u20$core..default..Default$GT$::default::hc8aa0c4f949cecb7 /home/saghm/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-timer-3.0.2/src/native/timer.rs:281:32 (rust-scratch+0xb756e)
#5 futures_timer::native::delay::Delay::new::hbe1479342e222ced /home/saghm/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-timer-3.0.2/src/native/delay.rs:37:49 (rust-scratch+0x82791)
#6 rust_scratch::main::_$u7b$$u7b$closure$u7d$$u7d$::h1db66191c2f2da6d /home/saghm/code/rust-scratch/src/main.rs:9:19 (rust-scratch+0x81c26)
#7 _$LT$std..future..GenFuture$LT$T$GT$$u20$as$u20$core..future..future..Future$GT$::poll::h050bd0d655c93b53 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/future.rs:44:15 (rust-scratch+0x8c2b9)
#8 tokio::runtime::shell::Shell::block_on::h743d533da7701fbf /home/saghm/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/runtime/shell.rs:49:31 (rust-scratch+0x85eca)
#9 tokio::runtime::Runtime::block_on::_$u7b$$u7b$closure$u7d$$u7d$::hb2c135c2e0978b5a /home/saghm/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/runtime/mod.rs:411:34 (rust-scratch+0x8bd07)
#10 tokio::runtime::context::enter::hfa9d53417b4bce09 /home/saghm/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/runtime/context.rs:72:5 (rust-scratch+0x8a219)
#11 tokio::runtime::handle::Handle::enter::ha6cb21f5196f2629 /home/saghm/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/runtime/handle.rs:34:9 (rust-scratch+0x889f2)
#12 tokio::runtime::Runtime::block_on::h58569e9f46220f70 /home/saghm/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/runtime/mod.rs:410:9 (rust-scratch+0x8bc52)
#13 rust_scratch::main::hdbc89cc6309c8f66 /home/saghm/code/rust-scratch/src/main.rs:7:1 (rust-scratch+0x8a520)
#14 std::rt::lang_start::_$u7b$$u7b$closure$u7d$$u7d$::h34904544d1260f39 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/rt.rs:67:34 (rust-scratch+0x8a111)
#15 std::rt::lang_start_internal::_$u7b$$u7b$closure$u7d$$u7d$::he55e3739ea41259e /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/rt.rs:52:13 (rust-scratch+0xed0be)
#16 std::panicking::try::do_call::h73e24f9817ae57df /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/panicking.rs:331:40 (rust-scratch+0xed0be)
#17 std::panicking::try::hd08eb281999526b6 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/panicking.rs:274:15 (rust-scratch+0xed0be)
#18 std::panic::catch_unwind::hc981e5be87497715 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/panic.rs:394:14 (rust-scratch+0xed0be)
#19 std::rt::lang_start_internal::h0962c0aa989e5c64 /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/libstd/rt.rs:51:25 (rust-scratch+0xed0be)
#20 main <null> (rust-scratch+0x8a5ca)
SUMMARY: ThreadSanitizer: data race /rustc/f509b26a7730d721ef87423a72b3fdf8724b4afa/src/liballoc/alloc.rs:103:5 in alloc::alloc::dealloc::hdfe9c926a2c97292
==================
ThreadSanitizer: reported 2 warnings
use std::time::Duration;
use futures::future::Either;
use futures_timer::Delay;
use tokio::sync::watch;
#[tokio::main]
async fn main() {
let timeout = Delay::new(Duration::from_millis(250));
let (_sender, mut receiver) = watch::channel(());
let message_received = Box::pin(receiver.recv());
match futures::future::select(timeout, message_received).await {
Either::Left(..) => println!("timeout"),
Either::Right(..) => println!("message received"),
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment