-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Close client connections when writer is unexpectedly cancelled #8041
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #8041 +/- ##
==========================================
+ Coverage 97.42% 97.47% +0.05%
==========================================
Files 107 107
Lines 32601 32611 +10
Branches 3799 3800 +1
==========================================
+ Hits 31760 31788 +28
+ Misses 634 620 -14
+ Partials 207 203 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
One concern that occurred to me is what if this is part of a task that is being cancelled by the user? In that case we don't want to suppress.
Ideally, if we can detect if the cancellation is from our client timeout or similar, we'd suppress it, otherwise we'd reraise it. Or something along those lines...
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.
Looks reasonable, but might also need something to handle ClientTimeout. Can't remember exactly how the logic works, but if we hit the timeout at this point, then we probably don't actually want to time out, as we already received the response before the timeout.
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.
I think thats handled by
aiohttp/aiohttp/client_reqrep.py
Line 570 in 9e14ea1
if exc.errno is None and isinstance(exc, asyncio.TimeoutError): |
Tests are very light for this case so I'll have to work up something from scratch. I'll do that if the issue is confirmed fixed by the op of the discussion |
I think this one is actually superseded by #9030. |
closing in favor of #9030 |
TODO: figure out how to test this
What do these changes do?
If the writer is cancelled out while waiting for the connection to close or release, we now suppress the cancellation to prevent it from leaking upwards and force close the connection to ensure we do not reuse a connection which has an indeterminate state.
#8035 (reply in thread)
Are there changes in behavior for the user?
Related issue number
Checklist
CONTRIBUTORS.txt
CHANGES
folder<issue_id>.<type>
for example (588.bugfix)issue_id
change it to the pr id after creating the pr.feature
: Signifying a new feature..bugfix
: Signifying a bug fix..doc
: Signifying a documentation improvement..removal
: Signifying a deprecation or removal of public API..misc
: A ticket has been closed, but it is not of interest to users.