When a python process is killed on OSX, why doesn't it kill the child processes?

Posted by Hugh on Super User See other posts from Super User or by Hugh
Published on 2010-01-24T01:54:13Z Indexed on 2010/05/20 6:02 UTC
Read the original article Hit count: 291

Filed under:
|
|
|
|

I found myself getting very confused a while back by some changes that I found when moving Python scripts from Linux over to OSX...

On Linux, if a python script has called os.system(), and the calling process is killed, the called process will be killed at the same time.

On OSX, however, if the main process is killed, anything that it launched is left behind.

Is there something somewhere in OSX/Python where I can change this behaviour?

This is causing problems on our render farm, where the processes can be killed from the management GUI, but the top level process is really just a wrapper, so, while the render farm management might think that the process has gone and the machine is freed up for another task, the actual processor-intensive task is still running, which can lead to huge blockages.

I know that I could write more logic to catch the kill signal and pass it on to the child processes, but I was hoping that it might be something that could be enabled at a lower level.

© Super User or respective owner

Related posts about python

Related posts about osx