I am running PHP as PHP-FPM behind Nginx. Occasionally one of the pools stops responding to requests. It seems that nginx is accepting the connection, passing it to PHP-FPM but then PHP-FPM is not giving a response. This happens for all requests to that pool, including those that should normally run very quickly.
I have logging enabled for slow PHP-FPM. Normally this gives a stack trace of what functions had been called when the slow log time was reached, but in the slow log I see:
[08-Jun-2014 16:40:49] [pool imagick] pid 16825 script_filename = /home/github/imagick-demos//imagick/index.php [0x00007fa70269c1c8] +++ dump failed
and in the PHP-FPM log I see:
WARNING: [pool imagick] child 17502, script '/home/github/imagick-demos//imagick/index.php' (request: "GET /index.php") executing too slow (10.459610 sec), logging NOTICE: child 17502 stopped for tracing NOTICE: about to trace 17502 ERROR: failed to ptrace(PEEKDATA) pid 17502: Input/output error (5) NOTICE: finished trace of 17502
i.e. the trace of what is causing the slowness has failed.
The other PHP-FPM pools are responding fine. What's weird is that just restarting PHP-FPM does not appear to fix this. However when it just happened now, I did the following:
- Restarted PHP-FPM multiple times to no effect.
- Disabled Xdebug and OPCache, and restarted PHP-FPM.
- Re-enabled Xdebug and OPCache, and restarted PHP-FPM.
After that the pool started responding again normally. I was monitoring PHP-FPM with strace, and there is nothing obviously blocking or failing in there.
What can cause PHP-FPM to be blocked like this?