Skip to content

bpo-33263: Fix FD leak in _SelectorSocketTransport#6450

Merged
asvetlov merged 2 commits intopython:masterfrom
drtyrsa:bpo-33263
May 21, 2018
Merged

bpo-33263: Fix FD leak in _SelectorSocketTransport#6450
asvetlov merged 2 commits intopython:masterfrom
drtyrsa:bpo-33263

Conversation

@drtyrsa
Copy link
Copy Markdown
Contributor

@drtyrsa drtyrsa commented Apr 11, 2018

Under particular circumstances _SelectorSocketTransport can try to add a reader
even the transport is already being closed. This can lead to FD leak and
invalid stated of the following connections. Fixed the SelectorSocketTransport
to add the reader only if the trasport is still active.

https://bugs.python.org/issue33263

@the-knights-who-say-ni
Copy link
Copy Markdown

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Unfortunately our records indicate you have not signed the CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

Thanks again to your contribution and we look forward to looking at it!

Under particular circumstances _SelectorSocketTransport can try to add a reader
even the transport is already being closed. This can lead to FD leak and
invalid stated of the following connections. Fixed the SelectorSocketTransport
to add the reader only if the trasport is still active.
@1st1
Copy link
Copy Markdown
Member

1st1 commented Apr 11, 2018

Out of curiosity, have you tried this with uvloop?

@drtyrsa
Copy link
Copy Markdown
Contributor Author

drtyrsa commented Apr 12, 2018

@1st1 I can't reproduce the bug using uvloop, I guess it handles this situation fine.

@ned-deily
Copy link
Copy Markdown
Member

@drtyrsa Please let us know here when you have submitted a contributor agreement. There seem to be some problems right now with the PSF auto-receiving notifications about submitted agreements so we may need to notify them.

@drtyrsa
Copy link
Copy Markdown
Contributor Author

drtyrsa commented Apr 13, 2018

@ned-deily I've signed and submitted it on 11th of April. I'll remove the label when I see an asterisk near my username in the bug tracker.

@ned-deily
Copy link
Copy Markdown
Member

We got your contributor agreement properly registered so this should now be good to go.

@drtyrsa
Copy link
Copy Markdown
Contributor Author

drtyrsa commented Apr 16, 2018

@ned-deily Do I need to do something else to get it merged? Or it's going to happen automatically?

@ned-deily
Copy link
Copy Markdown
Member

@drtyrsa One of the asyncio core-devs should merge it if they are happy with it. @1st1 @asvetlov

@asvetlov asvetlov merged commit a84d0b3 into python:master May 21, 2018
@miss-islington
Copy link
Copy Markdown
Contributor

Thanks @drtyrsa for the PR, and @asvetlov for merging it 🌮🎉.. I'm working now to backport this PR to: 3.6, 3.7.
🐍🍒⛏🤖

@bedevere-bot
Copy link
Copy Markdown

GH-7022 is a backport of this pull request to the 3.7 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 21, 2018
* bpo-33263 Fix FD leak in _SelectorSocketTransport. (pythonGH-6450)

Under particular circumstances _SelectorSocketTransport can try to add a reader
even the transport is already being closed. This can lead to FD leak and
invalid stated of the following connections. Fixed the SelectorSocketTransport
to add the reader only if the trasport is still active.
(cherry picked from commit a84d0b3)

Co-authored-by: Vlad Starostin <drtyrsa@yandex.ru>
@miss-islington
Copy link
Copy Markdown
Contributor

Sorry, @drtyrsa and @asvetlov, I could not cleanly backport this to 3.6 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker a84d0b361a26c05c6fadc6640591ec3feee5bfb5 3.6

@drtyrsa drtyrsa deleted the bpo-33263 branch May 21, 2018 08:24
asvetlov pushed a commit that referenced this pull request May 21, 2018
* bpo-33263 Fix FD leak in _SelectorSocketTransport. (GH-6450)

Under particular circumstances _SelectorSocketTransport can try to add a reader
even the transport is already being closed. This can lead to FD leak and
invalid stated of the following connections. Fixed the SelectorSocketTransport
to add the reader only if the trasport is still active.
(cherry picked from commit a84d0b3)

Co-authored-by: Vlad Starostin <drtyrsa@yandex.ru>
asvetlov pushed a commit to asvetlov/cpython that referenced this pull request May 21, 2018
* bpo-33263 Fix FD leak in _SelectorSocketTransport. (pythonGH-6450)

Under particular circumstances _SelectorSocketTransport can try to add a reader
even the transport is already being closed. This can lead to FD leak and
invalid stated of the following connections. Fixed the SelectorSocketTransport
to add the reader only if the trasport is still active..
(cherry picked from commit a84d0b3)
@bedevere-bot
Copy link
Copy Markdown

GH-7025 is a backport of this pull request to the 3.6 branch.

asvetlov added a commit that referenced this pull request May 21, 2018
…7025)

* bpo-33263 Fix FD leak in _SelectorSocketTransport. (GH-6450)

Under particular circumstances _SelectorSocketTransport can try to add a reader
even the transport is already being closed. This can lead to FD leak and
invalid stated of the following connections. Fixed the SelectorSocketTransport
to add the reader only if the trasport is still active..
(cherry picked from commit a84d0b3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants