tokio-rs / loom

Concurrency permutation testing tool for Rust.
MIT License
2.09k stars 110 forks source link

track locations #258

Closed carllerche closed 2 years ago

carllerche commented 2 years ago

This PR is mostly just mechanical. It adds #[track_caller] and gets the location in the public API and plumbs it through. This helps debug deadlocks:

thread 'runtime::tests::loom_pool::group_a::pool_multi_spawn' panicked at 'deadlock; threads = [(Id(0), Blocked(Location(Some(Location { file: "tokio/src/runtime/tests/loom_oneshot.rs", line: 45, col: 31 })))), (Id(1), Blocked(Location(Some(Location { file: "tokio/src/park/thread.rs", line: 112, col: 30 })))), (Id(2), Blocked(Location(Some(Location { file: "tokio/src/runtime/thread_pool/park.rs", line: 206, col: 30 }))))]'

The output is pretty bad, but it is definitely helpful :)