-
Notifications
You must be signed in to change notification settings - Fork 174
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
Don't fail to finalize observers if one fails #811
Conversation
b210bc6
to
04e3f2b
Compare
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.
Thank you B money.
🐟 good call! |
🐟 lgtm |
try: | ||
observer.on_finish(exc_info) | ||
except Exception: | ||
logger.exception("Exception raised while finalizing observer") |
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.
Please make it so this exception includes all the details the original exception would include. I don't want things to become harder to debug because we're catching this exception.
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.
logger.exception
actually adds that information for us
https://docs.python.org/3/library/logging.html#logging.Logger.exception
💸 TL;DR
When a request finishes, baseplate invokes
on_finish
for each observer. Sometimes these finalizers will fail and raise an exception. This causes the loop to exit early and we fail to finalize observers later in the loop. This could result in a few things including postgres sessions not getting closed timely. Raising from a finalizer also means we fail to clean up reference cycles later in the function and leave more work for GC to pick up later.📜 Details
N/A
🧪 Testing Steps / Validation
✅ Checks