如何停止FCGI进程中的随机caching杀死服务器

所以早些时候得到了以下的一天…

在那段时间内,日志会显示进程(600)和相关内存(1.2g),服务器发出的CPU使用率平均值(80)的斜坡。

服务器必须由主机硬重置,因为没有ssh或plesk面板访问。

快速CGIconfiguration如下,并设置为一个高使用率的网站。 据我了解,FcgidMaxProcesses 20应该防止发生,但没有发生。

我已经阅读了许多论坛,有不同的答案和许多不同的fcgi指令的引用,但没有发现任何结论。 任何人得到一些明确的答案,如何停止这种服务器进程斜坡和随后的服务器故障?

如果你需要更多的信息,让我知道。

干杯安迪

/var/log/apache2/error_log [Thu May 17 07:40:47 2012] [warn] mod_fcgid: process 17651 graceful kill fail, sending SIGKILL [Thu May 17 07:40:47 2012] [warn] mod_fcgid: process 17650 graceful kill fail, sending SIGKILL [Thu May 17 07:40:47 2012] [warn] mod_fcgid: process 17649 graceful kill fail, sending SIGKILL [Thu May 17 07:40:47 2012] [warn] mod_fcgid: process 17644 graceful kill fail, sending SIGKILL [Thu May 17 07:40:47 2012] [warn] mod_fcgid: process 17643 graceful kill fail, sending SIGKILL [Thu May 17 07:40:47 2012] [warn] mod_fcgid: process 17638 graceful kill fail, sending SIGKILL [Thu May 17 07:40:47 2012] [warn] mod_fcgid: process 17633 graceful kill fail, sending SIGKILL [Thu May 17 07:40:47 2012] [warn] mod_fcgid: process 17627 graceful kill fail, sending SIGKILL [Thu May 17 07:40:47 2012] [warn] mod_fcgid: process 17622 graceful kill fail, sending SIGKILL [Thu May 17 07:40:51 2012] [warn] mod_fcgid: process 17674 graceful kill fail, sending SIGKILL [Thu May 17 07:40:51 2012] [warn] mod_fcgid: process 17673 graceful kill fail, sending SIGKILL [Thu May 17 07:40:51 2012] [warn] mod_fcgid: process 17672 graceful kill fail, sending SIGKILL [Thu May 17 07:40:51 2012] [warn] mod_fcgid: process 17667 graceful kill fail, sending SIGKILL [Thu May 17 07:40:51 2012] [warn] mod_fcgid: process 17666 graceful kill fail, sending SIGKILL [Thu May 17 07:40:51 2012] [warn] mod_fcgid: process 17665 graceful kill fail, sending SIGKILL [Thu May 17 07:40:51 2012] [warn] mod_fcgid: process 17664 graceful kill fail, sending SIGKILL [Thu May 17 07:40:51 2012] [warn] mod_fcgid: process 17659 graceful kill fail, sending SIGKILL [Thu May 17 07:40:51 2012] [warn] mod_fcgid: process 17658 graceful kill fail, sending SIGKILL [Thu May 17 07:40:51 2012] [warn] mod_fcgid: process 17657 graceful kill fail, sending SIGKILL [Thu May 17 07:40:51 2012] [warn] mod_fcgid: process 17656 graceful kill fail, sending SIGKILL [Thu May 17 07:40:51 2012] [warn] mod_fcgid: process 17651 graceful kill fail, sending SIGKILL 

https://docs.google.com/a/thesugarrefinery.com/open?id=0B_XbpWChge0VRmFLWEZfR2VBb2M https://docs.google.com/a/thesugarrefinery.com/open?id=0B_XbpWChge0VWTcwZEhoV2Fqejg https://docs.google。 com / a / thesugarrefinery.com / open?id = 0B_XbpWChge0VUUtVWWFINHZjZ0U https://docs.google.com/a/thesugarrefinery.com/open?id=0B_XbpWChge0VZEVMclh6ZUdaOUE

 <IfModule mod_fcgid.c> <IfModule !mod_fastcgi.c> AddHandler fcgid-script fcg fcgi fpl </IfModule> FcgidIPCDir /var/lib/apache2/fcgid/sock FcgidProcessTableFile /var/lib/apache2/fcgid/shm FcgidIdleTimeout 40 FcgidProcessLifeTime 30 FcgidMaxProcesses 20 FcgidMaxProcessesPerClass 20 FcgidMinProcessesPerClass 0 FcgidConnectTimeout 30 FcgidIOTimeout 120 FcgidInitialEnv RAILS_ENV production FcgidIdleScanInterval 10 FcgidMaxRequestLen 1073741824 </IfModule> 

Debian(至less)有一个bug,使虚拟主机无法使用这个限制。 现在是固定的。

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=615814

这通常是由挂起的setuid CGI脚本引起的; 它超过了IOtimeout,并且apache试图杀死它,但是由于uid的改变而无法工作,导致错误。

您可能需要增加FcgidIOTimeout或FcgidProcessLifetime以允许线程有更多时间完成。

另一个解决方法是使Apache服务器在与setuid脚本相同的UID下运行。 这允许它杀死进程,尽pipe出于安全原因可能并不可取。 同样,以root身份运行apache也是一个解决方法,但不是很安全。 如果你这样做,注意你的fcgi sock目录(在/ var / lib / apache2 / fcgid / sock或者类似的地方)和进程表文件需要被apache进程所有者写入。

但是,根本原因是CGI脚本本身耗时过长。 其原因取决于我不可见的CGI代码。