Skip to content

Revert: Close the socket if there's a failure in start_connection() #10464 #10656

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

Merged
merged 3 commits into from
Apr 1, 2025

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Apr 1, 2025

Reverts #10464

While this change improved the situation for uvloop users, it caused a regression with SelectorEventLoop (issue #10617)

The alternative fix is MagicStack/uvloop#646 (not merged at the time of this PR)

issue #10617 appears to be very similar to python/cpython@d5aeccf

If someone can come up with a working reproducer for #10617 we can revisit this.
cc @top-oai

Minimal implementation that shows on cancellation the socket is cleaned up without the explicit close #10617 (comment) so this should be unneeded unless I've missed something (very possible with all the moving parts here)

Related issue number

fixes #10617

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Apr 1, 2025
@bdraco bdraco added backport-3.11 Trigger automatic backporting to the 3.11 release branch by Patchback robot backport-3.12 Trigger automatic backporting to the 3.12 release branch by Patchback robot labels Apr 1, 2025
Copy link

codspeed-hq bot commented Apr 1, 2025

CodSpeed Performance Report

Merging #10656 will not alter performance

Comparing revert_10464 (bb63909) with master (8c4e60b)

Summary

✅ 51 untouched benchmarks

Copy link

codecov bot commented Apr 1, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.71%. Comparing base (8c4e60b) to head (bb63909).
Report is 4 commits behind head on master.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10656      +/-   ##
==========================================
- Coverage   98.71%   98.71%   -0.01%     
==========================================
  Files         125      125              
  Lines       37462    37439      -23     
  Branches     2076     2076              
==========================================
- Hits        36980    36957      -23     
  Misses        335      335              
  Partials      147      147              
Flag Coverage Δ
CI-GHA 98.59% <100.00%> (-0.01%) ⬇️
OS-Linux 98.25% <100.00%> (-0.01%) ⬇️
OS-Windows 96.19% <100.00%> (-0.01%) ⬇️
OS-macOS 97.36% <100.00%> (-0.01%) ⬇️
Py-3.10.11 97.27% <100.00%> (-0.01%) ⬇️
Py-3.10.16 97.77% <100.00%> (-0.06%) ⬇️
Py-3.11.11 97.90% <100.00%> (-0.01%) ⬇️
Py-3.11.9 95.85% <100.00%> (-1.51%) ⬇️
Py-3.12.9 98.33% <100.00%> (-0.04%) ⬇️
Py-3.13.2 98.34% <100.00%> (-0.01%) ⬇️
Py-3.9.13 97.14% <100.00%> (-0.01%) ⬇️
Py-3.9.21 97.68% <100.00%> (-0.01%) ⬇️
Py-pypy7.3.16 86.05% <100.00%> (-11.22%) ⬇️
VM-macos 97.36% <100.00%> (-0.01%) ⬇️
VM-ubuntu 98.25% <100.00%> (-0.01%) ⬇️
VM-windows 96.19% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bdraco bdraco marked this pull request as ready for review April 1, 2025 02:34
@bdraco bdraco requested review from webknjaz and asvetlov as code owners April 1, 2025 02:34
@bdraco bdraco merged commit 06db052 into master Apr 1, 2025
65 of 71 checks passed
@bdraco bdraco deleted the revert_10464 branch April 1, 2025 02:51
Copy link
Contributor

patchback bot commented Apr 1, 2025

Backport to 3.11: 💚 backport PR created

✅ Backport PR branch: patchback/backports/3.11/06db052eae399de1c7c34c0122d736e06c045ec7/pr-10656

Backported as #10657

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Apr 1, 2025
…10464 (#10656)

Reverts #10464

While this change improved the situation for uvloop users, it caused a
regression with `SelectorEventLoop` (issue #10617)

The alternative fix is MagicStack/uvloop#646
(not merged at the time of this PR)

issue #10617 appears to be very similar to
python/cpython@d5aeccf

If someone can come up with a working reproducer for #10617 we can
revisit this.
cc @top-oai

Minimal implementation that shows on cancellation the socket is cleaned
up without the explicit `close`
#10617 (comment)
so this should be unneeded unless I've missed something (very possible
with all the moving parts here)

## Related issue number

fixes #10617

(cherry picked from commit 06db052)
Copy link
Contributor

patchback bot commented Apr 1, 2025

Backport to 3.12: 💚 backport PR created

✅ Backport PR branch: patchback/backports/3.12/06db052eae399de1c7c34c0122d736e06c045ec7/pr-10656

Backported as #10658

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Apr 1, 2025
…10464 (#10656)

Reverts #10464

While this change improved the situation for uvloop users, it caused a
regression with `SelectorEventLoop` (issue #10617)

The alternative fix is MagicStack/uvloop#646
(not merged at the time of this PR)

issue #10617 appears to be very similar to
python/cpython@d5aeccf

If someone can come up with a working reproducer for #10617 we can
revisit this.
cc @top-oai

Minimal implementation that shows on cancellation the socket is cleaned
up without the explicit `close`
#10617 (comment)
so this should be unneeded unless I've missed something (very possible
with all the moving parts here)

## Related issue number

fixes #10617

(cherry picked from commit 06db052)
bdraco added a commit that referenced this pull request Apr 1, 2025
…'s a failure in start_connection() #10464 (#10657)

**This is a backport of PR #10656 as merged into master
(06db052).**

Reverts #10464

While this change improved the situation for uvloop users, it caused a
regression with `SelectorEventLoop` (issue #10617)

The alternative fix is MagicStack/uvloop#646
(not merged at the time of this PR)

issue #10617 appears to be very similar to
python/cpython@d5aeccf

If someone can come up with a working reproducer for #10617 we can
revisit this.
cc @top-oai

Minimal implementation that shows on cancellation the socket is cleaned
up without the explicit `close`
#10617 (comment)
so this should be unneeded unless I've missed something (very possible
with all the moving parts here)

## Related issue number

fixes #10617

Co-authored-by: J. Nick Koston <[email protected]>
bdraco pushed a commit that referenced this pull request Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-3.11 Trigger automatic backporting to the 3.11 release branch by Patchback robot backport-3.12 Trigger automatic backporting to the 3.12 release branch by Patchback robot bot:chronographer:provided There is a change note present in this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BlockingIOError and File descriptor xx is used by transport
1 participant