[issue23051] multiprocessing.pool methods imap() and imap_unordered() cause deadlock

Alon Diamant report at bugs.python.org
Mon Dec 15 00:03:12 CET 2014


Alon Diamant added the comment:

The patches I attached do 2 things:

1. A deadlock is prevented, wherein the main thread waits forever for the Pool thread/s to finish their execution, while they wait for instructions to terminate from the _task_handler thread which has died. Instead, the exception are caught and handled and termination of the pool execution is performed.
2. The exception that was raised is caught and passed to the main thread, and is re-thrown in the context of the main thread - hence the user catch it and handle it, or - at the very least - be aware of the issue.

I tested the patch to the best of my abilities, and am almost certain nothing was changed performance wise nor anything broken. 

Further eyes would, of course, only help for confirming this.

----------

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


More information about the Python-bugs-list mailing list