python / asyncio

asyncio historical repository
https://docs.python.org/3/library/asyncio.html
1.04k stars 177 forks source link

Improve handling of stale fds for SelectSelector #419

Closed sethmlarson closed 8 years ago

sethmlarson commented 8 years ago

Made SelectSelector more resilient to stale file descriptors which would result in strange outcomes such as in Issue #367. Removed using select.select directly as non-Windows SelectSelector (should?) break in the same situation as Issue #367 if SelectSelector were the default on a non-Windows platform as well. Added a new test for a stale file descriptor for all SelectSelectors.

gvanrossum commented 8 years ago

Meta-comment: the selectors module is not a part of asyncio -- it's in the stdlib (we just bundled it for the convenience of Python 3.3 users).

sethmlarson commented 8 years ago

@gvanrossum Oh, well that makes things interesting. Is there perhaps a way to allow the use of our own SelectSelector if it's on Windows? Because as it stands that select cannot handle stale fds.

sethmlarson commented 8 years ago

Fixed a quick bug where if all the watched fds were stale Windows would lock up. Hopefully that'll pass on AppVeyor.

1st1 commented 8 years ago

@gvanrossum Oh, well that makes things interesting. Is there perhaps a way to allow the use of our own SelectSelector if it's on Windows? Because as it stands that select cannot handle stale fds.

What Guido meant was that you should file this bug to http://bugs.python.org since selectors module isn't part of asyncio (it's only included in this repo for compatibility with Python 3.3). That's how the process is defined for now.

sethmlarson commented 8 years ago

@1st1 Shame, git/GitHub is hard enough to use on Windows. I don't really want to get Mercurial just for one small patch just to have CPython switch back to GitHub. I guess close this PR.

1st1 commented 8 years ago

@1st1 Shame, git/GitHub is hard enough to use on Windows. I don't really want to get Mercurial just for one small patch just to have CPython switch back to GitHub. I guess close this PR.

Well, CPython repo will be migrated to GitHub in a couple of months. If this PR fixes a bug, please at least open an issue and attach the patch on bugs.python.org. I don't have capacity to review your PR in the next couple of weeks :(

sethmlarson commented 8 years ago

@1st1 Does fix a bug, I'll open an issue there.

1st1 commented 8 years ago

@SethMichaelLarson so did you open an issue on bugs.python.org for this?