加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – init不会杀死僵尸

发布时间:2020-12-14 02:34:20 所属栏目:Linux 来源:网络整理
导读:我的系统上有一些僵尸进程.我已经杀死了那些僵尸的父母,希望init能够接管并释放资源(CLOSE_WAIT中有很多套接字).但是init不会从系统中删除这些过程: #ps ax...17051 ? Zl 8498:24 [impalad] defunct...# ps -o ppid= -p 17051 1 有没有办法在不重启的情况下
我的系统上有一些僵尸进程.我已经杀死了那些僵尸的父母,希望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?

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读