php-fpm leaving zombies

mkniskanen

Verified User
Joined
Sep 17, 2008
Messages
80
Location
Lieksa, Finland
Hi,
I have updated PHP using Custombuild 2.0 but I cannot say whether the problem is in the build process or elsewhere. My problem started by getting warnings from CSF (Configserver firewall) about php-fpm processes staying alive more than half an hour. Being a moron I have neglected them. Today, however, my DA powered server (nginx+php-fpm) refused to work. In nginx error_log I found a dozen or so lines like this

Code:
2017/06/26 09:39:13 [alert] 12926#0: *110350 open socket #10 left in connection 4
2017/06/26 09:39:13 [alert] 12926#0: *110342 open socket #103 left in connection 7
...
2017/06/26 09:39:47 [alert] 7451#0: *9 open socket #108 left in connection 11
2017/06/26 09:39:47 [alert] 7451#0: aborting

Restarting php-fpm71 from DA helped. However, later on I noticed that aside from the main processess (owned by root) there were stale processes owned by the users which obviously had been spawned but not terminated. I also checked my email just to get the same warnings again.

Anybody else experienced the above? I have so far found no definitive answer or a solution. What I am running is one single instance of WordPress (yes, I know, get rid of it) for one customer and about a dozen OpenCart installations. The stale processes seem to come from both of these environments. I am not convinced that it is the PHP code that is to blame. There must be something more to this behaviour. This has been going on almost from day 0 after the installation but I have not paid any attention to it until recently.

I have to say I am very suspicious about the socket method of communication between nginx and php-fpm because this used to produce some gray hair growth earlier.

Maybe it is time for Mr root to start restarting php-fpm every six hours or so...

Edit: The CSF warning mail looks like this
Code:
Time:         Mon Jun 26 19:52:21 2017 +0200
Account:      mycust
Resource:     Process Time
Exceeded:     1848 > 1800 (seconds)
Executable:   /usr/local/php71/sbin/php-fpm71
Command Line: php-fpm: pool mycust
PID:          27057 (Parent PID:11830)
Killed:       No
Markku
 
Last edited:
It is normal to have idle processes. PHP-FPM keeps the spawned processes alive for a bit in case a connection for the same user comes back again. It wastes RAM but saves CPU time in these cases.

You can fine tune your settings in php-fpm.conf. Look for pm.process_idle_timeout - it will show you how much time the idle processes will stay alive.

Also you may switch between dynamic and ondemand mode. Google for it.

Sorry if I misunderstood and it is a different more specific issue.
 
Back
Top