[New-bugs-announce] [issue15101] multiprocessing pool finalizer can fail if triggered in background pool thread

Richard Oudkerk report at bugs.python.org
Mon Jun 18 16:33:41 CEST 2012


New submission from Richard Oudkerk <shibturn at gmail.com>:

Multiprocessing's process pool originally used a finalizer to shutdown the pool when the pool object is garbage collected.

Since the maxtasksperchild feature was added, the worker_handler thread holds a reference to the pool, preventing garbage collection at least until that thread finished.

In some cases the last reference to the pool is owned by the worker_handler thread, and as it exits, the finalizer is triggered.  Since the finalizer tries to join the worker_handler thread, an error will be raised since a thread cannot join itself.

It would have been better if pools had used the context manager protocol rather than using RAII -- see Issue #15064.

Unless/until RAII usage is fixed, a quick fix would be to just make the finalizer skip trying to join the current thread.

----------
messages: 163101
nosy: sbt
priority: normal
severity: normal
status: open
title: multiprocessing pool finalizer can fail if triggered in background pool thread
type: behavior

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


More information about the New-bugs-announce mailing list