[issue7123] Multiprocess Process does not always exit when run from a thread.

Tomaž Šolc report at bugs.python.org
Sat Jun 25 16:17:18 CEST 2011


Tomaž Šolc <tomaz.solc at tablix.org> added the comment:

I am pretty sure this is another instance of issue 6721.

multiprocessing is forking a new process and if that happens while the other thread is holding the lock for stdout, the process will deadlock because the lock state is replicated in the subprocess while the thread that is supposed unlock it isn't (even if you remove all prints, the deadlock will happen on a stdout flush).

Attaching a gdb to a hung subprocess confirms that it is waiting for a lock in the bufferedio module.

I've reproduced this on Python trunk running on Linux (using pthreads) and can confirm that the patch attached to issue 6721 fixes it.

I'm also attaching a shorter test case that omits unused code from the original example.

----------
nosy: +avian
Added file: http://bugs.python.org/file22465/testing.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7123>
_______________________________________


More information about the Python-bugs-list mailing list