New issue 54: py.process.cmdexec() hangs if stderr is full
http://bitbucket.org/hpk42/py-trunk/issue/54/pyprocesscmdexec-hangs-if-stderr-is-full

Victor Stinner / haypo on Sun, 11 Oct 2009 21:13:57 +0200:

Description:
  I'm trying a debug version of PyPy which writes a lot of lines to stderr. 
After few seconds, PyPy
hangs. strace shows that there are two processes:
 * parent : reading on a pipe (a)
 * child : writing to a pipe (b)

and... pipe (a) and pipe (b) are different. The child is blocked because the 
pipe (b) is full, and the
parent is blocking because there is no data on pipe (a).

The problem is in py.process.cmdexec():

def popen3_exec_cmd(cmd):
    stdin, stdout, stderr = os.popen3(cmd)
    out = stdout.read()
    err = stderr.read()
    stdout.close()
    stderr.close()

stderr is full but the parent is still waiting for the end of stdout (process 
exit).

I think that stdout and stderr should be read at the same time, maybe using non 
blocking file
descriptors and/or select.

Responsible:
  hpk42
-- 
This is an issue notification from bitbucket.org.
You are receiving this either because you are the
owner of the issue, or you are following the issue.
_______________________________________________
py-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/py-dev

Reply via email to