-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[PR #3733/6b0bc4ef backport][3.13] Fix connector not waiting for connections to close #11074
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
Conversation
CodSpeed Performance ReportMerging #11074 will not alter performanceComparing Summary
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 3.13 #11074 +/- ##
=======================================
Coverage 98.24% 98.24%
=======================================
Files 130 130
Lines 41612 41664 +52
Branches 2286 2291 +5
=======================================
+ Hits 40880 40933 +53
Misses 557 557
+ Partials 175 174 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Backport to 3.11: 💚 backport PR created✅ Backport PR branch: Backported as #11076 🤖 @patchback |
Backport to 3.12: 💚 backport PR created✅ Backport PR branch: Backported as #11077 🤖 @patchback |
…nections to close (#11076) Co-authored-by: J. Nick Koston <[email protected]> fixes #1925 fixes #3736
…nections to close (#11077) Co-authored-by: J. Nick Koston <[email protected]> fixes #1925 fixes #3736
|
I recommend editing the release notes for v3.13.0 to mention this bugfix, since it's fairly important. |
|
Hmm, where did that change fragment go? It wasn't in the branch during release.. |
|
Oh, no, this is already released previously: |
Strange, it's in the least of commit differences between 3.12.15 and 3.13.0: v3.12.15...v3.13.0 |
Upgrading aiohttp to at least 3.12.4. This includes aio-libs/aiohttp#11074 which fixes connections not being immediately closed (which potentially results in us exhausting our connections if we open a lot in a short span of time). --------- Co-authored-by: Jinying Li <[email protected]>
What do these changes do?
This PR fixes an issue where
BaseConnector.close()would return immediately without waiting for connections to actually close. This is a partial backport of #3733 that includes only the bug fix without any breaking API changes.The fix ensures that
close()properly waits for all connection closures to complete by:proto.closedfutures from connections being closedasyncio.gather()to wait for all closures to completeAre there changes in behavior for the user?
No breaking changes. The
close()method will now properly wait for connections to close as expected, which is the correct behavior. The method continues to return an awaitable that emits a deprecation warning if not awaited.Note: When using the connector as a non-async context manager (deprecated pattern), the issue of not waiting for connections to close still remains. This is because
__exit__calls_close()synchronously and cannot await the connection closures. Users should use the async context manager pattern (async with) instead. We cannot remove the sync context manager in 3.x as that would be a breaking change.Related issue number
Partial backport of #3733
fixes #1925 fixes #3736
Checklist
CONTRIBUTORS.txtCHANGES/folde