[14-May-2016 12:03:44] WARNING: [pool www] child 25347, script '/usr/data/ckl-sapi/baiduNotify.php' (request: "POST /baiduNotify.php") executing too slow (10.818417 sec), logging
[14-May-2016 12:03:44] WARNING: [pool www] child 25269, script '/usr/data/ckl-sapi/baiduNotify.php' (request: "POST /baiduNotify.php") executing too slow (10.819982 sec), logging
[14-May-2016 12:03:44] WARNING: [pool www] child 25268, script '/usr/data/ckl-sapi/baiduNotify.php' (request: "POST /baiduNotify.php") executing too slow (12.392415 sec), logging
[14-May-2016 12:04:14] WARNING: [pool www] child 25369, script '/usr/data/ckl-sapi/baiduNotify.php' (request: "POST /baiduNotify.php") executing too slow (10.802581 sec), logging
[14-May-2016 12:17:33] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 0 idle, and 12 total children
[14-May-2016 12:17:34] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 16 children, there are 0 idle, and 17 total children
[14-May-2016 12:17:35] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 4 idle, and 22 total children 从信息看,应该是php进程较少: 经过查看发现进程确实很少,解决如下:
修改配置文件增加进程
vim /usr/local/php/etc/php-fpm.ini
pm = dynamic #动态模式
pm.max_children = 512 #静态开启的进程数
pm.start_servers = 128 #动态模式的起始进程数
pm.min_spare_servers = 128 #动态模式最小进程数
pm.max_spare_servers = 512 #动态模式最大进程数 数值设置,参考自己的实际硬件配置,可以参考 内存/20M 来计算。
重新加载进程
/etc/init.d/php-fpm reload 等待了一点时间发现又报错:
[14-May-2016 12:21:29] ERROR: failed to ptrace(PEEKDATA) pid 27077: Input/output error (5)
[14-May-2016 12:22:13] WARNING: [pool www] child 27024, script '/usr/data/ckl-backend/index.php' (request: "GET /index.php") executing too slow (10.384578 sec), logging
[14-May-2016 12:22:13] ERROR: failed to ptrace(PEEKDATA) pid 27024: Input/output error (5)
[14-May-2016 12:23:33] WARNING: [pool www] child 26924, script '/usr/data/ckl-backend/index.php' (request: "GET /index.php") executing too slow (10.986032 sec), logging
[14-May-2016 12:23:33] ERROR: failed to ptrace(PEEKDATA) pid 26924: Input/output error (5)
[14-May-2016 12:26:29] WARNING: [pool www] child 1918, script '/usr/data/ckl-backend/index.php' (request: "GET /index.php") executing too slow (10.408103 sec), logging
[14-May-2016 12:26:29] ERROR: failed to ptrace(PEEKDATA) pid 1918: Input/output error (5)
查找资料如下:
It usrears you have request_slowlog_timeout enabled. This normally takes any request longer than N seconds, logs that it was taking a long time, then logs a stack trace of the script so you can see what it was doing that was taking so long.
In your case, the stack trace (to determine what the script is doing) is failing. If you're running out of processes, it is because either:
After php-fpm stops the process to trace it, the process fails to resume because of the error tracing it
The process is resuming but continues to run forever.
My first guess would be to disable request_slowlog_timeout. Since it's not working right, it may be doing more harm than good. If this doesn't fix the issue of running out of processes, then set the php.ini max_execution_time to something that will kill the script for sure.