some test_http hangs under pypy

Bug #918624 reported by Wouter van Heyst
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Medium
Unassigned

Bug Description

There seems to be a race condition. The following hangs (with current bzr.dev and also at revno 5999):

    ../pypy-1.7/bin/pypy ./bzr -Dhttp selftest -Eallow_debug -s bt.test_http bzrlib.tests.test_http.TestBadStatusServer

Change DEBUG in bzrlib.transport.http._urlllib2_wrappers from 0 to 1 and the hang is gone.
Breaking into the hanging test with ctrl-\:

    (Pdb) bt
      /tmp/testbzr-l2HpVf.tmp/bzrlib.tests.test_http.TestBadStatusServer.test_http_get(urllib,HTTP_1.0)/work/app_main.py(661)entry_point()
      /tmp/testbzr-l2HpVf.tmp/bzrlib.tests.test_http.TestBadStatusServer.test_http_get(urllib,HTTP_1.0)/work/app_main.py(609)run_command_line()
      /tmp/testbzr-l2HpVf.tmp/bzrlib.tests.test_http.TestBadStatusServer.test_http_get(urllib,HTTP_1.0)/work/app_main.py(51)run_toplevel()
      /tmp/testbzr-l2HpVf.tmp/bzrlib.tests.test_http.TestBadStatusServer.test_http_get(urllib,HTTP_1.0)/work/bzr(117)<module>()
      /m/home/home01/wvanheij/unix/src/bzr-pypy/bzrlib/commands.py(1209)main()
    -> ret = run_bzr_catch_errors(argv)
      /m/home/home01/wvanheij/unix/src/bzr-pypy/bzrlib/commands.py(1222)run_bzr_catch_errors()
    -> return exception_to_return_code(run_bzr, argv)
      /m/home/home01/wvanheij/unix/src/bzr-pypy/bzrlib/commands.py(919)exception_to_return_code()
    -> return the_callable(*args, **kwargs)
      /m/home/home01/wvanheij/unix/src/bzr-pypy/bzrlib/commands.py(1124)run_bzr()
    -> ret = run(*run_argv)
      /m/home/home01/wvanheij/unix/src/bzr-pypy/bzrlib/commands.py(672)run_argv_aliases()
    -> return self.run(**all_cmd_args)
      /m/home/home01/wvanheij/unix/src/bzr-pypy/bzrlib/commands.py(694)run()
    -> return self._operation.run_simple(*args, **kwargs)
      /m/home/home01/wvanheij/unix/src/bzr-pypy/bzrlib/cleanup.py(136)run_simple()
    -> self.cleanups, self.func, *args, **kwargs)
      /m/home/home01/wvanheij/unix/src/bzr-pypy/bzrlib/cleanup.py(166)_do_with_cleanups()
    -> result = func(*args, **kwargs)
      /m/home/home01/wvanheij/unix/src/bzr-pypy/bzrlib/builtins.py(4074)run()
    -> result = tests.selftest(**selftest_kwargs)
      /m/home/home01/wvanheij/unix/src/bzr-pypy/bzrlib/tests/__init__.py(3742)selftest()
    -> result_decorators=result_decorators,
      /m/home/home01/wvanheij/unix/src/bzr-pypy/bzrlib/tests/__init__.py(3325)run_suite()
    -> result = runner.run(suite)
      /m/home/home01/wvanheij/unix/src/bzr-pypy/bzrlib/tests/__init__.py(821)run()
    -> test.run(result)
      /m/home/home01/wvanheij/unix/src/bzr-pypy/bzrlib/tests/__init__.py(3422)run()
    -> return super(CountingDecorator, self).run(result)
      /m/home/home01/wvanheij/unix/src/pypy-1.7/lib-python/2.7/unittest/suite.py(103)run()
    -> test(result)
      /m/home/home01/wvanheij/unix/src/pypy-1.7/lib-python/2.7/unittest/suite.py(65)__call__()
    -> return self.run(*args, **kwds)
      /m/home/home01/wvanheij/unix/src/pypy-1.7/lib-python/2.7/unittest/suite.py(103)run()
    -> test(result)
      /m/home/home01/wvanheij/unix/src/pypy-1.7/lib-python/2.7/unittest/suite.py(65)__call__()
    -> return self.run(*args, **kwds)
      /m/home/home01/wvanheij/unix/src/bzr-pypy/bzrlib/tests/TestUtil.py(112)run()
    -> case = _run_and_collect_case(tests.pop(), result)()
      /m/home/home01/wvanheij/unix/src/bzr-pypy/bzrlib/tests/TestUtil.py(128)_run_and_collect_case()
    -> case.run(res)
      /m/home/home01/wvanheij/unix/src/bzr-pypy/testtools/testcase.py(517)run()
    -> return self.__RunTest(self, self.exception_handlers).run(result)
      /m/home/home01/wvanheij/unix/src/bzr-pypy/testtools/runtest.py(74)run()
    -> return self._run_one(actual_result)
      /m/home/home01/wvanheij/unix/src/bzr-pypy/testtools/runtest.py(88)_run_one()
    -> return self._run_prepared_result(ExtendedToOriginalDecorator(result))
      /m/home/home01/wvanheij/unix/src/bzr-pypy/testtools/runtest.py(100)_run_prepared_result()
    -> self._run_core()
      /m/home/home01/wvanheij/unix/src/bzr-pypy/testtools/runtest.py(125)_run_core()
    -> self.case._run_test_method, self.result):
      /m/home/home01/wvanheij/unix/src/bzr-pypy/testtools/runtest.py(169)_run_user()
    -> return fn(*args, **kwargs)
      /m/home/home01/wvanheij/unix/src/bzr-pypy/testtools/testcase.py(566)_run_test_method()
    -> return self._get_test_method()()
      /m/home/home01/wvanheij/unix/src/bzr-pypy/bzrlib/tests/test_http.py(677)test_http_get()
    -> self.assertRaises(errors.InvalidHttpResponse, t.get, 'foo/bar')
      /m/home/home01/wvanheij/unix/src/bzr-pypy/bzrlib/tests/__init__.py(1520)assertRaises()
    -> callableObj(*args, **kwargs)
      /m/home/home01/wvanheij/unix/src/bzr-pypy/bzrlib/transport/http/__init__.py(121)get()
    -> code, response_file = self._get(relpath, None)
      /m/home/home01/wvanheij/unix/src/bzr-pypy/bzrlib/transport/http/_urllib.py(120)_get()
    -> response = self._perform(request)
      /m/home/home01/wvanheij/unix/src/bzr-pypy/bzrlib/transport/http/_urllib.py(76)_perform()
    -> response = self._opener.open(request)
      /m/home/home01/wvanheij/unix/src/pypy-1.7/lib-python/modified-2.7/urllib2.py(392)open()
    -> response = self._open(req, data)
      /m/home/home01/wvanheij/unix/src/pypy-1.7/lib-python/modified-2.7/urllib2.py(410)_open()
    -> '_open', req)
      /m/home/home01/wvanheij/unix/src/pypy-1.7/lib-python/modified-2.7/urllib2.py(370)_call_chain()
    -> result = func(*args)
      /m/home/home01/wvanheij/unix/src/bzr-pypy/bzrlib/transport/http/_urllib2_wrappers.py(722)http_open()
    -> return self.do_open(HTTPConnection, request)
      /m/home/home01/wvanheij/unix/src/bzr-pypy/bzrlib/transport/http/_urllib2_wrappers.py(666)do_open()
    -> response = self.retry_or_raise(http_class, request, first_try)
      /m/home/home01/wvanheij/unix/src/bzr-pypy/bzrlib/transport/http/_urllib2_wrappers.py(575)retry_or_raise()
    -> response = self.do_open(http_class, request, False)
      /m/home/home01/wvanheij/unix/src/bzr-pypy/bzrlib/transport/http/_urllib2_wrappers.py(662)do_open()
    -> response = connection.getresponse()
      /m/home/home01/wvanheij/unix/src/bzr-pypy/bzrlib/transport/http/_urllib2_wrappers.py(257)getresponse()
    -> self._response = httplib.HTTPConnection.getresponse(self)
      /m/home/home01/wvanheij/unix/src/pypy-1.7/lib-python/modified-2.7/httplib.py(1014)getresponse()
    -> response.begin()
      /m/home/home01/wvanheij/unix/src/bzr-pypy/bzrlib/transport/http/_urllib2_wrappers.py(178)begin()
    -> httplib.HTTPResponse.begin(self)
      /m/home/home01/wvanheij/unix/src/pypy-1.7/lib-python/modified-2.7/httplib.py(402)begin()
    -> version, status, reason = self._read_status()
      /m/home/home01/wvanheij/unix/src/pypy-1.7/lib-python/modified-2.7/httplib.py(360)_read_status()
    -> line = self.fp.readline()
      /m/home/home01/wvanheij/unix/src/bzr-pypy/bzrlib/transport/http/_urllib2_wrappers.py(113)readline()
    -> s = self.filesock.readline(size)
      /m/home/home01/wvanheij/unix/src/pypy-1.7/lib-python/modified-2.7/socket.py(492)readline()
    -> data = self._sock.recv(self._rbufsize)
      /m/home/home01/wvanheij/unix/src/pypy-1.7/lib-python/modified-2.7/socket.py(188)recv()
    -> return self._sock.recv(buffersize, flags=flags)
    > /m/home/home01/wvanheij/unix/src/bzr-pypy/bzrlib/breakin.py(43)_debug()
    -> signal.signal(_breakin_signal_number, _debug)

