-
Notifications
You must be signed in to change notification settings - Fork 265
Open
Description
parking_lot version: 0.12.4
OS: ubuntu 25.04
I am observing deadlocks when mixing upgradable_read locks with read locks on different thread.
It appears that new read locks are preventing the upgradable lock from being upgraded which is surprising.
I would expect new read locks to be queued up for after the upgrade and release of the lock.
Here is the deadlock backtrace:
[2025-09-03T13:48:05.343Z ERROR parking_stress] 1 deadlocks detected
Deadlock #0
Thread Id 136378943760064
0: 0x57db1ca81143 - parking_lot_core::parking_lot::deadlock_impl::on_unpark::he273ac1dd412a8c2
at /home/agourlay/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/parking_lot_core-0.9.11/src/parking_lot.rs:1211:32
1: 0x57db1ca45cdb - parking_lot_core::parking_lot::deadlock::on_unpark::h2a1b2c41e9bbdca2
at /home/agourlay/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/parking_lot_core-0.9.11/src/parking_lot.rs:1144:9
2: 0x57db1ca4482f - parking_lot_core::parking_lot::park::{{closure}}::hed3d5d78129fc2c3
at /home/agourlay/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/parking_lot_core-0.9.11/src/parking_lot.rs:637:17
3: 0x57db1ca42c97 - parking_lot_core::parking_lot::with_thread_data::h441ed05b07c4f512
at /home/agourlay/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/parking_lot_core-0.9.11/src/parking_lot.rs:207:5
parking_lot_core::parking_lot::park::h0bbc060b0481a374
at /home/agourlay/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/parking_lot_core-0.9.11/src/parking_lot.rs:600:5
4: 0x57db1ca4b04c - parking_lot::raw_rwlock::RawRwLock::wait_for_readers::h2c6fb81f052a6f7e
at /home/agourlay/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/parking_lot-0.12.4/src/raw_rwlock.rs:1022:17
5: 0x57db1ca4a7ab - parking_lot::raw_rwlock::RawRwLock::upgrade_slow::h6c49c43caf111146
at /home/agourlay/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/parking_lot-0.12.4/src/raw_rwlock.rs:875:14
6: 0x57db1c9fb8f0 - <parking_lot::raw_rwlock::RawRwLock as lock_api::rwlock::RawRwLockUpgrade>::upgrade::h1436c0376a214b1b
at /home/agourlay/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/parking_lot-0.12.4/src/raw_rwlock.rs:374:31
7: 0x57db1c9f5a9d - lock_api::rwlock::RwLockUpgradableReadGuard<R,T>::upgrade::hd8e23c93d41104ea
at /home/agourlay/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/lock_api-0.4.13/src/rwlock.rs:1946:26
8: 0x57db1c9f7df6 - parking_stress::Shard::upgrade::h9188d2f3290b43fe
I have a self contained reproducer https://github.com/qdrant/parking-stress to make things clearer.
Just cargo run and it takes a few seconds to fail.
The weird part is that the deadlock only occurs when I enable the deadlock detector.
Hopefully you can answer my questions:
- Am I using upgradable locks wrong?
- Why does it seem like the deadlock detector is causing deadlocks?
Thanks for this great library!
timvisee and generall
Metadata
Metadata
Assignees
Labels
No labels