apache 日志 still did not exit, terminating forcefully

[Fri Sep 15 11:47:20.699886 2017] [mpm_winnt:notice] [pid 7128:tid 1600] AH00424: Parent: Received restart signal -- Restarting the server.
[Fri Sep 15 11:47:22.291977 2017] [mpm_winnt:notice] [pid 7128:tid 1600] AH00455: Apache/2.4.23 (Win32) OpenSSL/1.0.2j mod_fcgid/2.3.9 configured -- resuming normal operations
[Fri Sep 15 11:47:22.291977 2017] [mpm_winnt:notice] [pid 7128:tid 1600] AH00456: Server built: Jul  1 2016 16:42:20
[Fri Sep 15 11:47:22.291977 2017] [core:notice] [pid 7128:tid 1600] AH00094: Command line: 'D:\\Study\\Apache\\bin\\httpd.exe -d D:/Study/Apache'
[Fri Sep 15 11:47:22.319979 2017] [mpm_winnt:notice] [pid 7128:tid 1600] AH00418: Parent: Created child process 3428
[Fri Sep 15 11:47:26.307207 2017] [mpm_winnt:notice] [pid 4716:tid 1448] AH00364: Child: All worker threads have exited.
[Fri Sep 15 11:47:27.111253 2017] [mpm_winnt:notice] [pid 3428:tid 1448] AH00354: Child: Starting 600 worker threads.
[Fri Sep 15 11:47:34.660685 2017] [fcgid:error] [pid 4716:tid 1872] FastCGI process 9036 still did not exit, terminating forcefully
[Fri Sep 15 11:47:34.660685 2017] [fcgid:error] [pid 4716:tid 1872] FastCGI process 10852 still did not exit, terminating forcefully

各位大佬求指点一下这是什么原因?

阅读 8.4k
3 个回答

是不是内存不足导致某些fastcgi进程被杀了。

粗略看了一下代码,在mod_fcgid-2.3.9这个模块中modules/fcgid/fcgid_pm_main.c文件,当需要将所有的fcgid进程终止时,如果长时间终止没有成功,就会打这条log,然后强制终止,具体逻辑还要具体研究一下。

我觉得楼主的问题和这个差不多,不知道可不可以帮到你:

Apache吃空内存,频繁宕机

在部署一套内网测试环境时,频繁宕机,开机后不断的吃内存,重启apache之后内存占用会不停的上涨,直到swap用完,直到死机,由于是内网环境,服务器并发和压力都很小。

查看apache错误日志,报大量类似错误:

[Tue Feb 14 14:49:28 2012] [warn] child process 7751 still did not exit, sending a SIGTERM

[Tue Feb 14 14:49:30 2012] [error] child process 7603 still did not exit, sending a SIGKILL

[Tue Feb 14 14:49:30 2012] [error] child process 7614 still did not exit, sending a SIGKILL

后查出来是因为php某一些脚本存在内存泄露的代码段。而apache处理这些代码段的进程的处理请求数被设置为无穷。也就是说这些进程只 有在apache重启(stop-start模式)或者服务器重启的情况下才会被kill,否则将一直运行下去,直到耗尽系统的最后一点资源(主要是内 存)。

问题分析:

//服务器允许配置的进程数上限

ServerLimit 1500

//设置服务器启动时建立的子进程数量。因为子进程数量动态的取决于负载的轻重,所有一般没有必要调整这个参数。

StartServers     5

//MinSpareServers:设置空闲子进程的最小数量。所谓空闲子进程是指没有正在处理请求的子进程。如果当前空闲子进程数少于MinSpareServers,那么Apache将以最大每秒一个的速度产生新的子进程。

MinSpareServers   5

//设置空闲子进程的最大数量。如果当前有超过MaxSpareServers数量的空闲子进程,那么父进程将杀死多余的子进程。

MaxSpareServers   10

//用于客户端请求的最大接入请求数量(最大线程数)。

MaxClients 1500

//设置每个子进程在其生存期内允许提供的最大请求数量

MaxRequestsPerChild 50

问题解决:

设置 MaxRequestsPerChild 50或30

MaxRequestsPerChild不能太大,也不能设置为0,最好设置为一个相对不大的数字,100内可能就够了,防止httpd进程有意外的内存泄露。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题