解決NGINX+PHP-FPM failed to ptrace(PEEKDATA) Input/output error出錯問題

網站總是出現bad gateway 提示,時有,時無,查看了一下日誌,居然出現一堆錯誤,如下

[29-Mar-2014 22:40:10] ERROR: failed to ptrace(PEEKDATA) pid 4276: Input/output error (5)
[29-Mar-2014 22:53:54] ERROR: failed to ptrace(PEEKDATA) pid 4319: Input/output error (5)
[29-Mar-2014 22:56:30] ERROR: failed to ptrace(PEEKDATA) pid 4342: Input/output error (5)
[29-Mar-2014 22:56:34] ERROR: failed to ptrace(PEEKDATA) pid 4321: Input/output error (5)
[29-Mar-2014 22:56:40] ERROR: failed to ptrace(PEEKDATA) pid 4314: Input/output error (5)

網上也找了很多方法,很多人說是rlimit_files 打開文件數的問題,但是覺得不太靠譜,最後找到鬼佬的話,看上去還有幾分道理。

http://serverfault.com/questions/406532/i-o-error-with-php5-fpm-ptracepeekdata-failed

It appears 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:

  1. After php-fpm stops the process to trace it, the process fails to resume because of the error tracing it

  2. 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.

 

看樣子是因爲我打開了slowlog  然後,再設置 了 request_slowlog_timeout 這個參數,,所以後php 沒有執行完就出錯了。。

上面解決的辦法是:

禁用 php-fpm.conf 裏的  request_slowlog_timeout  和 slowlog  ,然後,修改 php.ini 裏的  max_execution_time 參數


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章