This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_multiprocessing failure under Linux
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: sbt Nosy List: python-dev, sbt, vinay.sajip
Priority: normal Keywords:

Created on 2012-05-05 09:13 by vinay.sajip, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (7)
msg159981 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2012-05-05 09:13
I've recently started seeing this failure repeatably on Linux (Ubuntu Jaunty):

[195/364] test_multiprocessing
Process Process-133:
Traceback (most recent call last):
  File "/home/vinay/projects/python/default/Lib/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/home/vinay/projects/python/default/Lib/multiprocessing/process.py", line 95, in run
    self._target(*self._args, **self._kwargs)
  File "/home/vinay/projects/python/default/Lib/test/test_multiprocessing.py", line 2005, in _remote
    client.connect(address)
ConnectionRefusedError: [Errno 111] Connection refused
/home/vinay/projects/python/default/Lib/multiprocessing/process.py:274: ResourceWarning: unclosed <socket.socket object, fd=15, family=2, type=1, proto=0>
  traceback.print_exc()
msg159987 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2012-05-05 10:50
Some more information: after the above-described appears, the test hangs. When interrupted with a Ctrl+C, this is displayed:

^CProcess PoolWorker-104:
Process PoolWorker-102:
Process PoolWorker-105:1:
Process PoolWorker-101:
Process PoolWorker-105:4:
Process PoolWorker-105:3:
Process PoolWorker-105:2:
Process PoolWorker-103:
Traceback (most recent call last):
  File "/home/vinay/projects/python/default/Lib/multiprocessing/process.py", line 258, in _bootstrap
Traceback (most recent call last):
  File "/home/vinay/projects/python/default/Lib/multiprocessing/process.py", line 258, in _bootstrap
Traceback (most recent call last):
  File "/home/vinay/projects/python/default/Lib/multiprocessing/process.py", line 258, in _bootstrap
Traceback (most recent call last):
  File "/home/vinay/projects/python/default/Lib/multiprocessing/process.py", line 258, in _bootstrap
Traceback (most recent call last):
  File "/home/vinay/projects/python/default/Lib/multiprocessing/process.py", line 258, in _bootstrap
Traceback (most recent call last):
  File "/home/vinay/projects/python/default/Lib/multiprocessing/process.py", line 258, in _bootstrap
Traceback (most recent call last):
  File "/home/vinay/projects/python/default/Lib/multiprocessing/process.py", line 258, in _bootstrap
Traceback (most recent call last):
  File "/home/vinay/projects/python/default/Lib/multiprocessing/process.py", line 258, in _bootstrap
Process Process-132:
Traceback (most recent call last):
  File "/home/vinay/projects/python/default/Lib/multiprocessing/process.py", line 258, in _bootstrap
Warning -- threading._dangling was modified by test_multiprocessing
Warning -- multiprocessing.process._dangling was modified by test_multiprocessing
    self.run()
  File "/home/vinay/projects/python/default/Lib/multiprocessing/process.py", line 95, in run
    self._target(*self._args, **self._kwargs)
  File "/home/vinay/projects/python/default/Lib/test/test_multiprocessing.py", line 1989, in _listener
    new_conn, addr = l.accept()
  File "/home/vinay/projects/python/default/Lib/socket.py", line 135, in accept
    fd, addr = self._accept()
KeyboardInterrupt
/home/vinay/projects/python/default/Lib/multiprocessing/process.py:274: ResourceWarning: unclosed <socket.socket object, fd=17, family=2, type=1, proto=0>
  traceback.print_exc()
