[issue31782] Add a timeout to multiprocessing's Pool.join

Will Starms report at bugs.python.org
Tue Oct 17 15:31:30 EDT 2017


Will Starms <vilhelmen at gmail.com> added the comment:

I've realized that my patch may not be ideal for general-purpose use, but it's a good start for a discussion on the proper way to implement a timeout.

My patch (which is based on a more involved modification to Pool) assumes that the joins after the first will complete within a timely fashion, which is not necessarily true. While this prevents leaving the pool in a half-joined state, it can still get stuck joining other components or at least take significantly longer than the requested timeout.

Assuming that joining an already-joined object is safe, or it can be wrapped in an if statement to check before rejoining, I feel the best solution would be to reduce the timeout as joins complete, either raising (much easier) or returning (like threading.thread, but makes an is_alive function more difficult) when the remaining timeout time hits zero.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31782>
_______________________________________


More information about the Python-bugs-list mailing list