-
-
Notifications
You must be signed in to change notification settings - Fork 31.3k
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
Asyncio.Condition prevents cancellation #77022
Comments
Hey guys, A week after a serious asyncio.Lock bug, I found another bug that makes asyncio.Condition ignore and prevent cancellation in some cases due to an "except: pass" which tbh is a little embarrassing. What happens is that during the time it takes to get back a conditional lock after notifying it, asyncio completely ignores all cancellations sent to the waiting task. le_bug.py: Contains the bug Yuri, I hope you didn't miss me during this week ;-) -- Bar |
le_meme.jpg is a pretty common facial expression when one debugs locks/conditions, so let's not attach it in the future :) We try to keep the bug tracker free of unnecessary information. As for the bug—please submit a PR! |
Interesting case! This is super subtle. I think the patch is correct though. (In Trio this is one of the cases where we use shielding: https://github.com/python-trio/trio/blob/f48d8922dfe2118bfaaf9a85f2524e58146ba369/trio/_sync.py#L749-L752 . But asyncio.shield has different semantics -- it still delivers the CancelledError to the caller, which is no good in this case.) |
It does make me wonder if asyncio.shield *should* wait for the thing it's shielding though, so that it *would* work in this case? (Similar to bpo-32751.) |
I don't think so. Having shield not cancel immediately but rather wait and On Wed, Feb 14, 2018, 7:28 AM Nathaniel Smith <report@bugs.python.org>
|
Thanks Bar Harel |
What I'm suggesting is that maybe it actually is good in the general case :-). If an operation can't be cancelled, that's too bad, but it's generally still better to wait then to silently leak it into the background. |
Well, makes sense |
Should this issue be closed now? |
Yup. Thanks Yuri :-) |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: