Are you intercepting SIGCHLD in the script? If you are then Popen will not run as expected since it relies on it's own handler for that signal.
You can check for SIGCHLD handlers by commenting out the Popen call and then running:
strace python <your_script.py> | grep SIGCHLD
if you see something similar to:
rt_sigaction(SIGCHLD, ...)
then, you are in trouble. You need to disable the handler prior to calling Popen and then resetting it after communicate is done (this might introduce a race conditions so beware).
signal.signal(SIGCHLD, handler)
...
signal.signal(SIGCHLD, signal.SIG_DFL)
'''
now you can go wild with Popen.
WARNING!!! during this time no signals will be delivered to handler
'''
...
signal.signal(SIGCHLD, handler)
There is a python bug reported on this and as far as I see it hasn't been resolved yet:
http://bugs.python.org/issue9127
Hope that helps.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…