请帮忙提供一些有关此次 Apache 服务器崩溃的想法:
这是我的 MPM 配置和错误
<IfModule prefork.c>
StartServers 5
MinSpareServers 30
MaxSpareServers 40
ServerLimit 950
MaxClients 950
MaxRequestsPerChild 2000
</IfModule>
[Sun Sep 09 03:08:03 2012] [notice] Apache/2.2.15 (Unix) DAV/2 PHP/5.3.16 mod_ssl/2.2.15 OpenSSL/1.0.0-fips configured -- resuming normal operations
[Mon Sep 10 17:26:47 2012] [error] [mod_pagespeed 0.10.22.4-1633 @5088] [0910/172647:ERROR:worker.cc(120)] Unable to start worker thread
[Mon Sep 10 17:26:48 2012] [error] [mod_pagespeed 0.10.22.4-1633 @4983] [0910/172648:ERROR:worker.cc(120)] Unable to start worker thread
[Mon Sep 10 17:26:48 2012] [error] [mod_pagespeed 0.10.22.4-1633 @4915] [0910/172648:ERROR:worker.cc(120)] Unable to start worker thread
[Mon Sep 10 17:26:49 2012] [alert] (11)Resource temporarily unavailable: setuid: unable to change to uid: 48
[Mon Sep 10 17:26:49 2012] [error] [mod_pagespeed 0.10.22.4-1633 @5095] [0910/172649:ERROR:worker.cc(120)] Unable to start worker thread
[Mon Sep 10 17:26:49 2012] [error] [mod_pagespeed 0.10.22.4-1633 @5085] [0910/172649:ERROR:worker.cc(120)] Unable to start worker thread
[Mon Sep 10 17:26:49 2012] [error] [mod_pagespeed 0.10.22.4-1633 @4989] [0910/172649:ERROR:worker.cc(120)] Unable to start worker thread
[Mon Sep 10 17:26:50 2012] [alert] Child 5108 returned a Fatal error... Apache is exiting!
[Mon Sep 10 17:26:50 2012] [emerg] (22)Invalid argument: couldn't grab the accept mutex
[Mon Sep 10 17:26:50 2012] [emerg] (22)Invalid argument: couldn't release the accept mutex
[Mon Sep 10 17:26:50 2012] [emerg] (22)Invalid argument: couldn't release the accept mutex
[Mon Sep 10 17:26:50 2012] [emerg] (22)Invalid argument: couldn't grab the accept mutex
[Mon Sep 10 17:26:50 2012] [emerg] (22)Invalid argument: couldn't grab the accept mutex
[Mon Sep 10 17:26:50 2012] [emerg] (22)Invalid argument: couldn't release the accept mutex
答案1
最相关的错误似乎是:
[Mon Sep 10 17:26:49 2012] [alert] (11)Resource temporarily unavailable: setuid: unable to change to uid: 48
事情从那时起就开始每况愈下。
这意味着 Apache 达到了允许运行的最大进程数的限制。
您可以通过运行来查看限制ulimit -u
。要增加限制,请运行ulimit -u <number>
或编辑/etc/security/limits.conf
(可能是 Red Hat 特定的)并为 Apache 的用户添加配置指令,以将值增加到nproc
更合理的值。
您还可以尝试减少 ApacheServerLimit
和MaxClients
指令。
答案2
这里有一篇很好的文章,解释了 RHEL6 如何通过在 /etc/security/limits.d/90-nproc.conf 中添加 1024 限制来引入最大进程数问题(“help ulimit”显示 -u 是“最大用户进程数”),作者说他只是将其注释掉了:http://kavassalis.com/2011/03/linux-and-the-maximum-number-of-processes-threads/
以下是 Red Hat Bugzilla 页面对此的讨论:https://bugzilla.redhat.com/show_bug.cgi?id=432903