Tests leaving behind zombie processes on OS X

Hi Greg,

The following tests leave behind zombie a.out processes on OS X after finishing:

  • TestGdbRemoteAbort.py

  • TestGdbRemoteSegFault.py

  • TestGdbRemote_vCont.py

  • TestGdbRemoteSingleStep.py

  • TestLldbGdbServer.py

Since the parent is launchd, there is no way to remove them. Eventually our OS X buildbot runs into a zombie apocalypse, and must be rebooted.

This seems to be a bug in launchd, since it should be reaping the zombies.

Is there anything we can do about this?

Thanks,
Chaoren

http://superuser.com/questions/385818/what-to-do-if-kill-9-doesnt-work

Someone isn't reaping their processes. Since you have figured out which tests do this, it shouldn't be too hard to track down. After the python process goes away, all processes get re-parented to launchd and they remain zombies there. Some GDB remote tests actually launch their own process and then they attach to it using the debugserver. In this case, on MacOSX, we still need to reap the process, even though "debugserver" or "lldb-server" also needs to reap it if they don't detach... So on MacOSX:

If you:
- python: launch "a.out" from python
- debugserver: attach to it and debug it and kill
- debugserver: needs to reap "a.out"
- python: needs to reap "a.out"

Not sure if the python needing to reap "a.out" also happens on other unix variants or if this is just Mach/BSD specific? Or just Darwin specific.

Since these are all GdbRemote tests, the regular process of iterating over targets/process in self.dbg and killing them is ineffective. I think we’ll need to add a tear down step in gdbremote_testcase.py to cleanup using raw gdb packets to debugserver.

all processes get re-parented to launchd and they remain zombies there.

That is horrifying. This cannot possibly be the intended behavior.

That is horrifying. This cannot possibly be the intended behavior.

Sorry, I got a bit too dramatic here.

We will try to fix this up in lldb-server but hopefully it can be addressed at the OS level, too. I think this would be a very good improvement for the OS X community.