13
3
How to kill a zombie process or find it's parent process on a Mac using the Terminal?
13
3
How to kill a zombie process or find it's parent process on a Mac using the Terminal?
16
Hack Saw says:
Sadly, it appears that killing of zombies is all about killing the parent, and if the parent is /sbin/launchd, you can kill it only with rebooting.
It would be a Very Bad Idea to kill launchd
, but you can tell it to HUP.
Try sudo kill -s HUP 1
That will cause launchd
to reinitialize without restarting. This has worked for me in the past (wrt. removing zombie entries).
3
Sadly, it appears that killing of zombies is all about killing the parent, and if the parent is /sbin/launchd, you can kill it only with rebooting.
I'm getting zombies from using Xcode, and stopping the simulator, and it's handing the zombies to my own personal /sbin/launchd, which didn't go away when I logged out.
ps -xo pid,ppid,stat,command will show you your processes, with their parent ID in the second column.
1
zombie processes are already dead and cannot be killed. They should be removed from the process table automatically when the parent process dies.
They do not slow down your machine and you can leave them there (they are just entries in the process table).
There is a maximum number of processes (you can check it with sysctl kern.maxproc
) and zombie processes will reduce it (as they are counted).
If you reach this limit you will not be able to create new processes and you will be forced to reboot.
2They are a problem when you want to restart the crashed process, and use it again, but can't without rebooting. – MarcusJ – 2014-11-30T19:54:24.883
Why should they be a problem? – Matteo – 2014-12-01T11:51:57.443
4When an App gets in that state then you can't relaunch it until the old entry is cleared out. It isn't using any resources but the pollution of the table prevents a new instance from launching, therefore you're blocked until you reboot. – George – 2015-05-22T21:39:56.360
"Should be removed", but they're not always. Xcode is terrible about leaving zombie processes, and they aren't cleaned up even if Xcode dies / is quit / is killed. – JRG-Developer – 2013-01-12T00:37:27.103
@JRG-Developer I agree but they are not a problem. They do no consume any resource. – Matteo – 2013-01-12T06:18:56.163
2Actually they are a problem when too many are created and fork can't launch any new process and you're forced to reboot. – Adam – 2013-01-15T10:02:47.913
@Adam Yes, you are correct. They do not slow down your computer but they reserve resources. On my Mac (8GB of RAM) the limit is set to 2048. I updated my answer – Matteo – 2013-01-15T15:23:30.307
possible duplicate of how to kill process in Mac OS X and not have it restart on its own
– soandos – 2012-02-16T08:13:40.7333@soandos Not a duplicate, as that topic isn't about zombies. None of the
kill
signals work for zombies IIRC. I've had this happen before. – Daniel Beck – 2012-02-16T09:03:13.897Usually one can kill zombies if the parent process is known but this requires killing that one too, which is not always a pleasant choice. Therefore I am wondering if there is another solution to this. – eFrane – 2012-02-16T10:45:33.713