PHP-FPM Stuck: FCGI: attempt to connect to Unix domain socket
We recently started seeing the following errors on one of our servers.
When this occurs we need to restart the PHP-FPM process and this will make the sites work again.
We've tried looking for others with similar error and there is an article regarding the sock file permissions but manually restarting the PHP-FPM process isn't really a solution.
[QUOTE]
[Fri Aug 11 12:39:44.854619 2023] [proxy:error] [pid 19244:tid 22775342626560] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /opt/cpanel/ea-php80/root/usr/var/run/php-fpm/f107b93eaa0e2070f6cb63002873df41c9f8169f.sock (*:80) failed
[Fri Aug 11 12:39:44.854657 2023] [proxy_fcgi:error] [pid 19244:tid 22775342626560] [remote ip:51785] AH01079: failed to make connection to backend: httpd-UDS, referer:
-
Hey there! Can you run this command on the server and see if Apache is restarting frequently? grep Graceful /etc/apache2/logs/error_log0 -
Hey there! Can you run this command on the server and see if Apache is restarting frequently?
grep Graceful /etc/apache2/logs/error_log
Thanks, tried that but nothing recently showing (all over a year ago).0 -
Thanks for checking that. That was the only thought I had, so it might be best to submit a ticket as that is a generic PHP-FPM/Apache error that can have many causes. If you are able to submit a ticket to us, please post the number here so I can follow along. 0 -
Thanks it's #95107922 0 -
Thanks - I'm following along with that now! 0 -
It seems one of the sites on the server was frequently hitting the max_children setting, causing the PHP-FPM issues. 0 -
For those getting the same issue you can diagnose the max_children issue by checking over the different php-fpm logs based on the PHP version. grep max_children /opt/cpanel/ea-php80/root/usr/var/log/php-fpm/error.log
It can be quicker only going over the last x line using something liketail -n 5000 /opt/cpanel/ea-php80/root/usr/var/log/php-fpm/error.log | grep max_children
Now you can certainly increase the amount of workers available to PHP-FPM which we did but as Apache limits are server wide getting heavy load to 1 or more sites could cause the issues we had. I couldn't really get an answer on why this is happening or which part of the chain is failing but either PHP-FPM to stops responding or the connection using fastcgi is failing. Restarting the PHP-FPM service does resolve the problem but I'd rather it not exist in the first place. Based on this we decided to test out LSAPI which is nice as you can use is alongside PHP-FPM so it's not an all or nothing change. We did tweak a few LSAPI settings to accommodate single site heavy load but the move to LSAPI has solved the problem (so far). Not knowing if this could still occur we are planning some load testing to see if we can also cause LSAPI to crash under similar circumstances. TL;DR: Allocate PHP-FPM more children, because this doesn't limit usage it could cause issues still under heavy load. OR switch to another PHP service like LSAPI or even Lightspeed web server.0
Please sign in to leave a comment.
Comments
7 comments