PHP实战

I/O Error with PHP5-FPM, ptrace(

2017-03-21  本文已影响68人  印随2018

一. Google能告诉我们的

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:

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.

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

二. 源码能告诉我们的

下面是打印堆栈信息的核心函数

/****************************************
source: https://launchpad.net/php-fpm
filename: fpm/fpm_trace_ptrace.c
*****************************************/

int fpm_trace_get_long(long addr, long *data)
{
        errno = 0;

        /*
        Reads  a word at the location addr in the child’s memory, 
        returning the word as the result of the ptrace() call
        */
        *data = ptrace(PTRACE_PEEKDATA, traced_pid, (void *) addr, 0);

        if (errno) {
                zlog(ZLOG_STUFF, ZLOG_SYSERROR, "ptrace(PEEKDATA) failed");
                return -1;
        }

        return 0;
}

当获取被跟踪进程的运行数据出错时,就会打印错误信息。这种错误信息应该是无害的。

三. 扩展

ptrace系统函数。

ptrace提供了一种使父进程得以监视和控制其它进程的方式,它还能够改变子进程中的寄存器和内核映像,因而可以实现断点调试和系统调用的跟踪。

上一篇下一篇

猜你喜欢

热点阅读