-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Avoid deadlock in SyncedCollection #530
Conversation
Codecov Report
@@ Coverage Diff @@
## master #530 +/- ##
=======================================
Coverage 78.16% 78.17%
=======================================
Files 65 65
Lines 7036 7039 +3
Branches 1310 1311 +1
=======================================
+ Hits 5500 5503 +3
Misses 1231 1231
Partials 305 305
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Thanks again for your help, @joaander. If you can think of a test that would fail (but not deadlock), that would be a good addition. I don't know how I would construct such a case unless there is a way to force a timeout.
I tried to get failing behavior in my first attempt on the way to this MWE but wan't successful. I had tried to trigger conflicting writes to the file. If inspection of private variables is allowed in the test, a test that would fail before this change would construct two |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With help from @bdice, I was able to reproduce the problem and fix even though I didn't experience a deadlock by printing threading.get_ident()
and "done" inside the update_status
function.
In the interest of getting things merged I'll look into constructing a test later. |
Description
Add locks needed to avoid deadlocks in
SyncedCollection
Motivation and Context
This MWE deadlocks because
SycedCollections._locks[lock_id]
gets overwritten while it is being used:Types of Changes
1The change breaks (or has the potential to break) existing functionality.
Checklist:
If necessary: