Title: unittest blocks when testing function using multiprocessing.Pool with state spawn
Type: behavior Stage:
Components: Versions: Python 3.6
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Kenneth Chik, pitrou
Priority: normal Keywords:

Created on 2018-03-12 13:12 by Kenneth Chik, last changed 2018-03-13 22:06 by pitrou.

Messages (2)
msg313648 - (view) Author: Kenneth Chik (Kenneth Chik) Date: 2018-03-12 13:12
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

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

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.
msg313787 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2018-03-13 22:06
Please, can you post a self-contained script to reproduce the issue?
Date User Action Args
2018-03-13 22:06:33pitrousetnosy: + pitrou
messages: + msg313787
2018-03-12 13:12:55Kenneth Chikcreate