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
ValueError: filedescriptor out of range in select() in urllib3 #589
Comments
Affects requests made to SSL servers running in the same thread via green threads. http://stackoverflow.com/questions/19109436/gevent-ssl-wsgiserver-blocks-when-it-shouldnt
Any updates on this issue? |
select.poll is preferable when it is available. Unfortunately it isn't available on every operating system but select.select is, so we can wrap the logic to fall back to select.select from select.poll in helper functions in urllib3.util. Closes urllib3#589
select.poll is preferable when it is available. Unfortunately it isn't available on every operating system but select.select is, so we can wrap the logic to fall back to select.select from select.poll in helper functions in urllib3.util. Closes urllib3#589
Any updates? |
@sigmavirus24 @Lukasa I'm gone for a few days, could one of you take a look please? :D |
Last I checked we were still waiting on #685 to get cleaned up. |
Comments on the pull request indicate there were problems with it passing tests and also some design discussions to be had. I can look at the tests part, at least. |
In the meantime, a workaround that seems to have addressed this for me is removing the |
Any updates? |
On non-Windows platforms (or any platform with a better selector than |
We are using requests library in our code and after recent urllib3 upgrade we've started seeing following errors in logs on our testing servers:
What it basically means is that
sock
that is passed to select[1] is>= 1024
. That may happen for example if application opens 1024 files on start and then getsOpenSSL.SSL.WantReadError
during TLS handshake while using urllib3.Regression was introduced in: a49bec5 [pyopenssl: wait for data before handshake retry]
Simple fix is to factor out functionality for poll -> select fallback from https://github.com/shazow/urllib3/blob/master/urllib3/util/connection.py#L12 and replace all
select.select()
calls in urllib3 with it.[1]
select(2)
is bound toFD_SETSIZE
fds which equals to 1024 on most UNIX systems: http://pubs.opengroup.org/onlinepubs/007908799/xsh/select.htmlThe text was updated successfully, but these errors were encountered: