[issue1606] Doc: subprocess wait() may lead to dead lock

Christian Heimes report at bugs.python.org
Thu Dec 13 03:25:02 CET 2007


Christian Heimes added the comment:

Guido van Rossum wrote:
> Why not simply reverse the wait() and read() calls?

I don't think it is sufficient if the user uses more than one pipe. The
subprocess.communicate() and _communicate() methods are using threads
(Windows) or select (Unix) when multiple pipes for stdin, stderr and
stderr are involved.

The only safe way with multiple pipes is communicate([input]) unless the
process returns *lots* of data. The subprocess module is buffering the
data in memory if the user uses PIPE or STDIN.

The subprocess module also contains a XXX comment in the unix version of
_communicate()

   # XXX Rewrite these to use non-blocking I/O on the
   # file objects; they are no longer using C stdio!

Should I create another bug entry for it?

Christian

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1606>
__________________________________


More information about the Python-bugs-list mailing list