-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deadlock introduced in 5.x #195
Comments
@bsilver8192 points out that this could be a consequence of
This is potentially problematic for
|
I can confirm we've seen this deadlock too going from 4.0.2 to 5.2.0. If we want to fix re-entrancy, how about optionally storing read-guards on thread-local storage so they can be re-used? |
When would you release the read guards from thread-local storage? |
Reference counting maybe? 🤔 (when the number of borrows of a read guard reaches zero) |
That only solves the problem with overlapping read guard lifetimes within a single thread, but there are other situations where fair locks deadlock. For example:
There's a dependency cycle here: A waiting on X waiting on B waiting on W waiting on A. |
Looking into this, probably going to result in switching away from parking lot sadly since it doesn't offer an unfair API. Can't promise when I can land a patch for this due to other life commitments but hopefully within a month. |
I'm not super familiar with parking_lot, but I think implementing an unfair rwlock using the parking_lot_core API would be doable. There's a lot of code involved with |
Upgrading from dashmap 4.x to 5.x caused my application to deadlock. Surprisingly, the deadlock is readily reproducible with a simple example, and the breaking change could be found by binary searching commits.
The following example works fine on commit 45058db and deadlocks on every commit thereafter. So apparently the issue stems from switching to parking lot for locking.
The text was updated successfully, but these errors were encountered: