Zombie processes are processes the server has completed but not terminated. You might see “<defunct>” when looking at the processes in the server these are Zombie processes.
Zombie processes don’t really pose a threat to your server in terms of resource usage. That’s because the process has already run and completed. They do pose a threat in terms of PIDs. Processes are assigned a PID number when they run and a server has a limited number of PIDs to assign to processes. If lot’s of defunct processes gather they will be using lots of PID numbers and eventually if not resolved there will be no more PIDs to assign to new processes.
Indications of Zombie Processes
Some servers display large CPU usage, some servers like Virtuozzo servers might become unresponsive and unmanageable. We call these Zombie servers. The best way to tell if you have a Zombie server is by using the “top” screen. This screen details if you have any zombie processes on the top right.
Here was can see over 3285 processes have gathered together all using PIDs. If left this server will start to see issues. It’s also displaying a high load but the actual CPU usage is low, theirs plenty of memory but the wait time is high. The obvious answer to this is the defunct processes.
Terminating Zombie Processes
Sometimes you can terminate these processes but it doesn’t always work. The kill script can be used to attempt to terminate one of the defunct processes to see if it will work. Looking at the processes in the server choose a PID. We are using 51678
51678 ? 00:00:00 crond <defunct> 51681 ? 00:00:00 run-parts <defunct> 51687 ? 00:00:00 logrotate <defunct> 51688 ? 00:00:00 awk <defunct> 51689 ? 00:00:00 logrotate <defunct> 51690 ? 00:00:00 sh <defunct> 51691 ? 00:00:00 service <defunct> 51698 ? 00:00:00 named <defunct>
Kill the process
Use the kill -9 PID script to attempt to kill the process
kill -9 51678
If after using the kill script you can still see the PID then the only viable option is to reboot the server.
Zombie Processes on Virtuozzo hosts
Defunct processes can turn a server into a zombie server. These are servers that become unresponsive. You are not able to shut down the server due to the open processes and you also can’t terminate the processes. Again the only viable option to resolve this on a Virtuozzo host is to reboot the whole host.
Inspect processes inside a Virtuozzo server
If you are using Virtuozzo you can inspect processes inside a container by using vzps -E CTID. You can grab the CTID of a container by using vzlist -a
4142 51689 ? 00:00:00 logrotate <defunct> 4142 51690 ? 00:00:00 sh <defunct> 4142 51691 ? 00:00:00 service <defunct> 4142 51698 ? 00:00:00 named <defunct> 4142 51709 ? 00:00:00 rndc <defunct>
How was this article?
You might also like
More from Dedicated Servers
Set up a SOCKS5 Proxy Server Proxy servers have been around for years. A proxy server is a way of connecting …