V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
MartinWu
0D
V2EX  ›  Linux

init 的孩子们,你们已经死了!为什么还不离去?!

  •  1
     
  •   MartinWu ·
    Martwu · Feb 13, 2017 · 4930 views
    This topic created in 3360 days ago, the information mentioned may be changed or developed.
    情况是这样的,之前出现过大量 sshd 僵尸,我现在想重现这种情况,实现的是:

    init 进程的一些子进程为 Z 状态,并一直保持住。

    求大神指教。
    10 replies    2017-02-14 16:17:17 +08:00
    Siril
        1
    Siril  
       Feb 13, 2017
    得散点纸钱才行
    linbiaye
        2
    linbiaye  
       Feb 13, 2017
    不重启还能咋办,至多社区报个 bug.
    dbg
        3
    dbg  
       Feb 13, 2017   ❤️ 2
    我还以为是 init 和 systemd 的引战帖子。
    MartinWu
        4
    MartinWu  
    OP
       Feb 13, 2017
    @linbiaye 我现在想重现这种情况。就是怎么样才能实现这种状况。
    MartinWu
        5
    MartinWu  
    OP
       Feb 13, 2017
    @dbg 我承认我标题党了~~
    hareandlion
        6
    hareandlion  
       Feb 13, 2017 via iPhone
    死了变僵尸活着
    loading
        7
    loading  
       Feb 13, 2017 via Android
    @dbg 我也是。
    MartinWu
        8
    MartinWu  
    OP
       Feb 13, 2017
    现在的一些线索导向,可能是 supervisor 的锅。两次都是在 supervisord 上面重启过所有的 app 后,僵尸进程就突然消失了。。然而, supervisord 并没有用 root 启动,而是一个没权限切到 root 的普通账号。
    MartinWu
        9
    MartinWu  
    OP
       Feb 13, 2017
    还在继续跟踪。。
    Siril
        10
    Siril  
       Feb 14, 2017
    https://www.google.com/search?q=how+to+create+zombie+process&ie=utf-8&oe=utf-8&client=firefox-b-ab

    据说是这样,未亲手验证:
    先 fork 出一个子进程,
    然后父进程 sleep ,子进程 exit ,
    子进程就 zombie 了。

    然后根据这个:
    https://www.google.com/search?q=how+to+create+zombie+process&ie=utf-8&oe=utf-8&client=firefox-b-ab#q=cleanup+zombie+process
    干掉父进程,子进程会被 init 接管,然后会被 wait 后清除。
    所以? init 接管后还有一大堆 zombie ? 哪里的 bug 呢

    试试这个:
    https://stackoverflow.com/questions/20535438/cant-cleanup-a-zombie-process-whose-parent-is-init
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3668 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 54ms · UTC 04:53 · PVG 12:53 · LAX 21:53 · JFK 00:53
    ♥ Do have faith in what you're doing.