5

I have CrashPlan running on my MacBook Pro, and it went a little haywire. Essentially, it caused a fork bomb. Fortunately, I had an open Terminal window and was able to run this command:

sudo launchctl unload /Library/LaunchDaemons/com.crashplan.engine.plist

So the constant re-spawning has stopped. But, I still have over 900 java processes that aren't doing anything except pushing me up against my maximum process count. I would prefer not restarting my computer, as I have a lot of open code files, web pages, etc. Is there an easy way to force the system to reap these zombies? I would kill the parent process, but they're all started by launchd aka PID 1. At that point, it would be better to restart.

I have tried:

sudo kill -9 <PID>
sudo kill -9 java
sudo killall -9 java    

Is there a way of killing the zombies once and for all without having to kill launchd to do it? Or will I have to restart in order to survive this zombie apocalypse?

0

2 Answers 2

4

A zombie is already dead. Don't think of a process, think of it a process slot only. There is nothing to kill, so kill -9 works as well as kill -1, meaning nothing.

They're waiting for the parent to reap them. If the parent doesn't for some reason, and the parent doesn't tell the kernel to not generate them, they're left as zombies.

In traditional UNIX, pid 1 is init, which always reaps children. I think launchd is coded the same. If you have zombies with PPID as 1, you're pretty much out of options at that point, other than rebooting.

2

There is no way to do this, unfortunately. The zombie processes are usually benign because their parent will reap them eventually and they don't consume resources... but they do contribute to the maximum process count your system will allow (I think this depends on the amount of RAM installed in the computer, but I can't find documentation for this in Lion). The JVM instances were owned by launchd (PID 1 on the Mac) and there's no safe way to kill launchd and have it restart without also killing all of launchd's children. Which would be everything minus the kernel.

This may apply to any runaway LaunchAgent; the processes would all be children of launchd, and that would bring the same issues I had in to play. I don't believe that every JVM instance launched by every bit of Java code is spawned by launchd, but it juts so happened that CrashPlan uses Java and so I had those littering my system.

I guess the lesson to be learned here is: don't fork bomb, and keep a Terminal window handy. A restart cleared up the zombies, so all's good.

1
  • Upvote for 'no way to meaningfully kill launchd without a reboot'; It's the sad truth, AFAICT.
    – ipmcc
    Commented Jan 4, 2013 at 13:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .