X
X
xaseros2015-08-14 13:16:34
PHP
xaseros, 2015-08-14 13:16:34

Why is php5-fpm spawning processes and not responding to frontend requests?

Hello.
There is a fairly powerful server (dedicated, 4 xeon cores, 32 memory, SSD). On which, for some unknown reason, php-fpm stops working. At some time, it simply stops responding to requests, and a bunch of its pools hang in the processes.

root     17085  0.0  0.0 333852 20156 ?        Ss   Aug12   0:12 php-fpm: master process (/etc/php5/fpm/php-fpm.conf)                    
www-data 25473  0.0  0.0 859832 26180 ?        Sl   07:30   0:00 php-fpm: pool www                                                       
www-data 25474  0.0  0.0 856492 19976 ?        Sl   07:30   0:00 php-fpm: pool www                                                       
www-data 25477  0.0  0.0 855764 21748 ?        Sl   07:30   0:00 php-fpm: pool www                                                       
www-data 25479  0.0  0.0 855688 20408 ?        Sl   07:30   0:00 php-fpm: pool www                                                       
www-data 25485  0.0  0.0 854708 20112 ?        Sl   07:31   0:00 php-fpm: pool www

and there are 202 of them.
There is nothing in the logs except for nginx errors (php5-fpm log is clean)
2015/08/14 09:00:11 [error] 17824#0: *596666 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 180.153.182.101, server: example.ru, request: "GET /ballu/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:8888", host: "www.example.ru", referrer: "http://www.example.ru/ballu/"
2015/08/14 09:13:42 [error] 17822#0: *596916 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 80.251.228.162, server: example.ru, request: "GET /100053721/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:8888", host: "www.example.ru"

and stuff like that
config /etc/php5/fpm/pool.d/www.conf (comments removed)
[www]
user = www-data
group = www-data
listen = 127.0.0.1:8888; 
pm = dynamic
pm.max_children = 200
pm.start_servers = 10
pm.min_spare_servers = 10
pm.max_spare_servers = 10 
access.log = /var/log/php5-fpm/$pool.access.log 
chdir = /
security.limit_extensions = .php

config /etc/php5/fpm/php-fpm.conf (comments removed)
[global]
pid = /run/php5-fpm.pid
error_log = /var/log/php5-fpm.log
log_level = debug
emergency_restart_threshold = 8
emergency_restart_interval = 60
process_control_timeout = 10  
include=/etc/php5/fpm/pool.d/*.conf

Until recently, worked on sockets. But since the problem manifests itself stably, I tried to translate it into ports. There is no result. I can't figure out what the problem is.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sim3x, 2015-08-14
@xaseros

serverfault.com/questions/344538/php-fpms-chroot-a...
or do a chroot or do a proper chdir
Do not use pm = dynamic on a loaded project - it will take more time to create threads than to process

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question