我们的一个用户环境有 Apache/2.4.34 (Win32) OpenSSL/1.0.2o 配置。Apache 进程每天退出一次并自动重新启动。重新启动后一切正常。他们已应用补丁 (SSL)。这可能是重新启动的原因吗?Apache/2.4.34 (Win32) OpenSSL/1.0.2o 配置是否存在兼容性问题
Apache 进程在不到一天的时间内将内存增加到 1.5G,大约在午夜 12 点,它会自动释放内存,然后有时会立即重新启动,有时会正常运行几个小时,然后重新启动并退出代码为 3221225477 。
我的疑问是如何检查内存增加的原因以及如何找到重新启动的原因?
通常错误日志不会报告除 AH00428 之外的任何错误:父进程:子进程 xxxxx 以状态 3221225477 退出——正在重新启动。
访问日志似乎没问题。重启时我们在 access.log 中没有看到任何日志消息。一两天来,我们在午夜左右在 error.log 中观察到以下错误,但 apache 在这些错误之后没有立即重启。
XPath error : Memory allocation failed : adding step
adding step
^
xmlXPathRunEval: last is less than zero
XPath error : Invalid expression
[Fri Sep 04 03:19:18.366953 2020] [mpm_winnt:notice] [pid 8676:tid 600] AH00428: Parent: child process 7876 exited with status 3221226356 -- Restarting
[core:error] [pid 3120:tid 5476] (20024)The given path is misformatted or contained invalid characters: [client 10.224.161.254:59619] AH00127: Cannot map GET /</index.jsp HTTP/1.0 to file
[Sat Sep 05 00:31:06.854780 2020] [core:error] [pid 3120:tid 5476] (20024)The given path is misformatted or contained invalid characters: AH00127: Cannot map GET /%20/index.jsp HTTP/1.0 to file
Error.log 报告如下内容
[Mon Sep 07 04:01:09.222200 2020] [ssl:warn] [pid 10512:tid 604] AH01909: localhost:443:0 server certificate does NOT include an ID which matches the server name
[Mon Sep 07 04:01:09.223197 2020] [mpm_winnt:notice] [pid 10512:tid 604] AH00455: Apache/2.4.34 (Win32) OpenSSL/1.0.2o configured -- resuming normal operations
[Mon Sep 07 04:01:09.223197 2020] [mpm_winnt:notice] [pid 10512:tid 604] AH00456: Server built: Jul 10 2018 09:24:15
[Mon Sep 07 04:01:09.223197 2020] [core:notice] [pid 10512:tid 604] AH00094: Command line: 'D:\\apache\\bin\\httpd.exe -d D:/apache'
[Mon Sep 07 04:01:09.236194 2020] [mpm_winnt:notice] [pid 10512:tid 604] AH00418: Parent: Created child process 10256
[Mon Sep 07 04:01:11.760328 2020] [ssl:warn] [pid 10256:tid 452] AH01909: localhost:443:0 server certificate does NOT include an ID which matches the server name
[Mon Sep 07 04:01:12.710371 2020] [ssl:warn] [pid 10256:tid 452] AH01909: localhost:443:0 server certificate does NOT include an ID which matches the server name
[Mon Sep 07 04:01:12.919224 2020] [:notice] [pid 10256:tid 452] settig CRYPTO ID callback: libeay32 found
[Mon Sep 07 04:01:12.919224 2020] [:notice] [pid 10256:tid 452] settig CRYPTO ID callback: new callback set
[Mon Sep 07 04:01:12.919224 2020] [:notice] [pid 10256:tid 452] mod_aipx start_handler called - begin
[Mon Sep 07 04:01:12.919224 2020] [:notice] [pid 10256:tid 452] mod_aipx start_handler: set path variable succeeds
[Mon Sep 07 04:01:12.919224 2020] [:notice] [pid 10256:tid 452] D:\\bin;D:\\Program Files (x86)\\CA\\SC\\CAWIN\\;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files (x86)\\Microsoft SQL Server\\110\\Tools\\Binn\\ManagementStudio\\;C:\\Program Files (x86)\\Microsoft SQL Server\\110\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\110\\Tools\\Binn\\;C:\\Program Files (x86)\\Microsoft SQL Server\\110\\DTS\\Binn\\;ent\\python-embed-amd64;D:\\Program Files (x86)\\SC\\CAM\\bin;D:\\Program Files (x86)\\SC\\IDMgrApi\\bin\\;D:\\Program Files\\Directory\\dxserver\\bin;D:\\Program Files\\Directory\\dxserver\\dxagent\\python-embed-amd64;C:\\Users\\vaimadminq\\AppData\\Local\\Microsoft\\WindowsApps
[Mon Sep 07 04:01:15.911022 2020] [:notice] [pid 10256:tid 452] mod_aipx start_handler: Successfully set the security credentials.
[Mon Sep 07 04:01:15.911022 2020] [:notice] [pid 10256:tid 452] Validating SQL is available
[Mon Sep 07 04:01:15.973024 2020] [:notice] [pid 10256:tid 452] SQL is available
[Mon Sep 07 04:01:15.973024 2020] [:notice] [pid 10256:tid 452] Validating ActiveMQ is available
[Mon Sep 07 04:01:16.157035 2020] [:notice] [pid 10256:tid 452] ActiveMQ is available
[Mon Sep 07 04:01:16.157035 2020] [:notice] [pid 10256:tid 452] mod_aipx start_handler called - begin StartComponents thread
[Mon Sep 07 04:01:16.157035 2020] [:notice] [pid 10256:tid 452] mod_aipx start_handler called - schedule ActiveMQStatsMonitor task
[Mon Sep 07 04:01:16.158034 2020] [:notice] [pid 10256:tid 2172] StartComponents - begin
[Mon Sep 07 04:01:16.375055 2020] [mpm_winnt:notice] [pid 10256:tid 452] AH00354: Child: Starting 360 worker threads.
[Mon Sep 07 04:01:17.247477 2020] [:notice] [pid 10256:tid 2172] StartComponents - Security Credentials attached successfully
[Mon Sep 07 04:01:17.247477 2020] [:notice] [pid 10256:tid 2172] StartComponents - Using prefix URL: xxxxxxxx:443
[Mon Sep 07 04:01:18.338533 2020] [:notice] [pid 10256:tid 2172] StartComponents - now starting component xxxxxxxx:443/aip/sc
[Mon Sep 07 04:01:22.800542 2020] [:notice] [pid 10256:tid 2172] StartComponents - xxxxxxxx:443/aip/sc startup successful; elapsed time 4.461 sec.
[Mon Sep 07 04:01:22.800542 2020] [:notice] [pid 10256:tid 2172] StartComponents - now starting component xxxxxxxx:443/aip/AOM
[Mon Sep 07 04:01:25.148664 2020] [:notice] [pid 10256:tid 2172] StartComponents - xxxxxxxx:443/aip/AOM startup successful; elapsed time 2.348 sec.
[Mon Sep 07 04:01:25.149664 2020] [:notice] [pid 10256:tid 2172] StartComponents - now starting component xxxxxxxx:443/aip/AuditService
[Mon Sep 07 04:01:25.987706 2020] [:notice] [pid 10256:tid 2172] StartComponents - xxxxxxxx:443/aip/AuditService startup successful; elapsed time 0.838 sec.
[Mon Sep 07 04:01:25.987706 2020] [:notice] [pid 10256:tid 2172] StartComponents - now starting component xxxxxxxx:443/aip/DSC
[Mon Sep 07 04:01:26.428729 2020] [:notice] [pid 10256:tid 2172] StartComponents - xxxxxxxx:443/aip/DSC startup successful; elapsed time 0.441 sec.
[Mon Sep 07 04:01:26.428729 2020] [:notice] [pid 10256:tid 2172] StartComponents - now starting component xxxxxxxx:443/aip/Policy
[Mon Sep 07 04:01:26.658744 2020] [:notice] [pid 10256:tid 2172] StartComponents - xxxxxxxx:443/aip/Policy startup successful; elapsed time 0.230 sec.
[Mon Sep 07 04:01:26.658744 2020] [:notice] [pid 10256:tid 2172] StartComponents - now starting component xxxxxxxx:443/aip/resourcemgr
[Mon Sep 07 04:01:27.668792 2020] [:notice] [pid 10256:tid 2172] StartComponents - xxxxxxxx:443/aip/resourcemgr startup successful; elapsed time 1.010 sec.
[Mon Sep 07 04:01:27.669795 2020] [:notice] [pid 10256:tid 2172] StartComponents - now starting component xxxxxxxx:443/aip/sch
[Mon Sep 07 04:01:27.916806 2020] [:notice] [pid 10256:tid 2172] StartComponents - xxxxxxxx:443/aip/sch startup successful; elapsed time 0.247 sec.
[Mon Sep 07 04:01:27.916806 2020] [:notice] [pid 10256:tid 2172] StartComponents - now starting component xxxxxxxx:443/aip/StateEngine
[Mon Sep 07 04:01:28.192821 2020] [:notice] [pid 10256:tid 2172] StartComponents - xxxxxxxx:443/aip/StateEngine startup successful; elapsed time 0.275 sec.
[Mon Sep 07 04:01:28.192821 2020] [:notice] [pid 10256:tid 2172] StartComponents - now starting component xxxxxxxx:443/aip/alarmmanager
[Mon Sep 07 04:01:28.645843 2020] [:notice] [pid 10256:tid 2172] StartComponents - xxxxxxxx:443/aip/alarmmanager startup successful; elapsed time 0.453 sec.
[Mon Sep 07 04:01:28.646841 2020] [:notice] [pid 10256:tid 2172] StartComponents - now starting component xxxxxxxx:443/aip/trapreceiver
[Mon Sep 07 04:01:28.869852 2020] [:notice] [pid 10256:tid 2172] StartComponents - xxxxxxxx:443/aip/trapreceiver startup successful; elapsed time 0.223 sec.
[Mon Sep 07 04:01:28.870852 2020] [:notice] [pid 10256:tid 2172] StartComponents - now starting component xxxxxxxx:443/aip/casesy
[Mon Sep 07 04:01:29.348875 2020] [:notice] [pid 10256:tid 2172] StartComponents - xxxxxxxx:443/aip/casesy startup successful; elapsed time 0.478 sec.
[Mon Sep 07 04:01:29.348875 2020] [:notice] [pid 10256:tid 2172] StartComponents - now starting component xxxxxxxx:443/dpm/img
[Mon Sep 07 04:01:29.784901 2020] [:notice] [pid 10256:tid 2172] StartComponents - xxxxxxxx:443/dpm/img startup successful; elapsed time 0.436 sec.
[Mon Sep 07 04:01:29.785901 2020] [:notice] [pid 10256:tid 2172] StartComponents - now starting component xxxxxxxx:443/dpm/ISM
[Mon Sep 07 04:01:30.237925 2020] [:notice] [pid 10256:tid 2172] StartComponents - xxxxxxxx:443/dpm/ISM startup successful; elapsed time 0.452 sec.
[Mon Sep 07 04:01:30.238924 2020] [:notice] [pid 10256:tid 2172] StartComponents - listening for component configuration changes
[Tue Sep 08 03:11:43.070281 2020] [mpm_winnt:notice] [pid 10512:tid 604] AH00428: Parent: child process 10256 exited with status 3221225477 -- Restarting.
[Tue Sep 08 03:11:45.208430 2020] [ssl:warn] [pid 10512:tid 604] AH01909: localhost:443:0 server certificate does NOT include an ID which matches the server name
[Tue Sep 08 03:11:45.209431 2020] [mpm_winnt:notice] [pid 10512:tid 604] AH00455: Apache/2.4.34 (Win32) OpenSSL/1.0.2o configured -- resuming normal operations
[Tue Sep 08 03:11:45.209431 2020] [mpm_winnt:notice] [pid 10512:tid 604] AH00456: Server built: Jul 10 2018 09:24:15
[Tue Sep 08 03:11:45.209431 2020] [core:notice] [pid 10512:tid 604] AH00094: Command line: 'D:\\apache\\bin\\httpd.exe -d D:/apache'
[Tue Sep 08 03:11:45.221435 2020] [mpm_winnt:notice] [pid 10512:tid 604] AH00418: Parent: Created child process 3872
apache httpd.conf 具有以下配置
LoadModule alias_module modules/mod_alias.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule ssl_module modules/mod_ssl.so
<IfModule mpm_winnt_module>
ThreadsPerChild 360
MaxRequestsPerChild 0
</IfModule>
<IfModule ssl_module>
Include conf/extra/httpd-ssl.conf
#Include conf/extra/httpd-ahssl.conf
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
<IfModule http2_module>
ProtocolsHonorOrder On
Protocols h2 h2c http/1.1
</IfModule>
TraceEnable off
LoadModule gsoap_module modules/mod_gsoap.so
他们没有在午夜安排任何事,他们有一个每天 4 点运行的 cron 作业,这个 cron 作业每天还会重新启动 apache。抱歉发了这么长的帖子。任何帮助都将不胜感激。
答案1
由于 Apache 默认堆栈大小较小,此问题经常发生在 Windows 中。并且它通常发生在使用分配大量堆栈的 php 代码时。
为了解决这个问题,在 apache 配置文件 httpd.conf 的末尾添加以下内容
<IfModule mpm_winnt_module>
ThreadStackSize 8888888
</IfModule>
欲了解更多信息,请参阅下面的帖子。