test test_multiprocessing crashed -- Traceback (most recent call last):
  File "/home/vinay/projects/python/default/Lib/test/test_multiprocessing.py", line 2825, in test_main
    run(suite)
  File "/home/vinay/projects/python/default/Lib/test/support.py", line 1407, in run_unittest
    _run_suite(suite)
  File "/home/vinay/projects/python/default/Lib/test/support.py", line 1373, in _run_suite
    result = runner.run(suite)
  File "/home/vinay/projects/python/default/Lib/test/support.py", line 1272, in run
    test(result)
  File "/home/vinay/projects/python/default/Lib/unittest/suite.py", line 67, in __call__
    return self.run(*args, **kwds)
  File "/home/vinay/projects/python/default/Lib/unittest/suite.py", line 105, in run
    test(result)
  File "/home/vinay/projects/python/default/Lib/unittest/suite.py", line 67, in __call__
    return self.run(*args, **kwds)
  File "/home/vinay/projects/python/default/Lib/unittest/suite.py", line 105, in run
    test(result)
  File "/home/vinay/projects/python/default/Lib/unittest/suite.py", line 67, in __call__
    return self.run(*args, **kwds)
  File "/home/vinay/projects/python/default/Lib/unittest/suite.py", line 105, in run
    test(result)
  File "/home/vinay/projects/python/default/Lib/unittest/case.py", line 492, in __call__
    return self.run(*args, **kwds)
  File "/home/vinay/projects/python/default/Lib/unittest/case.py", line 440, in run
    self._executeTestPart(testMethod, outcome, isTest=True)
  File "/home/vinay/projects/python/default/Lib/unittest/case.py", line 385, in _executeTestPart
    function()
  File "/home/vinay/projects/python/default/Lib/test/test_multiprocessing.py", line 2038, in test_pickling
    new_conn = lconn.recv()
  File "/home/vinay/projects/python/default/Lib/multiprocessing/connection.py", line 252, in recv
    buf = self._recv_bytes()
  File "/home/vinay/projects/python/default/Lib/multiprocessing/connection.py", line 398, in _recv_bytes
    buf = self._recv(4)
  File "/home/vinay/projects/python/default/Lib/multiprocessing/connection.py", line 377, in _recv
    chunk = read(handle, remaining)
KeyboardInterrupt

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/vinay/projects/python/default/Lib/multiprocessing/managers.py", line 729, in _callmethod
    conn = self._tls.connection
AttributeError: 'ForkAwareLocal' object has no attribute 'connection'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "Lib/test/regrtest.py", line 1237, in runtest_inner
  File "/home/vinay/projects/python/default/Lib/test/test_multiprocessing.py", line 2829, in test_main
    ManagerMixin.pool.terminate()
  File "<string>", line 2, in terminate
  File "/home/vinay/projects/python/default/Lib/multiprocessing/managers.py", line 733, in _callmethod
    self._connect()
  File "/home/vinay/projects/python/default/Lib/multiprocessing/managers.py", line 720, in _connect
    conn = self._Client(self._token.address, authkey=self._authkey)
  File "/home/vinay/projects/python/default/Lib/multiprocessing/connection.py", line 469, in Client
    c = SocketClient(address)
  File "/home/vinay/projects/python/default/Lib/multiprocessing/connection.py", line 585, in SocketClient
    s.connect(address)
FileNotFoundError: [Errno 2] No such file or directory
msg160209 - (view) Author: Richard Oudkerk (sbt) * (Python committer) Date: 2012-05-08 15:51
> I've recently started seeing this failure repeatably on Linux (Ubuntu 
> Jaunty):

The test is newly enabled.  Does "repeatably" mean you always get the failure?

I have not seen any failures on the Linux buildbots.
msg160220 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2012-05-08 19:13
> Does "repeatably" mean you always get the failure?

Yes, every time. The first symptom is always a ConnectionRefusedError.

> I have not seen any failures on the Linux buildbots.

I'm running a fairly old version of Ubuntu, which might be relevant, or it may be that the connection is being refused because it's clashing with something else just on the test machine. In general this machine is just used for Python builds and tests, but I do run some services (e.g. Jenkins). Or it might be a race condition - the test machine is a VM and does have somewhat different timing characteristics from those of real hardware.
msg160227 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-05-08 21:28
New changeset 3d900c9641c9 by Richard Oudkerk in branch 'default':
Issue #14727: Fix race in test_multiprocessing
http://hg.python.org/cpython/rev/3d900c9641c9
msg160229 - (view) Author: Richard Oudkerk (sbt) * (Python committer) Date: 2012-05-08 21:57
I found a race where a connection attempt could happen before the listening socket's listen() method was called.

Vinay, could you update and try again please.
msg160232 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2012-05-08 22:14
test_multiprocessing now passes. Thanks for the quick turnaround.
History
Date User Action Args
2022-04-11 14:57:29adminsetgithub: 58932
2012-05-08 22:14:22vinay.sajipsetstatus: open -> closed
messages: + msg160232

assignee: sbt
resolution: fixed
stage: resolved
2012-05-08 21:57:55sbtsetmessages: + msg160229
2012-05-08 21:28:17python-devsetnosy: + python-dev
messages: + msg160227
2012-05-08 19:13:44vinay.sajipsetmessages: + msg160220
2012-05-08 15:51:47sbtsetmessages: + msg160209
2012-05-05 10:50:25vinay.sajipsetmessages: + msg159987
2012-05-05 09:13:34vinay.sajipcreate