After working in Xcode on an iOS app for a few days, I’ve noticed that there are over 100 zombie processes hanging around. It appears that there is one for each time that I ran unit tests, and possibly one for each time I ran the full app in the simulator. Here’s a sample (cleaned and truncated):
> ps -efj | grep $PRODUCT_NAME
502 2794 236 0 Wed12AM ?? 0:00.00 (MyProduct) me 2794 0 1 Z ??
502 2843 236 0 Wed01AM ?? 0:00.00 (MyProduct) me 2843 0 1 Z ??
502 2886 236 0 Wed01AM ?? 0:00.00 (MyProduct) me 2886 0 1 Z ??
...
502 13711 236 0 Thu11PM ?? 0:00.00 (MyProduct) me 13711 0 1 Z ??
502 13770 236 0 Thu11PM ?? 0:00.00 (MyProduct) me 13770 0 1 Z ??
502 14219 236 0 10:35AM ?? 0:00.00 (MyProduct) me 14219 0 1 Z ??
502 14280 236 0 10:38AM ?? 0:00.00 (MyProduct) me 14280 0 1 Z ??
The Z in the second to last column indicates they are zombie processes. The 236 in the third column is the parent PID, which belongs to my user’s launchd in this case.
Note that some of the processes are multiple days old. I have quit and reopened Xcode a few times during this time period.
Does anyone know why this happens, or whether this should be cause for alarm?
They don’t particularly take up a lot of room.
This appears to be an artifact of the Xcode machinery improperly killing the subprocesses.
I have the same problem, but I note that the zombies belong to, in my case, ppid 271 which is an invocation of launchd under my name, instead the whole system.
I’m curious as to what might happen if I kill or hup that process.
In any case, logging out will probably clear the zombies. And certainly rebooting will, but thats to be avoided, in my book.
Oh, that went quite poorly. Don’t kill your launchd, it unceremoniously kills your session, but does nothing to let you get it back, like give you a login screen.
I shall have to look and see of I left the zombies behind because of stopping Xcode. It seems like there might be a couple of dumb things here. It your process doesn’t wait for a child, it gets zombied. If the parent dies, the next thing up the line gets it, I think, which in this case is launchd. Launchd ought to wait() for it, but maybe thats getting confused?