[Python-modules-team] Bug#830839: ConnectionError: ('Connection aborted.', ResponseNotReady()) when using Session interface

Roland Hieber rohieb at rohieb.name
Tue Jul 12 05:43:49 UTC 2016


Package: python-requests
Version: 2.10.0-2
Severity: important

Dear Maintainer,

if I try to re-use my requests.Session objects for more than one GET, I
get the above mentioned ConnectionError. Wireshark shows that my client
is sending a TCP RST segment to the server. I'm not sure whether this is
a bug in requests itself, or the underlying urllib3, or something else
on my system.

Here is my minimal, reproducable example:

	$ python
	Python 2.7.12 (default, Jun 29 2016, 08:18:26) 
	[GCC 5.4.0 20160609] on linux2
	Type "help", "copyright", "credits" or "license" for more information.
	>>> import requests
	>>> session = requests.Session()
	>>> url="http://rohieb.name"
	>>> while True:
	...     print(url)
	...     r = session.get(url)
	... 
	http://rohieb.name
	http://rohieb.name
	Traceback (most recent call last):
		File "<stdin>", line 3, in <module>
		File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 477, in get
			return self.request('GET', url, **kwargs)
		File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 465, in request
			resp = self.send(prep, **send_kwargs)
		File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 573, in send
			r = adapter.send(request, **kwargs)
		File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 415, in send
			raise ConnectionError(err, request=request)
	requests.exceptions.ConnectionError: ('Connection aborted.', ResponseNotReady())
	>>> 

This behaviour is not present in a fresh virtualenv, which uses Python
2.7.12, requests 2.10.0, and urllib3 1.15.1 (multiple get() calls work
normally here).  A quick test shows that it also does not happen on
stable, but unfortunately, I don't have another testing/sid system to
reproduce this.

Cheers,

  Roland



-- System Information:
Debian Release: stretch/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'testing-debug'), (500, 'testing'), (170, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.5.0-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages python-requests depends on:
ii  ca-certificates  20160104
ii  python-chardet   2.3.0-2
ii  python-urllib3   1.15.1-2
pn  python:any       <none>

python-requests recommends no packages.

Versions of packages python-requests suggests:
pn  python-ndg-httpsclient  <none>
ii  python-openssl          16.0.0-1
ii  python-pyasn1           0.1.9-1
pn  python-socks            <none>

-- debconf-show failed



More information about the Python-modules-team mailing list