Fix potential deadlock in ProxySegment all_vectors#7172
Conversation
There was a problem hiding this comment.
Great find. I like that this is still sound because we currently guarantee the set of vector names doesn't change.
Here we locked wrapped first and then write. If this deadlocks it means we must lock these in reverse order somewhere else. Do we know where that happens?
|
There are more places where we have this lock pattern. This also locks wrapped first and then write: qdrant/lib/shard/src/proxy_segment/mod.rs Lines 149 to 187 in 60e0c07 I'm afraid we might suffer from the same deadlock there if we don't find (and fix?) the place where we lock in reverse order. |
|
No! I see now. This is a self-deadlock. We were holding a lock on
Nice find! |
|
Thanks for adding a comment, I apologize for my poor PR description 🙇 |
|
Now that I read it again, your description was perfectly fine:
|
* Fix potential deadlock in ProxySegment all_vectors * Add comment --------- Co-authored-by: timvisee <tim@visee.me>
Fetching a vector on a proxy segment reacquires a read lock on the wrapped segment under the hood.
This only deadlock if a different thread tries to acquire a write lock in between.