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:

  1. Restarted PHP-FPM multiple times to no effect.
  2. Disabled Xdebug and OPCache, and restarted PHP-FPM.
  3. 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?

migrated from stackoverflow.com Jun 16 '14 at 16:41

This question came from our site for professional and enthusiast programmers.

  • How are you connecting to php-fpm from Nginx? – jeffatrackaid Jun 9 '14 at 16:48
  • @jeffatrackaid Through a unix socket. I'm pretty sure the request is getting to PHP-FPM, as it is logging it as a slow request....hmm, I wonder if it could be slow at reading the data of the request.... – Danack Jun 10 '14 at 12:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.