问题描述:
shell > top top - 11:14:17 up 630 days, 21:23, 1 user, load average: 0.23, 0.81, 1.07 Tasks: 389 total, 1 running, 385 sleeping, 0 stopped, 3 zombie Cpu(s): 3.6%us, 0.8%sy, 0.0%ni, 95.3%id, 0.0%wa, 0.0%hi, 0.3%si, 0.0%st Mem: 24596748k total, 3346824k used, 21249924k free, 50344k buffers Swap: 8388600k total, 9704k used, 8378896k free, 1649016k cached
# 发现有三个僵尸进程 3 zombie ,这是因为先杀死了父进程导致
shell > ps aux | grep Z USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 7811 0.0 0.0 0 0 ? Zs 11:15 0:00 [yiic_elastic_kt] <defunct> root 8446 0.0 0.0 103260 872 pts/1 R+ 11:18 0:00 grep Z
# 不给面子,已经自动死了两个,估计是太阳出来了
shell > kill -9 7811
# 这样是杀不死的,还顽强的存活着
解决方法:
shell > ps -ef | grep defunct root 8850 8840 0 11:20 ? 00:00:00 [yiic_elastic_kt] <defunct> root 8851 8842 0 11:20 ? 00:00:00 [yiic_elastic_kt] <defunct> root 8853 8843 0 11:20 ? 00:00:00 [yiic_elastic_kt] <defunct> root 8855 8839 0 11:20 ? 00:00:00 [yiic_elastic_kt] <defunct> root 9066 7621 0 11:20 pts/1 00:00:00 grep defunct
# 我去,又跑出来三个...
shell > ps -ef | grep defunct | awk '{print $3}' | xargs -i kill {}
# $3 是这些僵尸进程的父进程 PID ( PPID ),杀之!
shell > ps -ef | grep defunct root 10008 7621 0 11:24 pts/1 00:00:00 grep defunct
# 已经灰飞烟灭!