Author zzzeek
Recipients zzzeek
Date 2009-02-20.16:06:49
SpamBayes Score 3.01317e-06
Marked as misclassified No
Message-id <1235146028.47.0.682929217877.issue5331@psf.upfronthosting.co.za>
In-reply-to
Content
this occurs for me running on Mac OSX Leopard.   The equivalent code
using "processing" in python 2.5 works fine, which is how I found this
bug - my code hung when upgraded to 2.6.    Basically initiating a
multiprocessing.Pool inside of multiprocessing.Process hangs the
application.  Below is code which illustrates the issue on both py2.6
and py3.0:

    from multiprocessing import Pool, Process
    import sys

    def f(x):
        return x*x

    def go():
        pool = Pool(processes=4)              
        x = pool.map(f, [1, 2, 3, 4, 5, 6, 7])
        sys.stdout.write("result: %s\n" % x)

    def go2():
        x = map(f, [1,2,3,4,5,6,7])
        sys.stdout.write("result: %s\n" % x)

    # pool alone, fine
    go()

    # process alone, fine
    p = Process(target=go2)
    p.start()
    p.join()

    # use both, hangs
    p = Process(target=go)
    p.start()
    p.join()
History
Date User Action Args
2009-02-20 16:07:08zzzeeksetrecipients: + zzzeek
2009-02-20 16:07:08zzzeeksetmessageid: <1235146028.47.0.682929217877.issue5331@psf.upfronthosting.co.za>
2009-02-20 16:06:50zzzeeklinkissue5331 messages
2009-02-20 16:06:49zzzeekcreate