This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Zahari.Dim
Recipients Zahari.Dim
Date 2015-06-27.09:22:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1435396926.55.0.634788943007.issue24519@psf.upfronthosting.co.za>
In-reply-to
Content
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)
History
Date User Action Args
2015-06-27 09:22:06Zahari.Dimsetrecipients: + Zahari.Dim
2015-06-27 09:22:06Zahari.Dimsetmessageid: <1435396926.55.0.634788943007.issue24519@psf.upfronthosting.co.za>
2015-06-27 09:22:06Zahari.Dimlinkissue24519 messages
2015-06-27 09:22:05Zahari.Dimcreate