linux – init不会杀死僵尸

前端之家收集整理的这篇文章主要介绍了linux – init不会杀死僵尸前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我的系统上有一些僵尸进程.我已经杀死了那些僵尸的父母,希望init能够接管并释放资源(CLOSE_WAIT中有很多套接字).但是init不会从系统中删除这些过程:
#ps ax
...
17051 ?        Zl   8498:24 [impalad] <defunct>
...

# ps -o ppid= -p 17051
    1

有没有办法在不重启的情况下移除僵尸?

更新:

我试过杀了-s SIGCHLD 1.它没有帮助.

解决方法

你不能杀死一个已经解散的过程.用别人的话说:

http://www.linuxquestions.org/questions/suse-opensuse-60/howto-kill-defunct-processes-574612/

You cannot kill a defunct process (a.k.a zombie) as it is already
dead. It doesn’t take any resources so it’s no big deal but if you
really want it to disappear form the process table you need to have
its parent procees reaping it. “pstree” should give you the process
hierarchy and “kill -1 ” is sometimes enough for the job.

因为进程的父pid是init(1),所以除了重启之外你不能做任何事情.

https://unix.stackexchange.com/questions/11172/how-can-i-kill-a-defunct-process-whose-parent-is-init

You cannot kill a (zombie) process as it is already dead.
The only reason why the system keeps zombie processes is to keep the
exit status for the parent to collect. If the parent does not collect
the exit status then the zombie processes will stay around forever.
The only way to get rid of those zombie processes are by killing the
parent. If the parent is init then you can only reboot.

我无法测试这个,但是这个人说你可以摆脱这样一个已经失效的过程:

What is a zombie process and how do I kill it?

There is already an accepted answer,however: you CAN kill the zombie process. Attach with the debugger to the parent process and call waitpid function. E.g.: - let's assume that the parent has PID=100,the zombie process has PID=200

$gdb -p 100
(gdb) call waitpid(200,0)
(gdb) quit

这个家伙在一个似乎继续运行的失效过程中遇到了问题.我不明白,但这里是链接.在这种情况下,杀死-9 pid声称可以工作.

Zombie processes still alive and working fine,but can’t be killed?

原文链接:https://www.f2er.com/linux/395863.html

猜你在找的Linux相关文章