Apache错误日志[warn] child process * still did not exit, sending a SIGTERM解决办法

1、我们打开apache的配置文件,linux中的路径为:/etc/httpd/conf/httpd.conf
2、找到MaxRequestsPerChild属性将他设置为50。
3、保存并退出,利用service httpd restart 重启apache服务,使配置生效。

这样就可以避免再次遇到这样的问题了!

————————–/var/log/httpd/error_log—————————————————-
[Mon Apr 13 20:38:55 2015] [warn] child process 12447 still did not exit, sending a SIGTERM
[Mon Apr 13 20:38:55 2015] [warn] child process 12513 still did not exit, sending a SIGTERM
[Mon Apr 13 20:38:55 2015] [warn] child process 12522 still did not exit, sending a SIGTERM
[Mon Apr 13 20:38:55 2015] [warn] child process 12532 still did not exit, sending a SIGTERM
[Mon Apr 13 20:38:55 2015] [warn] child process 12533 still did not exit, sending a SIGTERM
[Mon Apr 13 20:38:55 2015] [warn] child process 12534 still did not exit, sending a SIGTERM
[Mon Apr 13 20:38:55 2015] [warn] child process 12535 still did not exit, sending a SIGTERM
[Mon Apr 13 20:38:55 2015] [warn] child process 12685 still did not exit, sending a SIGTERM
[Mon Apr 13 20:38:55 2015] [warn] child process 12821 still did not exit, sending a SIGTERM
[Mon Apr 13 20:38:55 2015] [warn] child process 13072 still did not exit, sending a SIGTERM
[Mon Apr 13 20:38:55 2015] [warn] child process 26814 still did not exit, sending a SIGTERM
[Mon Apr 13 20:38:55 2015] [warn] child process 26966 still did not exit, sending a SIGTERM
[Mon Apr 13 20:38:55 2015] [warn] child process 25555 still did not exit, sending a SIGTERM

———————————————————————————————

分析问题原因
1、查看apache日志
2、错误信息为:[warn] child process 31015 still did not exit, sending a SIGTERM
3、这个代码说明什么呢,就是说31015这个进程无法停止,服务器请求终止这个进程,
但是这个进程又无法停止,就这样apache告诉服务器这个进程你要给停了,
但是服务器又不这个进程停掉,进入了一个死循环,最后系统资源被耗光,
apache进程挂掉,然后网站就无法访问了。造成这种结果的原因是网页程序问题,
也是服务器设置的问题。因为php某一些脚本存在内存泄露的代码段。
而apache处理这些代码段的进程的处理请求数被设置为无穷。
也就是说这些进程只有在apache重启(stop-start模式)或者服务器重启的情况下才会被kill,
否则将一直运行下去,直到耗尽系统的最后一点资源(主要是内存),然后挂掉你的服务。
4、如何来解决这个问题呢?原因也说了,是由于apache对代码段进程的请求数为无穷,
才导致了这个死循环,所以我们只要将apache处理请求的属性进行设置后,就能很好的规避这样的问题。

原文:http://jingyan.baidu.com/article/19192ad8326b6de53e57078f.html

Leave a Reply