-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Fix spurious "Future exception was never retrieved" warnings for connection lost errors #11100
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
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 |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Fixed spurious "Future exception was never retrieved" warnings for connection lost errors when the connector is not closed -- by :user:`bdraco`. | ||
|
|
||
| When connections are lost, the exception is now marked as retrieved since it is always propagated through other means, preventing unnecessary warnings in logs. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -98,6 +98,12 @@ def connection_lost(self, exc: Optional[BaseException]) -> None: | |
| ), | ||
| original_connection_error, | ||
| ) | ||
| # Mark the exception as retrieved to prevent | ||
| # "Future exception was never retrieved" warnings | ||
| # The exception is always passed on through | ||
| # other means, so this is safe | ||
| with suppress(Exception): | ||
| self.closed.exception() | ||
|
Member
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. Should this maybe be handled by the set_exception() helper? I assume that function is the one responsible for sending the exception elsewhere, so seems to me that it'd make sense for it to also suppress the unretrieved exception that it's handling.
Member
Author
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. In this case it's the waiter below that is responsible for propagating the exception. We effectively have it in two places. There are other places where we don't so we can't make set_exception responsible as it doesn't know if it should suppress the warning or not |
||
|
|
||
| if self._payload_parser is not None: | ||
| with suppress(Exception): # FIXME: log this somehow? | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.