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.