Nginx + php-fpm "504 Gateway Time-out" error with almost zeroload(on a test-server)
r at roze.lv
Tue Sep 7 20:56:23 MSD 2010
First of all I just noticed this in your initial mail:
2010/09/06 22:09:40 [error] 12909#0: *1064 connect() failed (111: Connection
refused) while connecting to upstream, client: 192.168.0.1, server:
rahul286.rtcamp.info, request: "GET /favicon.ico HTTP/1.1", upstream:
"fastcgi://127.0.0.1:9000", host: "rahul286.rtcamp.info"
Have you by chance misconfigurated the nginx and passing also static files
(in this case favicon.ico) to php backend??
> Debugging php-fpm log was first thing I did.
And nothing in there?
> I am using "log_level = debug"
Debug prolly will end up as too much information anyways where in general
you just need to catch something like this to pinpoint the slow scripts (for
Sep 07 18:51:01.536661 [NOTICE] [pool www] child 17460 exited with code 0
after 5875.977592 seconds from start
Sep 07 18:51:01.537240 [NOTICE] [pool www] child 18471 started
Sep 07 19:12:26.791721 [WARNING] [pool www] child 18409, script
'/data/web/root/index.php' executing too slow (5.103076 sec), logging
Sep 07 19:12:26.791790 [NOTICE] child 18409 stopped for tracing
Sep 07 19:12:26.791799 [NOTICE] about to trace 18409
Sep 07 19:12:26.791932 [ERROR] ptrace(PEEKDATA) failed: Input/output error
Sep 07 19:12:26.791980 [NOTICE] finished trace of 18409
> With my pathetic patchwork, as I am restarting php5-fpm every minute,
> above kind of "blockage" is not getting created.
This is the job for FPM itself and no external tools / jobs should be
You could try (if not allready) the php-fpm adaptive spawning mechanism then
in case there is overload situation (too few free php childs) you would see
something like this in logs:
Sep 05 23:31:44.601141 [WARNING] [pool www] seems busy (you may need to
increase start_servers, or min/max_spare_servers), spawning 16 children,
there are 4 idle, and 50 total children
Sep 05 23:31:45.605144 [WARNING] [pool www] seems busy (you may need to
increase start_servers, or min/max_spare_servers), spawning 32 children,
there are 3 idle, and 51 total children
More information about the nginx