[New-bugs-announce] [issue5331] multiprocessing hangs when Pool used within Process
mike bayer
report at bugs.python.org
Fri Feb 20 17:07:08 CET 2009
New submission from mike bayer <mike_mp at zzzcomputing.com>:
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()
----------
components: Library (Lib)
messages: 82534
nosy: zzzeek
severity: normal
status: open
title: multiprocessing hangs when Pool used within Process
type: crash
versions: Python 2.6, Python 3.0
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5331>
_______________________________________
More information about the New-bugs-announce
mailing list