classification
Title: possible typo in multiprocessing.Pool._terminate
Type: Stage: resolved
Components: Versions: Python 3.1, Python 3.2, Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: asksol, jnoller, pitrou, python-dev
Priority: normal Keywords:

Created on 2011-04-09 23:07 by pitrou, last changed 2011-04-10 22:31 by pitrou. This issue is now closed.

Messages (3)
msg133433 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-04-09 23:07
There's the following code in pool.py, line 494 and following:

        debug('joining task handler')
        task_handler.join()

        debug('joining result handler')
        task_handler.join()

It seems the last line should read `result_handler.join()` instead.

Additionally, when _terminate() is called, it seems the worker_handler could still run while other threads shut down existing workers, meaning it could start new workers (in _repopulate_pool()) in parallel.

So perhaps the worker_handler should be joined before anything else in _terminate(). It would incur a small latency, though (because of the sleep() call there).
msg133486 - (view) Author: Roundup Robot (python-dev) Date: 2011-04-10 22:23
New changeset c046b7e1087b by Antoine Pitrou in branch '3.2':
Issue #11814: Fix likely typo in multiprocessing.Pool._terminate().
http://hg.python.org/cpython/rev/c046b7e1087b

New changeset 76a3fc180ce0 by Antoine Pitrou in branch 'default':
Merge from 3.2 (issue #11814, issue #8428)
http://hg.python.org/cpython/rev/76a3fc180ce0
msg133489 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-04-10 22:31
Fixed. The _terminate() issue has been fixed separately in issue8428.
History
Date User Action Args
2011-04-10 22:31:25pitrousetstatus: open -> closed
resolution: fixed
messages: + msg133489

stage: resolved
2011-04-10 22:23:30python-devsetnosy: + python-dev
messages: + msg133486
2011-04-09 23:07:20pitroucreate