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
gh-92530: Fix an issue that occurred after interrupting threading.Condition.notify #92534
gh-92530: Fix an issue that occurred after interrupting threading.Condition.notify #92534
Conversation
…ng.Condition.notify
Removing the deque entirely undoes the optimisation from https://bugs.python.org/issue17385
No, |
Thanks @serhiy-storchaka for the PR |
GH-92829 is a backport of this pull request to the 3.11 branch. |
…ng.Condition.notify (pythonGH-92534) If Condition.notify() was interrupted just after it released the waiter lock, but before removing it from the queue, the following calls of notify() failed with RuntimeError: cannot release un-acquired lock. (cherry picked from commit 70af994) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
…ng.Condition.notify (pythonGH-92534) If Condition.notify() was interrupted just after it released the waiter lock, but before removing it from the queue, the following calls of notify() failed with RuntimeError: cannot release un-acquired lock. (cherry picked from commit 70af994) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
GH-92830 is a backport of this pull request to the 3.10 branch. |
…ng.Condition.notify (pythonGH-92534) If Condition.notify() was interrupted just after it released the waiter lock, but before removing it from the queue, the following calls of notify() failed with RuntimeError: cannot release un-acquired lock. (cherry picked from commit 70af994) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
GH-92831 is a backport of this pull request to the 3.9 branch. |
I reviewed your fix twice. Ok, now it makes sense and the comment is enough to explain the fix and the code. It might be safe to check if the waiter is already released by calling the .locked() method, but I don't think that it's worth it and it might introduce new subtle concurrency issues. In short, the fix is correct :-) |
EAFP is so superior to LBYL here, that the latter I did not even consider. |
…dition.notify (GH-92534) (GH-92831) If Condition.notify() was interrupted just after it released the waiter lock, but before removing it from the queue, the following calls of notify() failed with RuntimeError: cannot release un-acquired lock. (cherry picked from commit 70af994) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
…dition.notify (GH-92534) (GH-92830) If Condition.notify() was interrupted just after it released the waiter lock, but before removing it from the queue, the following calls of notify() failed with RuntimeError: cannot release un-acquired lock. (cherry picked from commit 70af994) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
…ing.Condition.notify (GH-92534) (GH-92829) If Condition.notify() was interrupted just after it released the waiter lock, but before removing it from the queue, the following calls of notify() failed with RuntimeError: cannot release un-acquired lock. (cherry picked from commit 70af994) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Automerge-Triggered-By: GH:serhiy-storchaka
…ng.Condition.notify (pythonGH-92534) (pythonGH-92831) If Condition.notify() was interrupted just after it released the waiter lock, but before removing it from the queue, the following calls of notify() failed with RuntimeError: cannot release un-acquired lock. (cherry picked from commit 70af994) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Fixes #92530.