Repository navigation
Conversation
__aexit__ cancelled the run task while a plugin's run_worker cleanup still awaited, and the run wrapper then cancelled the caller's task, so every later await raised CancelledError. Now __aexit__ waits, with a bound, for the plugins' code after shutdown.
1 of 3 tasks
|
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was changed
This PR makes
Worker.__aexit__wait for the run task aftershutdown(), for up to 60 s, instead of cancelling it.Why?
After
shutdown(), the run task has only plugin cleanup left, such as thefinallyofPlugin.run_worker.__aexit__cancelled that cleanup while it awaited. The run task caught theCancelledErrorand cancelled the caller's task too. So the cleanup didn't finish, and every laterawaitin the caller raisedCancelledError, even after theasync withblock.Here's a repro. A plugin awaits a client call in its
finally, and the caller awaits after the block.Checklist
How was this tested:
tests/worker/test_worker_exit.pyruns the repro. It fails onmainand passes with this change. I also ranpoe lintand the full suite.Any docs updates needed? No.