Linux – Fixing Zombie Process Using 100% CPU

cpujavalinuxprocesstop

A zombie process, which should not be using any resources (RAM and CPU), is hogging up an entire core on my 8-core 64-bit Ubuntu 11.10 Desktop installation.

This is the output of ps -el|grep Z:

F S   UID   PID  PPID  C PRI  NI ADDR SZ WCHAN  TTY          TIME CMD
0 Z  1000 10317     1 99  80   0 -     0 exit   ?        19:27:15 java <defunct>

… and here is an excerpt from top:

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                                                                
10317 deltik    20   0     0    0    0 Z  100  0.0   1170:17 java <defunct>
 1424 root      20   0  612m 193m 158m S   14  2.4 287:17.11 Xorg
12580 deltik    20   0  710m 135m  46m S    5  1.7  27:31.07 compiz

This is how the zombie process came to existence:

  1. I opened a Java JAR called minecraft.jar. This launcher downloads another JAR file
    to ~/.minecraft/bin/minecraft.jar
  2. That JAR was executing when I locked my computer with xscreensaver.
  3. Then, I entered my password to unlock the computer, and I saw that the Minecraft window was frozen.
  4. I tried killing it (PID 10317) with gnome-system-monitor. It became a zombie.
  5. kill -9 10317 was ineffective.
  6. xkill only closed the window titled "Minecraft"; it didn't close the underlying java process.

Relevant information:

  • The graphics driver is FGLRX, and it has caused notorious issues with Unity of Ubuntu 11.04 and Ubuntu 11.10, including sometimes high CPU usage of Xorg and compiz.

I want to know:

  1. What way is there to destroy this process of java without restarting, if any?
  2. Why is this issue happening?
  3. What can I do to prevent this issue from happening again?

Best Answer

The process has already been reparented to init, so it should be being reaped (otherwise, the solution would likely be to kill its parent). It appears to be stuck in exit, based on the WCHAN field.

It may actually be doing something (like creating a core dump) that will finish and it will go away on its own. Unfortunately, it's likely spinning in the kernel because of a broken driver and ultimately, your only option will be to reboot.