Crates.io | rust-debugging-locks |
lib.rs | rust-debugging-locks |
version | 0.8.9 |
source | src |
created_at | 2024-02-20 21:46:38.881532 |
updated_at | 2024-02-20 21:46:38.881532 |
description | A library for debugging locks in Rust |
homepage | |
repository | |
max_upload_size | |
id | 1147098 |
size | 48,879 |
This utility provides a thin wrapper around RwLock
(and Mutex
in the future) for debugging lock stalls.
The wrapper keeps track of the callers' and creators' stackframes to provide debugging context.
[profile.release]
debug = true
(this will increase the binary size by 20x; performance/optimization of machine code is NOT affected)
there are two levels of information available:
env_logger::Builder::from_env(Env::default().default_filter_or("debug")).init();
RUST_LOG=rust_debugging_locks::debugging_locks=info the_binary
[2023-05-02T18:17:53Z INFO rust_debugging_locks::debugging_locks] NEW WRAPPED RWLOCK (v0.0.0)
[2023-05-03T09:33:26Z INFO rust_debugging_locks::debugging_locks] READER BLOCKED on thread main:ThreadId(1) for 7.597502ms (locktag xFxiD)
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> blocking call:
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> simple.rs!simple::writer_blocks_reader::h90b32e8be4ee69f9:60
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> simple.rs!simple::main::h51d8a2c7c463da66:12
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> current lock holder:
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> simple.rs!simple::writer_blocks_reader::{{closure}}::h56d46ee0d6ad82da:51
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> rwlock constructed here:
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> simple.rs!simple::writer_blocks_reader::h90b32e8be4ee69f9:47
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> simple.rs!simple::main::h51d8a2c7c463da66:12
[2023-05-03T09:33:26Z INFO rust_debugging_locks::debugging_locks] READER BLOCKED on thread main:ThreadId(1) for 9.658057ms (locktag xFxiD)
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> blocking call:
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> simple.rs!simple::writer_blocks_reader::h90b32e8be4ee69f9:60
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> simple.rs!simple::main::h51d8a2c7c463da66:12
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> current lock holder:
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> simple.rs!simple::writer_blocks_reader::{{closure}}::h56d46ee0d6ad82da:51
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> rwlock constructed here:
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> simple.rs!simple::writer_blocks_reader::h90b32e8be4ee69f9:47
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> simple.rs!simple::main::h51d8a2c7c463da66:12
[2023-05-03T09:33:26Z INFO rust_debugging_locks::debugging_locks] READER BLOCKED on thread main:ThreadId(1) for 20.825162ms (locktag xFxiD)
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> blocking call:
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> simple.rs!simple::writer_blocks_reader::h90b32e8be4ee69f9:60
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> simple.rs!simple::main::h51d8a2c7c463da66:12
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> current lock holder:
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> simple.rs!simple::writer_blocks_reader::{{closure}}::h56d46ee0d6ad82da:51
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> rwlock constructed here:
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> simple.rs!simple::writer_blocks_reader::h90b32e8be4ee69f9:47
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> simple.rs!simple::main::h51d8a2c7c463da66:12
[2023-05-03T09:33:26Z INFO rust_debugging_locks::debugging_locks] READER BLOCKED on thread main:ThreadId(1) for 24.683994ms (locktag xFxiD)
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> blocking call:
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> simple.rs!simple::writer_blocks_reader::h90b32e8be4ee69f9:60
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> simple.rs!simple::main::h51d8a2c7c463da66:12
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> current lock holder:
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> simple.rs!simple::writer_blocks_reader::{{closure}}::h56d46ee0d6ad82da:51
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> rwlock constructed here:
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> simple.rs!simple::writer_blocks_reader::h90b32e8be4ee69f9:47
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> simple.rs!simple::main::h51d8a2c7c463da66:12
[2023-05-03T09:33:26Z INFO rust_debugging_locks::debugging_locks] READER BLOCKED on thread main:ThreadId(1) for 38.673215ms (locktag xFxiD)
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> blocking call:
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> simple.rs!simple::writer_blocks_reader::h90b32e8be4ee69f9:60
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> simple.rs!simple::main::h51d8a2c7c463da66:12
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> current lock holder:
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> simple.rs!simple::writer_blocks_reader::{{closure}}::h56d46ee0d6ad82da:51
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> rwlock constructed here:
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> simple.rs!simple::writer_blocks_reader::h90b32e8be4ee69f9:47
[2023-05-03T09:33:26Z DEBUG rust_debugging_locks::debugging_locks] |xFxiD> simple.rs!simple::main::h51d8a2c7c463da66:12
A locktag is assigned a RwLock instance when it is created. The locktag is used to group log lines together. The locktag is a hash of the stacktrace of the caller of the RwLock::new() method.