-
-
Notifications
You must be signed in to change notification settings - Fork 719
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
Handle failing plugin.close()
calls during scheduler shutdown
#6450
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3358,8 +3358,14 @@ async def close(self): | |
await self.finished() | ||
return | ||
|
||
async def log_errors(func): | ||
try: | ||
await func() | ||
except Exception: | ||
logger.exception("Plugin call failed during scheduler.close") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Including the plugin name in this message would be nice because as is we just know that some plugin method failed, but not which plugin There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. logger.exception includes the traceback which should include the plugin class name, although it could be a base class that fails There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, thanks for pointing that out @graingert |
||
|
||
await asyncio.gather( | ||
*[plugin.before_close() for plugin in list(self.plugins.values())] | ||
*[log_errors(plugin.before_close) for plugin in list(self.plugins.values())] | ||
) | ||
|
||
self.status = Status.closing | ||
|
@@ -3371,7 +3377,7 @@ async def close(self): | |
await preload.teardown() | ||
|
||
await asyncio.gather( | ||
*[plugin.close() for plugin in list(self.plugins.values())] | ||
*[log_errors(plugin.close) for plugin in list(self.plugins.values())] | ||
) | ||
|
||
for pc in self.periodic_callbacks.values(): | ||
|
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.
It would also be nice to check that the logger exceptions also occurred as expected