Symptoms
- The server is slow and websites take too long to load or they do not load at all, while generating 504 errors at the same time
- The Apache error log indicates that the Apache web server is having difficulties with the termination of some processes:
[Fri Nov 17 16:11:45.225766 2023] [core:warn] [pid 27150:tid 139707243858880] AH00045: child process 29995 still did not exit, sending a SIGTERM
[Fri Nov 17 16:11:45.225929 2023] [core:warn] [pid 27150:tid 139707243858880] AH00045: child process 31367 still did not exit, sending a SIGTERM
[Fri Nov 17 16:11:45.226032 2023] [core:warn] [pid 27150:tid 139707243858880] AH00045: child process 959 still did not exit, sending a SIGTERM
...
[Fri Nov 17 16:11:47.250484 2023] [core:error] [pid 27150:tid 139707243858880] AH00046: child process 29995 still did not exit, sending a SIGKILL
[Fri Nov 17 16:11:47.250957 2023] [core:error] [pid 27150:tid 139707243858880] AH00046: child process 31367 still did not exit, sending a SIGKILL
[Fri Nov 17 16:11:47.251313 2023] [core:error] [pid 27150:tid 139707243858880] AH00046: child process 959 still did not exit, sending a SIGKILL -
The command below shows high RAM usage:
# free -h
-
The command below shows more PHP-FPM child processes than allowed under pm.max_children in Domains > example.com > PHP Settings:
# ps faux | grep fpm
...
root 2482 0.0 0.2 583108 20784 ? Ss Jan16 0:55 php-fpm: master process (/opt/plesk/php/7.4/etc/php-fpm.conf)
exampl+ 17707 4.0 0.2 583800 22940 ? S 15:28 0:00 _ php-fpm: pool example.com
exampl+ 17707 4.0 0.2 583800 22940 ? S 15:28 0:00 _ php-fpm: pool example.com
exampl+ 17707 4.0 0.2 583800 22940 ? S 15:28 0:00 _ php-fpm: pool example.com
exampl+ 17707 4.0 0.2 583800 22940 ? S 15:28 0:00 _ php-fpm: pool example.com
exampl+ 17707 4.0 0.2 583800 22940 ? S 15:28 0:00 _ php-fpm: pool example.com
exampl+ 17707 4.0 0.2 583800 22940 ? S 15:28 0:00 _ php-fpm: pool example.com
exampl+ 17707 4.0 0.2 583800 22940 ? S 15:28 0:00 _ php-fpm: pool example.com
exampl+ 17707 4.0 0.2 583800 22940 ? S 15:28 0:00 _ php-fpm: pool example.com
exampl+ 17707 4.0 0.2 583800 22940 ? S 15:28 0:00 _ php-fpm: pool example.com
exampl+ 17707 4.0 0.2 583800 22940 ? S 15:28 0:00 _ php-fpm: pool example.com
...
exampl+ 17707 4.0 0.2 583800 22940 ? S 15:28 0:00 _ php-fpm: pool example.com
Cause
The pm variable in PHP Settings is set to ondemand, which means that PHP-FPM will fork processes when requests are received and that can overwhelm your Plesk server in certain scenarios where too many processes stay active for too long.
Resolution
-
Go to Domains > example.com > PHP Settings
-
In the pm dropdown, choose either static (this ensures a fixed number of child processes defined by pm.child_processes are always available to handle user requests) or dynamic (In this mode, PHP-FPM dynamically manages the number of available child processes and ensures that at least one child process is always available, but the process count will not go higher than the amount configured in the pm.child_processes).