marklcfc Posted February 6, 2023 Posted February 6, 2023 I've been getting internal server errors for the last few months whenever the site gets busy normally. The server isn't overloaded but this is the error in logs 2023/01/10 21:20:49 [alert] 127868#127868: *28491671 socket() failed (24: Too many open files) while connecting to upstream My hosts don't seem to know and have increased the open files limit to a high amount but it still happening and now just pointing me in your direction to ask how you handle traffic as I've got 167 children spawning which may be causing too many open files? But this was happening at 1am in the morning when the site wasn't busy. Any ideas?
Randy Calvert Posted February 6, 2023 Posted February 6, 2023 This looks to be an issue with your php_fpm config. Those variables it’s complaining about is where I would start my analysis. By the way if it’s always happening at 1am, my guess is you have some sort of bot aggressively crawling your site at that time or the host is also doing backups or something similar.
Marc Posted February 6, 2023 Posted February 6, 2023 Unfortunately without more information, there isnt really anything to point to software being an issue there. Only your hosting company would be able to assist with this
marklcfc Posted February 6, 2023 Author Posted February 6, 2023 I'm not sure what more information to provide, all I know is the too many open files erro didn't seem to happen before I set up Cloudflare. I don't know if its related or not.
Marc Posted February 6, 2023 Posted February 6, 2023 17 minutes ago, marklcfc said: I'm not sure what more information to provide, all I know is the too many open files erro didn't seem to happen before I set up Cloudflare. I don't know if its related or not. There would certainly be one way to test that. Remove cloudflare again
Randy Calvert Posted February 6, 2023 Posted February 6, 2023 (edited) Cloudflare will use persistent connections. Meaning it will open a connection and keep using the same one for multiple requests. As a result, if your server is having issues with that, disabling CF MIGHT help. But... what I am telling you though is based on the output of what you pasted... your PHP-FPM settings may simply need updated. Increase the pm.start_servers value in your PHP-FPM config file. Then restart PHP-FPM. Your host should be able to do this. Edited February 6, 2023 by Randy Calvert
marklcfc Posted February 6, 2023 Author Posted February 6, 2023 (edited) 24 minutes ago, Randy Calvert said: But... what I am telling you though is based on the output of what you pasted... your PHP-FPM settings may simply need updated. Increase the pm.start_servers value in your PHP-FPM config file. Then restart PHP-FPM. Your host should be able to do this. What would you recommend increasing them to? This is what they are at the moment Edited February 6, 2023 by marklcfc
Jim M Posted February 6, 2023 Posted February 6, 2023 1 minute ago, marklcfc said: What would you recommend increasing them to? This is what they are at the moment I would recommend working with your hosting provider on any server configuration change.
Randy Calvert Posted February 6, 2023 Posted February 6, 2023 Also... those settings are for Apache, not for FPM used by PHP. 🙂 https://www.inmotionhosting.com/support/server/php-fpm/php-fpm-settings-for-better-optimization/
marklcfc Posted February 6, 2023 Author Posted February 6, 2023 26 minutes ago, Randy Calvert said: Also... those settings are for Apache, not for FPM used by PHP. 🙂 https://www.inmotionhosting.com/support/server/php-fpm/php-fpm-settings-for-better-optimization/ It is under my PHP-FPM though
Randy Calvert Posted February 6, 2023 Posted February 6, 2023 It's weird they're not labeling it with the actual pm.start_server name. I would start by increasing the start servers to 10, the min_spare to 10 and max_spare to 20. It's hard to say what your server can support in terms of memory etc, what else is already running, etc. But that should at least reduce the impact some.
Recommended Posts