[issue13422] Subprocess: children hang due to open pipes

Charles-François Natali report at bugs.python.org
Thu Nov 17 22:00:30 CET 2011


Charles-François Natali <neologix at free.fr> added the comment:

> subprocess.Popen.communicate() hangs for daemonized subprocesses that 
> leave a pipe open. [...] which leaves stderr pipe open.

Of course: the daemon process (spawned by the second fork()) inherits the subprocess's stderr (since file descriptors are inherited upon fork), and communicate waits until the subprocess's stderr and stdout are closed (EOF returned).
And it's of course documented, see http://docs.python.org/dev/library/subprocess.html#subprocess.Popen.communicate :
"""
Popen.communicate(input=None, timeout=None) 
Interact with process: Send data to stdin. Read data from stdout and stderr, until end-of-file is reached. Wait for process to terminate.
"""

----------
nosy: +neologix

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13422>
_______________________________________


More information about the Python-bugs-list mailing list