[issue17273] multiprocessing.pool.Pool task/worker handlers are not fork safe

Richard Oudkerk report at bugs.python.org
Fri Feb 22 10:50:12 CET 2013


Richard Oudkerk added the comment:

A pool should only be used by the process that created it (unless you use a managed pool).

If you are creating long lived processes then you could create a new pool on demand.  For example (untested)

    pool_pid = (None, None)

    def get_pool():
        global pool_pid
        if os.getpid() != pool_pid[1]:
            pool_pid = (Pool(), os.getpid())
        return pool_pid[0]

----------

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


More information about the Python-bugs-list mailing list