Python deadlocks when Popen in multithread.

INADA Naoki songofacandy at gmail.com
Tue Oct 12 02:57:19 CEST 2010


On Oct 12, 5:33 am, Jed Smith <j... at jedsmith.org> wrote:
> On Mon, Oct 11, 2010 at 4:19 PM, INADA Naoki <songofaca... at gmail.com> wrote:
> > def worker():
> >    p = Popen(["cat"], stdin=PIPE, stdout=PIPE, stderr=STDOUT)
> >    out = p.communicate("hoge")[0]
> >    print "%s %s" % (current_thread().name, out)
>
> If, instead of spawning workers you directly call worker(), does it succeed?

Yes.

> I suspect the threading is a red herring here.

But thread & subprocess is a normal way to invoke outer commands in
parallel.



More information about the Python-list mailing list