Often, when running LLDB on OSX, the debugger will sporadically crash (this just seems to be the nature of LLDB). When this happens, I get a zombie process (the one I was debugging) that looks really strange. It has parent PID = 0:
My process is called: worker
Here is the output of ps aux | grep worker
root 22785 0.0 0.0 0 0 ?? Z 3:48pm 0:00.00 (worker)
As you can see, the process has a PID, but it has no parent PID. This does nothing
sudo kill -9 <pid>
In fact, nothing short of a restart seems to get rid of it. How can I kill a process like that? I need the process to die, because it holds on to ports that I need.
Zombie is the name given to processes which already died. So they do not run any longer and they do not consume system resources any longer. They are only listed in the process table which could not be properly updated at the time the zombie process finished running. This is also the reason why they are not assigned to any meaningful parent.
Therefore you can not kill a zombie for a second time (as their name already implies, in contrary to what happens in medium-level horror movies :-)). In most operating systems it is enough to wait for some time for the zombie processes to disappear from the list of processes. Or you have to do a reboot if you can not live with this.
Rest assured, zombies will do no harm to you.
The situation is that it is not possible, as a user, to clean up a zombie process; the kernel will handle it when it's ready, if possible.
As detailed in Mac OS X and iOS Internals,
it is a perfectly normal state and every process usually spends an infinitesimal amount of time, just before it can rest in peace....Parents who outlive, yet forsake their children and move on to other things, will damn the children to be stuck in the quasi-dead state of a zombie. Zombies are, for all intents and purposes, quite dead.
Since the debugger acts as the parent to its target process, which holds a network port and the debugger has crashed, it leaves the target process in the zombie state. The problem here is the crash of the debugger.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With