令Apache中沉睡的无用进程自动退出的方法

2019-10-14 10:30:39于丽

                               ap_get_server_banner(),
                               " (internal dummy connection)rnrn", NULL);
    //...有省略
    }

这些进程在处理完当前请求以后(OPTIONS请求), 就会发现, oh, 主进程让我退出。

    static void child_main(int child_num_arg)
    {
    //...有省略
    
        while (!die_now && !shutdown_pending) {
    //...有省略
            //1. listen
            //2. accept
            //3. process request
    
            /* Check the pod and the generation number after processing a
             * connection so that we'll go away if a graceful restart occurred
             * while we were processing the connection or we are the lucky
             * idle server process that gets to die.
             */
            if (ap_mpm_pod_check(pod) == APR_SUCCESS) { /* selected as idle? */
                die_now = 1;
            }
    //...有省略
       }
    //...有省略
    }

于是, 它就做完清理工作, 然后自我消亡了~~~