Issue 33054: unittest blocks when testing function using multiprocessing.Pool with state spawn (original) (raw)

I am not sure if this is python or OS problem, I just installed Ubuntu 18.04 LTS which comes with python3 v3.6.4. When I try to unittest code which contains multiprocessing.Pool with spawn, the unittest.main() blocks after completing all the tests. This problem did not exist on prior versions of Ubuntu/Python. Below is the printout after I KeyboardInterrupt the process.

...

Ran 13 tests in 10.472s

OK ^CException ignored in: <module 'threading' from '/usr/lib/python3.6/threading.py'> Traceback (most recent call last): File "/usr/lib/python3.6/threading.py", line 1294, in _shutdown t.join() File "/usr/lib/python3.6/threading.py", line 1056, in join self._wait_for_tstate_lock() File "/usr/lib/python3.6/threading.py", line 1072, in _wait_for_tstate_lock elif lock.acquire(block, timeout): KeyboardInterrupt

The spawned processes have all completed and not visible on the process list, but the semaphore_tracker process is still there. This is the same with previous working system though. Thanks.