[py-dev] New issue 54 in py-trunk: py.process.cmdexec() hangs if stderr is full

issues-noreply at bitbucket.org issues-noreply at bitbucket.org
Sun Oct 11 21:13:57 CEST 2009

New issue 54: py.process.cmdexec() hangs if stderr is full

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

  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()

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.

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.

More information about the Pytest-dev mailing list