New submission from Zahari Dim:
The following example should start two processes, but instead it starts three,
even though only two do_work(). A third process is incorrectly started after
the first one finishes.
import os
import time
from multiprocessing import Pool
def initprocess():
print(Starting PID: %d % os.getpid())
def do_work(x):
print(Doing work in %d % os.getpid())
time.sleep(x**2)
if __name__ == '__main__':
p = Pool(2, initializer=initprocess,maxtasksperchild=1)
results = p.map(do_work, (1,2), chunksize=1)
--
components: Library (Lib)
messages: 245878
nosy: Zahari.Dim
priority: normal
severity: normal
status: open
title: multiprocessing.Pool with maxtasksperchild starts too many processes
type: resource usage
versions: Python 3.4
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24519
___
___
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com