Python deadlocks when Popen in multithread.

INADA Naoki songofacandy at gmail.com
Tue Oct 12 20:41:06 CEST 2010


I've found the bug http://bugs.python.org/issue1731717.
It seems wating subprocess can be multithreaded but creating
subprocess cannot.

On Oct 12, 9:57 am, INADA Naoki <songofaca... at gmail.com> wrote:
> 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