ImageEngine/gaffer — pull request #1131 by davidsminor (2014-12-16 01:16:30+00:00)
Title: Changing the way LocalDispatcher launches and kills jobs

Previously, LocalDispatcher.__doBackgroundDispatch() was calling subprocess.Popen with an additional argument "preexec_fn=os.setsid" to create a process group, then using os.killpg( process.pid, signal.SIGTERM ) to kill the entire process group. It seems this was occasionally causing the forked process to hang before the exec() happened, meaning the call to Popen would hang too. This was forcing lighters to restart their maya sessions, as it was breaking that render and subsequent ones. To work around this I've removed the preexec_fn argument from Popen, and I'm now killing the jobs by manually crawling the process tree.

Maybe John's got some insight into what might be causing the hang? I've seen a similar problem reported here http://www.tek-tips.com/viewthread.cfm?qid=81115, but haven't really been able to find any more info on it. The code that crawls the process tree isn't ideal because it's pretty platform dependent and definitely isn't going to work on windows, but then again os.setsid() isn't available on windows either.