-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Keep-alive broken in 1.10.3 with chunked transfer-encoding #598
Comments
Thanks @lmikkelsen |
Yeh I am also having same issue is there a solution for this? |
We're working on it. =) Keep an eye on this issue for more.
|
It seems like this is broken in mechanize as well. |
I get a similar exception with the following script, but the traceback is different:
Start of traceback (full):
Happening with Python 3.4.3 |
Please don't print the start of the traceback, it's irrelevant. Print the end of it. =D |
To be clear @untitaker, your traceback is different because you've got Python 3 printing the chained exceptions. If the others users did, they'd show the same traceback as you. |
Here is my traceback using urllib2: |
So using just urllib3, I'm having trouble reproducing this. The following is more-or-less what an adapter does in requests import urllib3
url = 'http://httpbin.org/stream/20'
http = urllib3.PoolManager(
block=False,
num_pools=10,
maxsize=10,
strict=True,
)
conn = http.connection_from_url(url)
response = conn.urlopen(
method='GET',
url=url,
headers={
'Connection': 'keep-alive',
'Accept-Encoding': 'gzip, compress',
},
preload_content=False,
decode_content=False,
)
list(response.stream())
response = conn.urlopen(
method='GET',
url=url,
headers={
'Connection': 'keep-alive',
'Accept-Encoding': 'gzip, compress',
},
preload_content=False,
decode_content=False,
)
list(response.stream()) |
53a1e6a is the culprit. |
@t-8ch do we really think closing the connection is the right thing to do here? Edit that does fix the issue though |
@sigmavirus24 I don't think so. But somehow httplib has to be conviced, that we are done with this response. |
Doing if self._original_response is not None:
self._original_response.fp = None
self.release_conn() fixes the bug but is missing testcoverage |
@sigmavirus24 It seems even weirder. Running your example from upthread shows me three requests on two sockets in wireshark. Using |
Yeah, ofc retries... So requests disables retries which explains the differences. |
Also: @lmikkelsen Did you run into this problem using httpbin? |
FIXME better description
To be clear, you can reproduce this with: import urllib3
url = 'http://httpbin.org/stream/20'
http = urllib3.PoolManager(
block=False,
num_pools=10,
maxsize=10,
strict=True,
retries=0,
)
conn = http.connection_from_url(url)
response = conn.urlopen(
method='GET',
url=url,
headers={
'Connection': 'keep-alive',
'Accept-Encoding': 'gzip, compress',
},
preload_content=False,
decode_content=False,
)
list(response.stream())
response = conn.urlopen(
method='GET',
url=url,
headers={
'Connection': 'keep-alive',
'Accept-Encoding': 'gzip, compress',
},
preload_content=False,
decode_content=False,
)
list(response.stream()) For some reason I thought we were using something like 5 for the retries value. |
Per kennethreitz/requests#2568, starting in urllib3 1.10.3 an exception is thrown if a connection with chunked transfer-encoding is reused.
The text was updated successfully, but these errors were encountered: