过去两天我一直在尝试解决这个问题,但一直没有成功。
我有一台装有 Apache 2.4.7 的 Ubuntu 14.04 服务器。Apache 会随机停止提供内容,暂时修复此问题的唯一方法是重新启动 Apache。我启用了 SWAP,并留出了 4 GB 的空间,我注意到当它崩溃时,物理 RAM 似乎会被填满,然后 SWAP 也会开始填满。
经过大量的 Google 搜索,我发现这可能与 MaxClients 有关。我的服务器非常小,只有 2 GB 的 RAM 和一个带有两个核心的 Xeon CPU E5-2630L。我很快发现 Ubuntu 现在将这些设置放在 /etc/apache2/mods-enabled/mpm_prefork.conf 中。我编辑了 MaxRequestWorkers,因为它似乎与 MaxClients 有相同的描述,我将其设置为 22。
这似乎确实解决了我的内存问题,至少就我所知是这样。物理内存从未超过 1.4 GB,并且 Swap 保持相对较低。但现在 Apache 服务器似乎更频繁地崩溃,大约每 4 分钟一次。以前,它崩溃可能需要一小时到一天的时间。
这是最新的错误日志:
[Sun Dec 06 18:35:36.577144 2015] [core:error] [pid 5506] AH00046: child process 6990 still did not exit, sending a SIGKILL
[Sun Dec 06 18:35:36.577166 2015] [core:error] [pid 5506] AH00046: child process 7002 still did not exit, sending a SIGKILL
[Sun Dec 06 18:35:36.577188 2015] [core:error] [pid 5506] AH00046: child process 7004 still did not exit, sending a SIGKILL
[Sun Dec 06 18:35:36.577220 2015] [core:error] [pid 5506] AH00046: child process 7058 still did not exit, sending a SIGKILL
[Sun Dec 06 18:35:36.577250 2015] [core:error] [pid 5506] AH00046: child process 7059 still did not exit, sending a SIGKILL
[Sun Dec 06 18:35:36.577281 2015] [core:error] [pid 5506] AH00046: child process 7063 still did not exit, sending a SIGKILL
[Sun Dec 06 18:35:36.577301 2015] [core:error] [pid 5506] AH00046: child process 7118 still did not exit, sending a SIGKILL
[Sun Dec 06 18:35:36.577313 2015] [core:error] [pid 5506] AH00046: child process 7121 still did not exit, sending a SIGKILL
[Sun Dec 06 18:35:36.577326 2015] [core:error] [pid 5506] AH00046: child process 7125 still did not exit, sending a SIGKILL
[Sun Dec 06 18:35:36.577342 2015] [core:error] [pid 5506] AH00046: child process 7127 still did not exit, sending a SIGKILL
[Sun Dec 06 18:35:36.577355 2015] [core:error] [pid 5506] AH00046: child process 7130 still did not exit, sending a SIGKILL
[Sun Dec 06 18:35:36.577367 2015] [core:error] [pid 5506] AH00046: child process 7198 still did not exit, sending a SIGKILL
[Sun Dec 06 18:35:36.577388 2015] [core:error] [pid 5506] AH00046: child process 7137 still did not exit, sending a SIGKILL
[Sun Dec 06 18:35:36.577433 2015] [core:notice] [pid 5506] AH00051: child pid 7154 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 18:35:36.577450 2015] [core:error] [pid 5506] AH00046: child process 7141 still did not exit, sending a SIGKILL
[Sun Dec 06 18:35:36.577463 2015] [core:error] [pid 5506] AH00046: child process 7142 still did not exit, sending a SIGKILL
[Sun Dec 06 18:35:36.577525 2015] [core:notice] [pid 5506] AH00051: child pid 7148 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 18:35:36.577539 2015] [core:error] [pid 5506] AH00046: child process 7163 still did not exit, sending a SIGKILL
[Sun Dec 06 18:35:36.577558 2015] [core:error] [pid 5506] AH00046: child process 7164 still did not exit, sending a SIGKILL
[Sun Dec 06 18:35:36.577570 2015] [core:error] [pid 5506] AH00046: child process 7165 still did not exit, sending a SIGKILL
[Sun Dec 06 18:35:37.578868 2015] [core:notice] [pid 5506] AH00051: child pid 7191 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 18:35:37.580384 2015] [core:info] [pid 5506] AH00096: removed PID file /var/run/apache2/apache2.pid (pid=5506)
[Sun Dec 06 18:35:37.580397 2015] [mpm_prefork:notice] [pid 5506] AH00169: caught SIGTERM, shutting down
[Sun Dec 06 18:35:38.414121 2015] [mpm_prefork:notice] [pid 7583] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.14 configured -- resuming normal operations
[Sun Dec 06 18:35:38.414197 2015] [mpm_prefork:info] [pid 7583] AH00164: Server built: Oct 14 2015 14:20:21
[Sun Dec 06 18:35:38.414218 2015] [core:notice] [pid 7583] AH00094: Command line: '/usr/sbin/apache2'
[Sun Dec 06 18:35:38.414226 2015] [mpm_prefork:debug] [pid 7583] prefork.c(995): AH00165: Accept mutex: fcntl (default: sysvsem)
[Sun Dec 06 18:51:47.379529 2015] [core:info] [pid 7583] AH00096: removed PID file /var/run/apache2/apache2.pid (pid=7583)
[Sun Dec 06 18:51:47.379591 2015] [mpm_prefork:notice] [pid 7583] AH00170: caught SIGWINCH, shutting down gracefully
[Sun Dec 06 18:52:45.117602 2015] [mpm_prefork:notice] [pid 8060] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.14 configured -- resuming normal operations
[Sun Dec 06 18:52:45.117739 2015] [mpm_prefork:info] [pid 8060] AH00164: Server built: Oct 14 2015 14:20:21
[Sun Dec 06 18:52:45.117762 2015] [core:notice] [pid 8060] AH00094: Command line: '/usr/sbin/apache2'
[Sun Dec 06 18:52:45.117775 2015] [mpm_prefork:debug] [pid 8060] prefork.c(995): AH00165: Accept mutex: fcntl (default: sysvsem)
[Sun Dec 06 18:55:39.351834 2015] [mpm_prefork:error] [pid 8060] AH00161: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting
[Sun Dec 06 19:12:29.541813 2015] [core:notice] [pid 8060] AH00051: child pid 8064 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:12:29.542039 2015] [core:notice] [pid 8060] AH00051: child pid 8194 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:12:29.542131 2015] [core:notice] [pid 8060] AH00051: child pid 8066 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:12:29.542215 2015] [core:notice] [pid 8060] AH00051: child pid 8067 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:12:29.542296 2015] [core:notice] [pid 8060] AH00051: child pid 8072 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:12:29.542387 2015] [core:notice] [pid 8060] AH00051: child pid 8195 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:12:29.542469 2015] [core:notice] [pid 8060] AH00051: child pid 8075 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:12:29.542543 2015] [core:notice] [pid 8060] AH00051: child pid 8077 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:12:29.542615 2015] [core:notice] [pid 8060] AH00051: child pid 8078 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:12:29.542683 2015] [core:notice] [pid 8060] AH00051: child pid 8079 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:12:29.542756 2015] [core:notice] [pid 8060] AH00051: child pid 8199 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:12:29.542839 2015] [core:notice] [pid 8060] AH00051: child pid 8200 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:12:29.542941 2015] [core:notice] [pid 8060] AH00051: child pid 8082 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:12:29.543026 2015] [core:notice] [pid 8060] AH00051: child pid 8202 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:12:29.543108 2015] [core:notice] [pid 8060] AH00051: child pid 8218 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:12:29.543185 2015] [core:notice] [pid 8060] AH00051: child pid 8220 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:12:29.543263 2015] [core:notice] [pid 8060] AH00051: child pid 8222 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:12:29.543335 2015] [core:notice] [pid 8060] AH00051: child pid 8226 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:12:29.543406 2015] [core:notice] [pid 8060] AH00051: child pid 8227 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:12:30.544736 2015] [core:notice] [pid 8060] AH00051: child pid 8068 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:12:30.545033 2015] [core:notice] [pid 8060] AH00051: child pid 8074 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:12:30.545105 2015] [core:notice] [pid 8060] AH00051: child pid 8076 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:12:30.545205 2015] [core:info] [pid 8060] AH00096: removed PID file /var/run/apache2/apache2.pid (pid=8060)
[Sun Dec 06 19:12:30.545217 2015] [mpm_prefork:notice] [pid 8060] AH00169: caught SIGTERM, shutting down
[Sun Dec 06 19:12:31.355230 2015] [mpm_prefork:notice] [pid 13234] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.14 configured -- resuming normal operations
[Sun Dec 06 19:12:31.355315 2015] [mpm_prefork:info] [pid 13234] AH00164: Server built: Oct 14 2015 14:20:21
[Sun Dec 06 19:12:31.355330 2015] [core:notice] [pid 13234] AH00094: Command line: '/usr/sbin/apache2'
[Sun Dec 06 19:12:31.355338 2015] [mpm_prefork:debug] [pid 13234] prefork.c(995): AH00165: Accept mutex: fcntl (default: sysvsem)
[Sun Dec 06 19:16:11.659541 2015] [mpm_prefork:error] [pid 13234] AH00161: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting
[Sun Dec 06 19:20:21.604641 2015] [core:notice] [pid 13234] AH00051: child pid 14168 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:20:21.604750 2015] [core:notice] [pid 13234] AH00051: child pid 13239 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:20:21.604779 2015] [core:notice] [pid 13234] AH00051: child pid 13240 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:20:21.604810 2015] [core:notice] [pid 13234] AH00051: child pid 14174 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:20:21.604831 2015] [core:notice] [pid 13234] AH00051: child pid 13242 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:20:21.604854 2015] [core:notice] [pid 13234] AH00051: child pid 13722 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:20:21.604874 2015] [core:notice] [pid 13234] AH00051: child pid 13258 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:20:21.604894 2015] [core:notice] [pid 13234] AH00051: child pid 13435 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:20:21.604910 2015] [core:notice] [pid 13234] AH00051: child pid 13723 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:20:21.604932 2015] [core:notice] [pid 13234] AH00051: child pid 14175 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:20:21.604951 2015] [core:notice] [pid 13234] AH00051: child pid 14291 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:20:21.604970 2015] [core:notice] [pid 13234] AH00051: child pid 13732 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:20:21.604989 2015] [core:notice] [pid 13234] AH00051: child pid 13442 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:20:21.605009 2015] [core:notice] [pid 13234] AH00051: child pid 13342 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:20:21.605027 2015] [core:notice] [pid 13234] AH00051: child pid 13343 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:20:21.605045 2015] [core:notice] [pid 13234] AH00051: child pid 14183 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:20:21.605065 2015] [core:notice] [pid 13234] AH00051: child pid 13450 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:20:21.605083 2015] [core:notice] [pid 13234] AH00051: child pid 13451 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:20:21.605102 2015] [core:notice] [pid 13234] AH00051: child pid 14376 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:20:21.605120 2015] [core:notice] [pid 13234] AH00051: child pid 14186 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:20:22.606234 2015] [core:notice] [pid 13234] AH00051: child pid 13729 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:20:22.606315 2015] [core:notice] [pid 13234] AH00051: child pid 14360 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Dec 06 19:20:22.606428 2015] [core:info] [pid 13234] AH00096: removed PID file /var/run/apache2/apache2.pid (pid=13234)
[Sun Dec 06 19:20:22.606436 2015] [mpm_prefork:notice] [pid 13234] AH00169: caught SIGTERM, shutting down
[Sun Dec 06 19:20:22.789597 2015] [mpm_prefork:notice] [pid 15861] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.14 configured -- resuming normal operations
[Sun Dec 06 19:20:22.789695 2015] [mpm_prefork:info] [pid 15861] AH00164: Server built: Oct 14 2015 14:20:21
[Sun Dec 06 19:20:22.789715 2015] [core:notice] [pid 15861] AH00094: Command line: '/usr/sbin/apache2'
[Sun Dec 06 19:20:22.789723 2015] [mpm_prefork:debug] [pid 15861] prefork.c(995): AH00165: Accept mutex: fcntl (default: sysvsem)
[Sun Dec 06 19:20:26.800715 2015] [mpm_prefork:info] [pid 15861] AH00162: server seems busy, (you may need to increase StartServers, or Min/MaxSpareServers), spawning 8 children, there are 0 idle, and 12 total children
[Sun Dec 06 19:20:27.807369 2015] [mpm_prefork:info] [pid 15861] AH00162: server seems busy, (you may need to increase StartServers, or Min/MaxSpareServers), spawning 16 children, there are 0 idle, and 20 total children
[Sun Dec 06 19:20:28.810455 2015] [mpm_prefork:error] [pid 15861] AH00161: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting
增加服务器上的 RAM 是否有助于解决此问题?还是我只是错误地配置了 Apache?
先感谢您。