ConnectionResetError in test_closes_connection_without_content_length

778 views
Skip to first unread message

Zhiqiang Liu

unread,
Sep 19, 2017, 11:00:57 PM9/19/17
to Django developers (Contributions to Django itself)
I run the test suits for master and get the following error.

Traceback (most recent call last):
  File "/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/unittest/case.py", line 58, in testPartExecutor
    yield
  File "/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/unittest/case.py", line 577, in run
    testMethod()
  File "/Users/ZachLiu/CS/Python/Projects/Django/django/django/test/utils.py", line 371, in inner
    return func(*args, **kwargs)
  File "/Users/ZachLiu/CS/Python/Projects/Django/django/tests/servers/tests.py", line 80, in test_closes_connection_without_content_length
    conn.getresponse()
  File "/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/http/client.py", line 1171, in getresponse
    response.begin()
  File "/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/http/client.py", line 351, in begin
    version, status, reason = self._read_status()
  File "/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/http/client.py", line 313, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/socket.py", line 374, in readinto
    return self._sock.recv_into(b)
ConnectionResetError: [Errno 54] Connection reset by peer

Is there anything I missed? Anyone can help?

Adam Johnson

unread,
Sep 20, 2017, 5:15:03 AM9/20/17
to django-d...@googlegroups.com
Hi Zhiqiang

It's hard to tell what the problem is with more details. From your traceback it looks like you're running Python3.4 on MacOS but there's no indication of your database or other settings.

If you run the tests on the 1.11 branch, does it pass? If so, you can bisect to find the regression and report that as a proper bug, instructions here: https://docs.djangoproject.com/en/dev/internals/contributing/triaging-tickets/#bisecting-a-regression

Otherwise, more information is needed to debug.

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscribe@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/9b97b2a3-160f-4c34-b4fd-c447cd1f6895%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Adam

Tom Forbes

unread,
Sep 20, 2017, 7:28:47 AM9/20/17
to django-d...@googlegroups.com
I added this test for the keep-alive release blocker. It's possible that the exceptions raised in that test vary by OS at least on 3.4, the docs suggest that it should throw BadStatusLine instead.

ConnectionResetError is also a correct exception to raise in that specific case, we should just add that to the try/catch statement I think.

Zhiqiang Liu

unread,
Sep 20, 2017, 8:39:23 PM9/20/17
to Django developers (Contributions to Django itself)
Yeah I believe it is a new test, so I can't test if it is working for 1.11.

I did get it to pass after adding except like this

         try:
            conn.request('GET', '/example_view/', headers={'Connection': 'keep-alive'})
            response = conn.getresponse().read()
            conn.request('GET', '/example_view/', headers={'Connection': 'close'})
            with self.assertRaises(RemoteDisconnected, msg='Server did not close the connection'):
                try:
                    conn.getresponse()
                except ConnectionAbortedError:
                    if sys.platform == 'win32':
                        self.skipTest('Ignore nondeterministic failure on Windows.')
                except ConnectionResetError:
                    self.skipTest('Ignore failure.')

Tom because you said it varies by OS, so I am not sure which message to add so I just used 'Ignore failure', should I use something else? I can submit a simple PR for that.

Zhiqiang Liu

unread,
Sep 21, 2017, 9:35:05 PM9/21/17
to Django developers (Contributions to Django itself)
To follow up, I set up a new macbook pro today with python3.6 and OXS10.12, and I got the same error.

Chris Foresman

unread,
Sep 22, 2017, 7:52:53 AM9/22/17
to Django developers (Contributions to Django itself)
The problem is the version of SQLite included in recent versions of macOS. The easiest fix we saw was installing Homebrew and then doing a `brew install sqlite`.

Zhiqiang Liu

unread,
Sep 22, 2017, 9:34:10 PM9/22/17
to Django developers (Contributions to Django itself)
Hi Chris, 

I did installed sqlite through brew install sqlite, the error still happens.
Reply all
Reply to author
Forward
0 new messages