How to prevent zombie processes?
ps -elf --forest | grep -C5 '<[d]efunct>'
0 S carboni+ 2622 1 0 80 0 - 564437 ep_pol 13:43 ? 00:00:02 /usr/bin/envoy --config-path /tmp/envoy-171ed88b60e2a862-bootstrap.json --disable-hot-restart
0 Z carboni+ 2790 2622 0 80 0 - 0 - 13:43 ? 00:00:00 \_ [consul] <defunct>
0 S carboni+ 2623 1 0 80 0 - 564437 ep_pol 13:43 ? 00:00:02 /usr/bin/envoy --config-path /tmp/envoy-171ed88b71c9c8d9-bootstrap.json --disable-hot-restart
0 Z carboni+ 2868 2623 0 80 0 - 0 - 13:43 ? 00:00:00 \_ [consul] <defunct>
0 S carboni+ 2624 1 0 80 0 - 564437 ep_pol 13:43 ? 00:00:02 /usr/bin/envoy --config-path /tmp/envoy-171ed88b63bab7c1-bootstrap.json --disable-hot-restart
0 Z carboni+ 2812 2624 0 80 0 - 0 - 13:43 ? 00:00:00 \_ [consul] <defunct>
4 S carboni+ 2625 1 0 80 0 - 564437 ep_pol 13:43 ? 00:00:02 /usr/bin/envoy --config-path /tmp/envoy-171ed88b64a33c88-bootstrap.json --disable-hot-restart
0 Z carboni+ 2813 2625 0 80 0 - 0 - 13:43 ? 00:00:00 \_ [consul] <defunct>
0 S carboni+ 2641 1 0 80 0 - 564437 ep_pol 13:43 ? 00:00:02 /usr/bin/envoy --config-path /tmp/envoy-171ed88b7320c943-bootstrap.json --disable-hot-restart
0 Z carboni+ 2865 2641 0 80 0 - 0 - 13:43 ? 00:00:00 \_ [consul] <defunct>
0 S carboni+ 2642 1 0 80 0 - 564437 ep_pol 13:43 ? 00:00:02 /usr/bin/envoy --config-path /tmp/envoy-171ed88b611719ff-bootstrap.json --disable-hot-restart
0 Z carboni+ 2796 2642 0 80 0 - 0 - 13:43 ? 00:00:00 \_ [consul] <defunct>
0 S carboni+ 2643 1 0 80 0 - 564437 ep_pol 13:43 ? 00:00:02 /usr/bin/envoy --config-path /tmp/envoy-171ed88b729a1a35-bootstrap.json --disable-hot-restart
0 Z carboni+ 2867 2643 0 80 0 - 0 - 13:43 ? 00:00:00 \_ [consul] <defunct>
0 S carboni+ 2644 1 0 80 0 - 564437 ep_pol 13:43 ? 00:00:02 /usr/bin/envoy --config-path /tmp/envoy-171ed88b71962a87-bootstrap.json --disable-hot-restart
0 Z carboni+ 2878 2644 0 80 0 - 0 - 13:43 ? 00:00:00 \_ [consul] <defunct>
0 S carboni+ 2651 1 0 80 0 - 564437 ep_pol 13:43 ? 00:00:03 /usr/bin/envoy --config-path /tmp/envoy-171ed88b780d4935-bootstrap.json --disable-hot-restart
0 Z carboni+ 2888 2651 0 80 0 - 0 - 13:43 ? 00:00:00 \_ [consul] <defunct>
0 S carboni+ 2727 1 0 80 0 - 564437 ep_pol 13:43 ? 00:00:01 /usr/bin/envoy --config-path /tmp/envoy-171ed88b7bfb0a65-bootstrap.json --disable-hot-restart
0 Z carboni+ 2894 2727 0 80 0 - 0 - 13:43 ? 00:00:00 \_ [consul] <defunct>
These processes (defunct, or "Z" processes) do not impact the system. They are already completed but the parent process was unable to pickup its status and close it cleanly, so to say. Being completed processes, they also do not consume any resource anymore. The solution is usually to restart the parent process, you can do so during a maintenance window of your server, to avoid any impact on the server's availability.
Hello
I did not report this because it is a serious issue because indeed most of the time a zombie process does not affect the system resources.
However it would be better to avoid this from happening. So room for improvement here.
Hi @horizon
My answer was not only directly to you, but also to other who read your post and might be worried by the presence of these processes. Of course, zombie processes are not nice to see in a ps output and should not be there, because they indicate that something went wrong. I will inform the dev team responsible of this issue and let them tackle it.
How to prevent zombie processes?
ps -elf --forest | grep -C5 '<[d]efunct>'
Hi,
We have forwarded this issue to our Dev team. We will get back to you as soon as we have any news.
We hope you could understand the process, hence we appreciate your patience.
Thank you for being with us.
Thanks and regards,
Sharif
Hi Masters!
I have the same situation:
ps aux | egrep "Z|defunct"
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND carboni+ 5572 0.0 0.0 0 0 ? Z Sep22 0:00 [consul] <defunct> carboni+ 5576 0.0 0.0 0 0 ? Z Sep22 0:00 [consul] <defunct> carboni+ 5586 0.0 0.0 0 0 ? Z Sep22 0:00 [consul] <defunct> carboni+ 6209 0.0 0.0 0 0 ? Z Sep22 0:00 [consul] <defunct> carboni+ 6221 0.0 0.0 0 0 ? Z Sep22 0:00 [consul] <defunct> carboni+ 6233 0.0 0.0 0 0 ? Z Sep22 0:00 [consul] <defunct> carboni+ 6238 0.0 0.0 0 0 ? Z Sep22 0:00 [consul] <defunct> carboni+ 6244 0.0 0.0 0 0 ? Z Sep22 0:00 [consul] <defunct> carboni+ 6254 0.0 0.0 0 0 ? Z Sep22 0:00 [consul] <defunct> carboni+ 6255 0.0 0.0 0 0 ? Z Sep22 0:00 [consul] <defunct> carboni+ 6264 0.0 0.0 0 0 ? Z Sep22 0:00 [consul] <defunct> carboni+ 6278 0.0 0.0 0 0 ? Z Sep22 0:00 [consul] <defunct> root 3004720 0.0 0.0 10756 2376 pts/0 S+ 13:57 0:00 grep -E --color=auto Z|defunct
Add the following command line to crontab to periodically clean up zombie processes:
kill $(ps -A -ostat,ppid | awk '/[zZ]/ && !a[$2]++ {print $2}')
Should such errors be reported to someone later?
Thank you!
Regards: DrCyberg
I also have 12 Zombie processes that occurred after the server was running for a week or so:
root@mail:~# ps aux | egrep "Z|defunct" USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND carboni+ 2257 0.0 0.0 0 0 ? Z Feb06 0:00 [consul] <defunct> carboni+ 2260 0.0 0.0 0 0 ? Z Feb06 0:00 [consul] <defunct> carboni+ 2261 0.0 0.0 0 0 ? Z Feb06 0:00 [consul] <defunct> carboni+ 2268 0.0 0.0 0 0 ? Z Feb06 0:00 [consul] <defunct> carboni+ 2269 0.0 0.0 0 0 ? Z Feb06 0:00 [consul] <defunct> carboni+ 2270 0.0 0.0 0 0 ? Z Feb06 0:00 [consul] <defunct> carboni+ 2276 0.0 0.0 0 0 ? Z Feb06 0:00 [consul] <defunct> carboni+ 2328 0.0 0.0 0 0 ? Z Feb06 0:00 [consul] <defunct> carboni+ 2329 0.0 0.0 0 0 ? Z Feb06 0:00 [consul] <defunct> carboni+ 2330 0.0 0.0 0 0 ? Z Feb06 0:00 [consul] <defunct> carboni+ 2366 0.0 0.0 0 0 ? Z Feb06 0:00 [consul] <defunct> carboni+ 2368 0.0 0.0 0 0 ? Z Feb06 0:00 [consul] <defunct> root 2767830 0.0 0.0 6432 656 pts/0 S+ 09:34 0:00 grep -E --color=auto Z|defunct
Just reporting this in case devs are interested.
Perhaps a workaround might be to send a SIGCHLD to the parent pid to see if they have a signal handler that would issue that wait(2) to clean up these zombies. Short of that, restarting the parent that is forking these children should result in pid 1 (systemd) to issue the wait and remove the zombies from the proc table.
Hello,
I have same scenario, at reboot, the process zombies appears.
So, i a try this command :
kill $(ps -A -ostat,ppid | awk '/[zZ]/ && !a[$2]++ {print $2}')
Ok, zombies process is killed, BUT
Now, the collaboration is defunct, all function for upload / download / edi document Online not work after kill process.
Have-you one idea or track investigation ?
Have a good day.