Inspecting the test log:

    (Pdb)
    > /m/home/home01/wvanheij/unix/src/bzr-pypy/bzrlib/tests/test_http.py(677)test_http_get()
    -> self.assertRaises(errors.InvalidHttpResponse, t.get, 'foo/bar')
    (Pdb) print self.get_log()
    1.859 failed to load compiled extension: No module named bzrlib._rio_pyx
    1.935 failed to load compiled extension: No module named bzrlib._dirstate_helpers_pyx
    1.958 failed to load compiled extension: cannot import name '_btree_serializer_pyx'
    1.967 failed to load compiled extension: No module named bzrlib._groupcompress_pyx
    1.976 creating repository in file:///tmp/testbzr-l2HpVf.tmp/.bzr/.
    1.982 creating branch <bzrlib.branch.BzrBranchFormat7 object at 0x0b171810> in file:///tmp/testbzr-l2HpVf.tmp/
    2.010 trying to create missing lock '/tmp/testbzr-l2HpVf.tmp/.bzr/checkout/dirstate'
    2.011 opening working tree '/tmp/testbzr-l2HpVf.tmp'
    2.073 * About to connect() to 127.0.0.1:43802
    2.073 > GET /foo/bar
    2.073 > Host: 127.0.0.1:43802
    > Pragma: no-cache
    > Cache-Control: max-age=0
    > Connection: Keep-Alive
    > Accept: */*
    > User-Agent: bzr/2.5.0dev5 (urllib)

    2.075 * About to connect() to 127.0.0.1:43802
    2.075 > GET /foo/bar
    2.075 > Host: 127.0.0.1:43802
    > Pragma: no-cache
    > Cache-Control: max-age=0
    > Connection: Keep-Alive
    > Accept: */*
    > User-Agent: bzr/2.5.0dev5 (urllib)

    (Pdb)

Another test, test_http.TestPost.test_post_body_is_received(urllib,HTTP/1.0) hangs even with DEBUG set to 2

Changed in bzr:
status: New → Confirmed
importance: Undecided → Medium
tags: added: pypy
Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.