#29849: Remote end closed connection without response
-----------------------------------------+------------------------
               Reporter:  rvernica       |          Owner:  nobody
                   Type:  Uncategorized  |         Status:  new
              Component:  Uncategorized  |        Version:  2.1
               Severity:  Normal         |       Keywords:
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
                  UI/UX:  0              |
-----------------------------------------+------------------------
 I created an app like in the tutorial and started Django. When I issue
 successive requests, the session gets disconnected. Here is an example:
 {{{
 >>> s = requests.Session()
 >>> s.get('http://localhost:8000/'); s.get('http://localhost:8000')
 <Response [404]>
 Traceback (most recent call last):
   File "...local/lib/python3.6/site-packages/urllib3/connectionpool.py",
 line 600, in urlopen
     chunked=chunked)
   File "...local/lib/python3.6/site-packages/urllib3/connectionpool.py",
 line 384, in _make_request
     six.raise_from(e, None)
   File "<string>", line 2, in raise_from
   File "...local/lib/python3.6/site-packages/urllib3/connectionpool.py",
 line 380, in _make_request
     httplib_response = conn.getresponse()
   File "/usr/lib64/python3.6/http/client.py", line 1331, in getresponse
     response.begin()
   File "/usr/lib64/python3.6/http/client.py", line 297, in begin
     version, status, reason = self._read_status()
   File "/usr/lib64/python3.6/http/client.py", line 266, in _read_status
     raise RemoteDisconnected("Remote end closed connection without"
 http.client.RemoteDisconnected: Remote end closed connection without
 response

 During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "...local/lib/python3.6/site-packages/requests/adapters.py", line
 445, in send
     timeout=timeout
   File "...local/lib/python3.6/site-packages/urllib3/connectionpool.py",
 line 638, in urlopen
     _stacktrace=sys.exc_info()[2])
   File "...local/lib/python3.6/site-packages/urllib3/util/retry.py", line
 367, in increment
     raise six.reraise(type(error), error, _stacktrace)
   File "...local/lib/python3.6/site-packages/urllib3/packages/six.py",
 line 685, in reraise
     raise value.with_traceback(tb)
   File "...local/lib/python3.6/site-packages/urllib3/connectionpool.py",
 line 600, in urlopen
     chunked=chunked)
   File "...local/lib/python3.6/site-packages/urllib3/connectionpool.py",
 line 384, in _make_request
     six.raise_from(e, None)
   File "<string>", line 2, in raise_from
   File "...local/lib/python3.6/site-packages/urllib3/connectionpool.py",
 line 380, in _make_request
     httplib_response = conn.getresponse()
   File "/usr/lib64/python3.6/http/client.py", line 1331, in getresponse
     response.begin()
   File "/usr/lib64/python3.6/http/client.py", line 297, in begin
     version, status, reason = self._read_status()
   File "/usr/lib64/python3.6/http/client.py", line 266, in _read_status
     raise RemoteDisconnected("Remote end closed connection without"
 urllib3.exceptions.ProtocolError: ('Connection aborted.',
 RemoteDisconnected('Remote end closed connection without response',))

 During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "...local/lib/python3.6/site-packages/requests/sessions.py", line
 525, in get
     return self.request('GET', url, **kwargs)
   File "...local/lib/python3.6/site-packages/requests/sessions.py", line
 512, in request
     resp = self.send(prep, **send_kwargs)
   File "...local/lib/python3.6/site-packages/requests/sessions.py", line
 622, in send
     r = adapter.send(request, **kwargs)
   File "...local/lib/python3.6/site-packages/requests/adapters.py", line
 495, in send
     raise ConnectionError(err, request=request)
 requests.exceptions.ConnectionError: ('Connection aborted.',
 RemoteDisconnected('Remote end closed connection without response',))
 }}}

 It I have a small timeout between the requests it works fine:
 {{{
 >>> s = requests.Session()
 >>> s.get('http://localhost:8000/'); time.sleep(1);
 s.get('http://localhost:8000')
 <Response [404]>
 <Response [404]>
 }}}

 It also works fine if I don't use sessions:
 {{{
 >>> requests.get('http://localhost:8000/');
 requests.get('http://localhost:8000')
 <Response [404]>
 <Response [404]>
 }}}

 I initially reported this as a bug in the `requests` library but it does
 not appear to be the case. See discussion here
 https://github.com/requests/requests/issues/4784

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29849>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.998425bc2abf2d1a96c83eadb8937f80%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to