Debian – Apache hangs on “child process X still did not exit, sending a SIGKILL”

apache-2.4debianmpm-eventphp-fpm

I did update on server to php7.3-fpm to get http2 working. Setup everything needed, h2 works great, all websites is up. But like every 5 minutes server get stuck on these errors until I restart apache.

I checked all configs, tried to calculate MaxRequestWorkers, maxclients, pm.max_children, pm.start_servers, pm.min_spare_servers, pm.max_spare_servers. Every change make it worse or make it stay longer.

Server config

  • debian 10
  • apache 2.4.38
  • php 7.3.14
  • 5.8GB memory
  • 2 x Intel(R) Xeon(R) CPU E3-1585L v5 @ 3.00GHz

Server stats

Errors

[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

Server mpm-event.conf

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

Thanks for support,

Best Answer

You may need to switch your MPM from event to prefork. Most versions of PHP are still not thread safe, and the only MPM that's safe to use with non-thread-safe code is prefork, since it creates new processes, instead of threads, to handle new requests.