Debian

Apache 掛起“子程序 X 仍未退出,發送 SIGKILL”

  • November 26, 2020

我確實在伺服器上更新到php7.3-fpm以使http2正常工作。設置所需的一切,h2 執行良好,所有網站都已啟動。但是就像每 5 分鐘伺服器就會卡在這些錯誤上,直到我重新啟動 apache。

我檢查了所有配置,嘗試計算 MaxRequestWorkers、maxclients、pm.max_children、pm.start_servers、pm.min_spare_servers、pm.max_spare_servers。每一次改變都會讓它變得更糟或讓它停留更長時間。

伺服器配置

  • Debian 10
  • 阿帕奇 2.4.38
  • php 7.3.14
  • 5.8GB記憶體
  • 2 x Intel(R) Xeon(R) CPU E3-1585L v5 @ 3.00GHz

伺服器統計

錯誤

[Tue Nov 03 15:30:07.450356 2020] [core:warn] [pid 31147:tid 139885881660544] AH00045: child process 31148 still did not exit, sending a SIGTERM
[Tue Nov 03 15:30:07.450391 2020] [core:warn] [pid 31147:tid 139885881660544] AH00045: child process 31149 still did not exit, sending a SIGTERM
[Tue Nov 03 15:30:07.450397 2020] [core:warn] [pid 31147:tid 139885881660544] AH00045: child process 5692 still did not exit, sending a SIGTERM
[Tue Nov 03 15:30:07.450401 2020] [core:warn] [pid 31147:tid 139885881660544] AH00045: child process 5860 still did not exit, sending a SIGTERM
[Tue Nov 03 15:30:07.450406 2020] [core:warn] [pid 31147:tid 139885881660544] AH00045: child process 5982 still did not exit, sending a SIGTERM
[Tue Nov 03 15:30:07.450410 2020] [core:warn] [pid 31147:tid 139885881660544] AH00045: child process 6138 still did not exit, sending a SIGTERM
[Tue Nov 03 15:30:09.452520 2020] [core:warn] [pid 31147:tid 139885881660544] AH00045: child process 31148 still did not exit, sending a SIGTERM
[Tue Nov 03 15:30:09.452556 2020] [core:warn] [pid 31147:tid 139885881660544] AH00045: child process 31149 still did not exit, sending a SIGTERM
[Tue Nov 03 15:30:09.452562 2020] [core:warn] [pid 31147:tid 139885881660544] AH00045: child process 5692 still did not exit, sending a SIGTERM
[Tue Nov 03 15:30:09.452567 2020] [core:warn] [pid 31147:tid 139885881660544] AH00045: child process 5860 still did not exit, sending a SIGTERM
[Tue Nov 03 15:30:09.452573 2020] [core:warn] [pid 31147:tid 139885881660544] AH00045: child process 5982 still did not exit, sending a SIGTERM
[Tue Nov 03 15:30:09.452578 2020] [core:warn] [pid 31147:tid 139885881660544] AH00045: child process 6138 still did not exit, sending a SIGTERM
[Tue Nov 03 15:30:11.454710 2020] [core:warn] [pid 31147:tid 139885881660544] AH00045: child process 31148 still did not exit, sending a SIGTERM
[Tue Nov 03 15:30:11.454739 2020] [core:warn] [pid 31147:tid 139885881660544] AH00045: child process 31149 still did not exit, sending a SIGTERM
[Tue Nov 03 15:30:11.454744 2020] [core:warn] [pid 31147:tid 139885881660544] AH00045: child process 5692 still did not exit, sending a SIGTERM
[Tue Nov 03 15:30:11.454760 2020] [core:warn] [pid 31147:tid 139885881660544] AH00045: child process 5860 still did not exit, sending a SIGTERM
[Tue Nov 03 15:30:11.454764 2020] [core:warn] [pid 31147:tid 139885881660544] AH00045: child process 5982 still did not exit, sending a SIGTERM
[Tue Nov 03 15:30:11.454768 2020] [core:warn] [pid 31147:tid 139885881660544] AH00045: child process 6138 still did not exit, sending a SIGTERM
[Tue Nov 03 15:30:13.456926 2020] [core:error] [pid 31147:tid 139885881660544] AH00046: child process 31148 still did not exit, sending a SIGKILL
[Tue Nov 03 15:30:13.456983 2020] [core:error] [pid 31147:tid 139885881660544] AH00046: child process 31149 still did not exit, sending a SIGKILL
[Tue Nov 03 15:30:13.457006 2020] [core:error] [pid 31147:tid 139885881660544] AH00046: child process 5692 still did not exit, sending a SIGKILL
[Tue Nov 03 15:30:13.457028 2020] [core:error] [pid 31147:tid 139885881660544] AH00046: child process 5860 still did not exit, sending a SIGKILL
[Tue Nov 03 15:30:13.457059 2020] [core:error] [pid 31147:tid 139885881660544] AH00046: child process 5982 still did not exit, sending a SIGKILL
[Tue Nov 03 15:30:13.457094 2020] [core:error] [pid 31147:tid 139885881660544] AH00046: child process 6138 still did not exit, sending a SIGKILL
[Tue Nov 03 15:30:14.458349 2020] [mpm_event:notice] [pid 31147:tid 139885881660544] AH00491: caught SIGTERM, shutting down

伺服器mpm-event.conf

<IfModule mpm_event_module>
   StartServers             2
   MinSpareThreads      25
   MaxSpareThreads      75
   ThreadLimit          64
   ThreadsPerChild      25
   MaxRequestWorkers     150
   MaxConnectionsPerChild   0
</IfModule>

感謝您的支持,

您可能需要將 MPM 從事件切換到預分叉。大多數版本的 PHP 仍然不是執行緒安全的,唯一可以安全使用非執行緒安全程式碼的 MPM 是 prefork,因為它創建新程序而不是執行緒來處理新請求。

引用自:https://serverfault.com/questions/1041127