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

test_HTTP11_pipelining failing on Python 3.3+ #1315

Closed
bb-migration opened this Issue May 3, 2014 · 6 comments

Comments

Projects
None yet
1 participant
@bb-migration

bb-migration commented May 3, 2014

Originally reported by: Mike Gilbert (Bitbucket: floppym, GitHub: floppym)


This seems to happen randomly with python3.3 and python3.4.

======================================================================
ERROR: test_HTTP11_pipelining (cherrypy.test.test_conn.PipelineTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/floppym/src/cherrypy/cherrypy/test/test_conn.py", line 432, in test_HTTP11_pipelining
    response.begin()
  File "/usr/lib64/python3.3/http/client.py", line 358, in begin
    version, status, reason = self._read_status()
  File "/usr/lib64/python3.3/http/client.py", line 328, in _read_status
    raise BadStatusLine(line)
nose.proxy.BadStatusLine: ''
-------------------- >> begin captured logging << --------------------
cherrypy.access.140468382781008: INFO: 127.0.0.1 - - [03/May/2014:12:46:00] "GET /hello HTTP/1.1" 200 13 "" ""
cherrypy.access.140468382781008: INFO: 127.0.0.1 - - [03/May/2014:12:46:00] "GET /hello HTTP/1.1" 200 13 "" ""
cherrypy.access.140468382781008: INFO: 127.0.0.1 - - [03/May/2014:12:46:00] "GET /hello HTTP/1.1" 200 13 "" ""
cherrypy.access.140468382781008: INFO: 127.0.0.1 - - [03/May/2014:12:46:00] "GET /hello HTTP/1.1" 200 13 "" ""
cherrypy.access.140468382781008: INFO: 127.0.0.1 - - [03/May/2014:12:46:00] "GET /hello HTTP/1.1" 200 13 "" ""
cherrypy.access.140468382781008: INFO: 127.0.0.1 - - [03/May/2014:12:46:00] "GET /hello HTTP/1.1" 200 13 "" ""
--------------------- >> end captured logging << ---------------------

@bb-migration

This comment has been minimized.

Show comment
Hide comment
@bb-migration

bb-migration May 16, 2014

Original comment by idella5 (Bitbucket: idella5, GitHub: idella5):


this appears to be a nose issue. running under nose-1.3.3 yields;

~/cvsPortage/gentoo-x86/dev-python/cherrypy $ grep test_HTTP11_pipelining /mnt/gen2/TmpDir/portage/dev-python/cherrypy-3.3.0/temp/build.log
test_HTTP11_pipelining (cherrypy.test.test_conn.PipelineTests) ... ok

for both py3.3 and py3.4.

bb-migration commented May 16, 2014

Original comment by idella5 (Bitbucket: idella5, GitHub: idella5):


this appears to be a nose issue. running under nose-1.3.3 yields;

~/cvsPortage/gentoo-x86/dev-python/cherrypy $ grep test_HTTP11_pipelining /mnt/gen2/TmpDir/portage/dev-python/cherrypy-3.3.0/temp/build.log
test_HTTP11_pipelining (cherrypy.test.test_conn.PipelineTests) ... ok

for both py3.3 and py3.4.

@bb-migration

This comment has been minimized.

Show comment
Hide comment
@bb-migration

bb-migration Jun 30, 2014

Original comment by Barry Warsaw (Bitbucket: warsaw, GitHub: warsaw):


I'm not sure it's a nose problem. I'm seeing this too in my Debian package tests

#!python

======================================================================
ERROR: test_HTTP11_pipelining (cherrypy.test.test_conn.PipelineTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/adt-run.VKFi2I/dsc0-build/cherrypy3-3.5.0/cherrypy/test/test_conn.py", line 444, in test_HTTP11_pipelining
    response.begin()
  File "/usr/lib/python3.4/http/client.py", line 351, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.4/http/client.py", line 321, in _read_status
    raise BadStatusLine(line)
nose.proxy.BadStatusLine: ''

CherryPy 3.5.0 and nose 1.3.3.

bb-migration commented Jun 30, 2014

Original comment by Barry Warsaw (Bitbucket: warsaw, GitHub: warsaw):


I'm not sure it's a nose problem. I'm seeing this too in my Debian package tests

#!python

======================================================================
ERROR: test_HTTP11_pipelining (cherrypy.test.test_conn.PipelineTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/adt-run.VKFi2I/dsc0-build/cherrypy3-3.5.0/cherrypy/test/test_conn.py", line 444, in test_HTTP11_pipelining
    response.begin()
  File "/usr/lib/python3.4/http/client.py", line 351, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.4/http/client.py", line 321, in _read_status
    raise BadStatusLine(line)
nose.proxy.BadStatusLine: ''

CherryPy 3.5.0 and nose 1.3.3.

@bb-migration

This comment has been minimized.

Show comment
Hide comment
@bb-migration

bb-migration Feb 6, 2016

Original comment by Jason R. Coombs (Bitbucket: jaraco, GitHub: jaraco):


I think the issue is intermittent and has different failure modes. Using Python 3.5.1, I'm getting these results on different runs:

======================================================================
ERROR: test_HTTP11_pipelining (cherrypy.test.test_conn.PipelineTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/test/test_conn.py", line 436, in test_HTTP11_pipelining
    response.begin()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 282, in begin
    version, status, reason = self._read_status()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 264, in _read_status
    raise BadStatusLine(line)
http.client.BadStatusLine: Hello, world!HTTP/1.1 200 OK

-------------------- >> begin captured logging << --------------------
cherrypy.access.4354739840: INFO: 127.0.0.1 - - [06/Feb/2016:07:59:48] "GET /hello HTTP/1.1" 200 13 "" ""
cherrypy.access.4354739840: INFO: 127.0.0.1 - - [06/Feb/2016:07:59:48] "GET /hello HTTP/1.1" 200 13 "" ""
cherrypy.access.4354739840: INFO: 127.0.0.1 - - [06/Feb/2016:07:59:48] "GET /hello HTTP/1.1" 200 13 "" ""
--------------------- >> end captured logging << ---------------------
======================================================================
ERROR: test_HTTP11_pipelining (cherrypy.test.test_conn.PipelineTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/test/test_conn.py", line 444, in test_HTTP11_pipelining
    response.begin()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 282, in begin
    version, status, reason = self._read_status()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 251, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response
-------------------- >> begin captured logging << --------------------
cherrypy.access.4355282984: INFO: 127.0.0.1 - - [06/Feb/2016:08:09:17] "GET /hello HTTP/1.1" 200 13 "" ""
cherrypy.access.4355282984: INFO: 127.0.0.1 - - [06/Feb/2016:08:09:17] "GET /hello HTTP/1.1" 200 13 "" ""
cherrypy.access.4355282984: INFO: 127.0.0.1 - - [06/Feb/2016:08:09:17] "GET /hello HTTP/1.1" 200 13 "" ""
cherrypy.access.4355282984: INFO: 127.0.0.1 - - [06/Feb/2016:08:09:17] "GET /hello HTTP/1.1" 200 13 "" ""
cherrypy.access.4355282984: INFO: 127.0.0.1 - - [06/Feb/2016:08:09:17] "GET /hello HTTP/1.1" 200 13 "" ""
cherrypy.access.4355282984: INFO: 127.0.0.1 - - [06/Feb/2016:08:09:17] "GET /hello HTTP/1.1" 200 13 "" ""
--------------------- >> end captured logging << ---------------------
======================================================================
ERROR: test_HTTP11_pipelining (cherrypy.test.test_conn.PipelineTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/test/test_conn.py", line 437, in test_HTTP11_pipelining
    response.begin()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 282, in begin
    version, status, reason = self._read_status()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 264, in _read_status
    raise BadStatusLine(line)
http.client.BadStatusLine: Hello, world!HTTP/1.1 200 OK

-------------------- >> begin captured logging << --------------------
cherrypy.access.4354233120: INFO: 127.0.0.1 - - [06/Feb/2016:08:11:21] "GET /hello HTTP/1.1" 200 13 "" ""
cherrypy.access.4354233120: INFO: 127.0.0.1 - - [06/Feb/2016:08:11:21] "GET /hello HTTP/1.1" 200 13 "" ""
cherrypy.access.4354233120: INFO: 127.0.0.1 - - [06/Feb/2016:08:11:21] "GET /hello HTTP/1.1" 200 13 "" ""
cherrypy.access.4354233120: INFO: 127.0.0.1 - - [06/Feb/2016:08:11:21] "GET /hello HTTP/1.1" 200 13 "" ""
cherrypy.access.4354233120: INFO: 127.0.0.1 - - [06/Feb/2016:08:11:21] "GET /hello HTTP/1.1" 200 13 "" ""
cherrypy.access.4354233120: INFO: 127.0.0.1 - - [06/Feb/2016:08:11:21] "GET /hello HTTP/1.1" 200 13 "" ""
--------------------- >> end captured logging << ---------------------

bb-migration commented Feb 6, 2016

Original comment by Jason R. Coombs (Bitbucket: jaraco, GitHub: jaraco):


I think the issue is intermittent and has different failure modes. Using Python 3.5.1, I'm getting these results on different runs:

======================================================================
ERROR: test_HTTP11_pipelining (cherrypy.test.test_conn.PipelineTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/test/test_conn.py", line 436, in test_HTTP11_pipelining
    response.begin()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 282, in begin
    version, status, reason = self._read_status()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 264, in _read_status
    raise BadStatusLine(line)
http.client.BadStatusLine: Hello, world!HTTP/1.1 200 OK

-------------------- >> begin captured logging << --------------------
cherrypy.access.4354739840: INFO: 127.0.0.1 - - [06/Feb/2016:07:59:48] "GET /hello HTTP/1.1" 200 13 "" ""
cherrypy.access.4354739840: INFO: 127.0.0.1 - - [06/Feb/2016:07:59:48] "GET /hello HTTP/1.1" 200 13 "" ""
cherrypy.access.4354739840: INFO: 127.0.0.1 - - [06/Feb/2016:07:59:48] "GET /hello HTTP/1.1" 200 13 "" ""
--------------------- >> end captured logging << ---------------------
======================================================================
ERROR: test_HTTP11_pipelining (cherrypy.test.test_conn.PipelineTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/test/test_conn.py", line 444, in test_HTTP11_pipelining
    response.begin()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 282, in begin
    version, status, reason = self._read_status()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 251, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response
-------------------- >> begin captured logging << --------------------
cherrypy.access.4355282984: INFO: 127.0.0.1 - - [06/Feb/2016:08:09:17] "GET /hello HTTP/1.1" 200 13 "" ""
cherrypy.access.4355282984: INFO: 127.0.0.1 - - [06/Feb/2016:08:09:17] "GET /hello HTTP/1.1" 200 13 "" ""
cherrypy.access.4355282984: INFO: 127.0.0.1 - - [06/Feb/2016:08:09:17] "GET /hello HTTP/1.1" 200 13 "" ""
cherrypy.access.4355282984: INFO: 127.0.0.1 - - [06/Feb/2016:08:09:17] "GET /hello HTTP/1.1" 200 13 "" ""
cherrypy.access.4355282984: INFO: 127.0.0.1 - - [06/Feb/2016:08:09:17] "GET /hello HTTP/1.1" 200 13 "" ""
cherrypy.access.4355282984: INFO: 127.0.0.1 - - [06/Feb/2016:08:09:17] "GET /hello HTTP/1.1" 200 13 "" ""
--------------------- >> end captured logging << ---------------------
======================================================================
ERROR: test_HTTP11_pipelining (cherrypy.test.test_conn.PipelineTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/test/test_conn.py", line 437, in test_HTTP11_pipelining
    response.begin()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 282, in begin
    version, status, reason = self._read_status()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 264, in _read_status
    raise BadStatusLine(line)
http.client.BadStatusLine: Hello, world!HTTP/1.1 200 OK

-------------------- >> begin captured logging << --------------------
cherrypy.access.4354233120: INFO: 127.0.0.1 - - [06/Feb/2016:08:11:21] "GET /hello HTTP/1.1" 200 13 "" ""
cherrypy.access.4354233120: INFO: 127.0.0.1 - - [06/Feb/2016:08:11:21] "GET /hello HTTP/1.1" 200 13 "" ""
cherrypy.access.4354233120: INFO: 127.0.0.1 - - [06/Feb/2016:08:11:21] "GET /hello HTTP/1.1" 200 13 "" ""
cherrypy.access.4354233120: INFO: 127.0.0.1 - - [06/Feb/2016:08:11:21] "GET /hello HTTP/1.1" 200 13 "" ""
cherrypy.access.4354233120: INFO: 127.0.0.1 - - [06/Feb/2016:08:11:21] "GET /hello HTTP/1.1" 200 13 "" ""
cherrypy.access.4354233120: INFO: 127.0.0.1 - - [06/Feb/2016:08:11:21] "GET /hello HTTP/1.1" 200 13 "" ""
--------------------- >> end captured logging << ---------------------
@bb-migration

This comment has been minimized.

Show comment
Hide comment
@bb-migration

bb-migration Feb 6, 2016

Original comment by Jason R. Coombs (Bitbucket: jaraco, GitHub: jaraco):


I note that (in my observation) the RemoteDisconnected error is a new behavior of http.client in Python 3.5 that replaced the BadStatusLine('').

bb-migration commented Feb 6, 2016

Original comment by Jason R. Coombs (Bitbucket: jaraco, GitHub: jaraco):


I note that (in my observation) the RemoteDisconnected error is a new behavior of http.client in Python 3.5 that replaced the BadStatusLine('').

@bb-migration

This comment has been minimized.

Show comment
Hide comment
@bb-migration

bb-migration Mar 4, 2016

Original comment by Joel Rivera (Bitbucket: cyraxjoe, GitHub: cyraxjoe):


The problem is related to python itself, see https://bugs.python.org/issue23377 and https://bugs.python.org/issue4879#msg91597.

Python 2 by default had buffer=False and HTTPRequest.fp was sock.makefile('rb', 0) as a workaround and demostration we can monkey patch the fp attribute:

            response = conn.response_class(conn.sock, method="GET")
            response.fp = conn.sock.makefile("rb", 0) # monkey patch
            response.begin()

With that modification the test works with python 3.2 and up.

I think that I'll integrate the workaround and add a comment for the cpython issues with hopes on a upstream fix.

bb-migration commented Mar 4, 2016

Original comment by Joel Rivera (Bitbucket: cyraxjoe, GitHub: cyraxjoe):


The problem is related to python itself, see https://bugs.python.org/issue23377 and https://bugs.python.org/issue4879#msg91597.

Python 2 by default had buffer=False and HTTPRequest.fp was sock.makefile('rb', 0) as a workaround and demostration we can monkey patch the fp attribute:

            response = conn.response_class(conn.sock, method="GET")
            response.fp = conn.sock.makefile("rb", 0) # monkey patch
            response.begin()

With that modification the test works with python 3.2 and up.

I think that I'll integrate the workaround and add a comment for the cpython issues with hopes on a upstream fix.

@bb-migration

This comment has been minimized.

Show comment
Hide comment
@bb-migration

bb-migration Mar 10, 2016

Original comment by Joel Rivera (Bitbucket: cyraxjoe, GitHub: cyraxjoe):


Mokey patch the HTTP Request because of a socket buffering error in
python 3 for the cherrypy.tests.test_conn.test_HTTP11_pipelining
testcase.

Upstream cpython bug: https://bugs.python.org/issue23377

Fixes issue #1315

bb-migration commented Mar 10, 2016

Original comment by Joel Rivera (Bitbucket: cyraxjoe, GitHub: cyraxjoe):


Mokey patch the HTTP Request because of a socket buffering error in
python 3 for the cherrypy.tests.test_conn.test_HTTP11_pipelining
testcase.

Upstream cpython bug: https://bugs.python.org/issue23377

Fixes issue #1315

jaraco pushed a commit that referenced this issue Apr 30, 2016

Mokey patch the HTTP Request because of a socket buffering error in
python 3 for the ``cherrypy.tests.test_conn.test_HTTP11_pipelining``
testcase.

Upstream cpython bug: https://bugs.python.org/issue23377

Fixes issue #1315

webknjaz added a commit to cherrypy/cheroot that referenced this issue Jun 23, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment