I have production unit in which java process has become Zombie and remained there for some time now. If the unit is restarted, then it will be cleared. However, the unit is not restarted and another java process is up and running. Is there any issue if this zombie state remains as it is without clearing it? Will it affect in any way (performance or slowness)?
2 Answers
Zombie process won't have any effect on performance or slowness as Zombie processes don’t use up any system resources.
Note:- Practically, it is still using the PID (which is a limited resource), and the kernel data structures for the process are still allocated. Usually, this won't matter much, but the kernel memory usage can be significant on systems with very limited memory.
Problem caused by zombie process
Each zombie process retains its process ID . Linux systems have a finite number of process IDs – 32767 by default on 32-bit systems.If zombies are accumulating at a very quick rate ,the entire pool of available PIDs will eventually become assigned to zombie processes, preventing other processes from launching.
Note: On 64-bit systems, you can increase the maximum PID, see https://unix.stackexchange.com/a/16884/170373
However, a few zombie processes hanging around are no problem – although they do indicate a bug with their parent process on your system.
Explanation:
When a process dies on Linux, it isn’t all removed from memory immediately — its process descriptor stays in memory.
The process’s status becomes EXIT_ZOMBIE
and the process’s parent is notified that its child process has died with the SIGCHLD
signal.
The parent process is then supposed to execute the wait() system call to read the dead process’s exit status and other information. This allows the parent process to get information from the dead process. After wait() is called, the zombie process is completely removed from memory.
This normally happens very quickly, so you won’t see zombie processes accumulating on your system. However, if a parent process isn’t programmed properly and never calls wait(), its zombie children will stick around in memory until they’re cleaned up.
Resolution:
You can’t kill zombie processes as you can kill normal processes with the SIGKILL signal — zombie processes are already dead.
One way to kill zombie is by sending the SIGCHLD signal to the parent process. This signal tells the parent process to execute the wait() system call and clean up its zombie children. Send the signal with the kill command, replacing pid in the command below with the parent process’s PID:
kill -s SIGCHLD pid
When the process that created the zombies ends, init inherits the zombie processes and becomes their new parent. (init is the first process started on Linux at boot and is assigned PID 1.)
Note:- From Linux 3.4 onwards processes can issue the prctl() system call with the PR_SET_CHILD_SUBREAPER option, and as a result they, not process #1, will become the parent of their orphaned descendant processes. Refer: https://unix.stackexchange.com/a/177361/5132
INIT then executes the wait() system call to clean up its zombie children, so init will make short work of the zombies. You can restart the parent process after closing it.

- 67,283
- 35
- 116
- 255

- 1,290
Mostly, zombies are not a big issue. They are a 'dead'-ish process, which takes no CPU time, and any allocated memory should have been freed by the process before dying. The only resource they actually take is an entry in your process list. Depending on your system, you can have a maximum allowed number of threads, and having zombies can make you reach this limit faster for no reason.
However : Zombies usually appear because of bad/buggy code, where the programmer forgot to check the states of its child processes. This can be intentional, but often it is not. Bad/buggy code will often also handle memory in a bad special way, and Not free some allocated resources. If this is the case, these resources will stay allocated for the zombie, until it is fully terminated.
Edit : If the process is a java program, not freed memory should not be an issue, as the java garbage collector takes care of everything.

- 131
-
3In fact, not feed memory isn't issue it most OSes in all languages. System will free all memory except tiny amount for parent process. – val - disappointed in SE Jun 26 '18 at 14:30
SIGCHLD
is wrong. – JdeBP Jun 26 '18 at 11:29