Closed euncharm1ng closed 2 years ago
Looks like https://github.com/rust-lang/rust/issues/39364. Cool that you found a consistent reproducer! #933 tracks replacing the stdlib's mpsc
with crossbeam-channels
Ohh, I see. Thanks for your reply!
Thank you for reporting this. I think it's a good idea to keep this open.
This can also fail in CI: https://github.com/sharkdp/fd/actions/runs/3255706132/jobs/5345297564#step:10:319
Hi, I found a race bug that makes fd panic by reaching an unreachable code at Line 1176 in std/sync/mpsc/mod.rs.
I suspect that fd crashes when the receiver thread spawned by spawn_receiver() does not proceed to execute line 352 and the sender threads spawned by spawn_senders() race to send messages to the receiver at line 548.
How to reproduce the crash
I built it with
cargo build
and observed this error as I ran./fd
in/fd/target/debug/
under stress testing workload (to better explore concurrency errors). Attached the stack backtrace below.To make this race happen more deterministically, I recommend you to insert sleep operation at the following three locations (with the sleep operations, I could reproduce this crash out of seven test runs on average)
Line 350 in src/walk.rs
Line 406 in src/walk.rs
Line line 547 in src/walk.rs
Stack backtrace
Hope this helps. Please let me know if you need more information.