-
Notifications
You must be signed in to change notification settings - Fork 935
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
urllib3 doesn’t raise ReadTimeoutError when monkey patched. #644
Comments
Can you simplify the scenario to not use a third-party library? The presence of a third-party library makes things much more complicated. |
I’ll try to come up with a bare socket example that isn’t doing anything different. For what it’s worth, you can wrap your request in a |
Here’s the behavior with a bare socket: nc -l 1337 # Listen on 1337 and keep the connection open. Without Gevent: >>> import socket
>>> sock = socket.create_connection(('localhost', 1337), 1)
>>> fp = sock.makefile('rb', 0)
>>> fp.read()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/Cellar/python/2.7.10/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 355, in read
data = self._sock.recv(rbufsize)
socket.timeout: timed out With Gevent: >>> from gevent import monkey
>>> monkey.patch_socket()
>>>
>>> import socket
>>> sock = socket.create_connection(('localhost', 1337), 1)
>>> fp = sock.makefile('rb', 0)
>>> fp.read() # Hangs indefinitely. Note that |
Thanks for the report. I can reproduce this under Python 2, but I can't reproduce it under Python 3 (the expected timeout is raised under Python 3). The expected timeout is also raised for Python 2 with gevent 1.0.2, so this is a regression somewhere. |
Gevent v1.1b3 with Python 2.7.6.
nc -l 1337 # Listen on 1337 and keep the connection open.
Without Gevent:
With Gevent:
The text was updated successfully, but these errors were encountered: