我有很多这样的:
[NOTICE] child 19214 stopped for tracing
[NOTICE] about to trace 19214
[ERROR] ptrace(PEEKDATA) failed: Input/output error (5)
[NOTICE] finished trace of 19214
[WARNING] [pool www] child 19208, script 'blahblah.php' executing too slow (30.041419 sec), logging
[NOTICE] child 19208 stopped for tracing
[NOTICE] about to trace 19208
[ERROR] ptrace(PEEKDATA) failed: Input/output error (5)
[NOTICE] finished trace of 19208
[WARNING] [pool www] child 19218, script 'blahblah.php' executing too slow (30.035029 sec), logging
当 php 达到 max children 时(至少我认为是这种情况)它停止“工作”......现在我知道我可以增加 max_children (当前设置为 9)但是有一种方法可以阻止 php “死亡”?
我使用的是具有 1 个内核和 512 MB 内存的 VPS (PHP5-FPM 5.4.4 + APC 3.1.10)。
禁用慢速日志后,我现在得到:
WARNING: [pool www] child 1684 exited on signal 15 (SIGTERM) after 77.802376 seconds from start
NOTICE: [pool www] child 1694 started
WARNING: [pool www] child 1377, script 'blahblah.php' (request: "GET /blahblah.php") execution timed out (38.291440 sec), terminating
WARNING: [pool www] child 1377 exited on signal 15 (SIGTERM) after 2750.295279 seconds from start
NOTICE: [pool www] child 1696 started
WARNING: [pool www] child 1722, script 'blahblah.php' (request: "POST /blahblah.php") execution timed out (39.653910 sec), terminating
WARNING: [pool www] child 1722 exited on signal 15 (SIGTERM) after 793.953090 seconds from start
我认为这些脚本这么慢是不正常的。你建议玩max_execution_time?
看来你已经
request_slowlog_timeout
启用了。这通常需要超过 N 秒的任何请求,记录它花费了很长时间,然后记录脚本的堆栈跟踪,这样你就可以看到它做了什么花了这么长时间。在您的情况下,堆栈跟踪(以确定脚本正在做什么)失败。如果您的进程用完了,那是因为:
我的第一个猜测是禁用 request_slowlog_timeout。由于它无法正常工作,因此弊大于利。如果这不能解决进程耗尽的问题,那么将 php.ini 设置
max_execution_time
为肯定会终止脚本的内容。对ptrace(PEEKDATA) 失败的更有效解释似乎是这样的——
来自FPM Slowlog sucks,它更详细地解释了整个混乱。