atom feed20 messages in ru.sysoev.nginxRe: Nginx + php-fpm "504 Gateway Time...
FromSent OnAttachments
rahul286Sep 6, 2010 10:38 pm 
Rahul BansalSep 6, 2010 11:27 pm 
Rahul BansalSep 6, 2010 11:27 pm 
Igor SysoevSep 6, 2010 11:31 pm 
Rahul BansalSep 6, 2010 11:40 pm 
Igor SysoevSep 6, 2010 11:46 pm 
Reinis RozitisSep 7, 2010 3:33 am 
Rahul BansalSep 7, 2010 9:03 am 
Reinis RozitisSep 7, 2010 9:56 am 
minaevSep 8, 2010 2:47 am 
Jérôme LoyetSep 8, 2010 2:54 am 
rahul286Sep 8, 2010 2:58 am 
minaevSep 8, 2010 3:29 am 
rahul286Sep 8, 2010 3:32 am 
Rahul BansalSep 8, 2010 4:01 am 
minaevSep 8, 2010 4:15 am 
Reinis RozitisSep 8, 2010 4:18 am 
Jérôme LoyetSep 8, 2010 5:16 am 
Michael ShadleSep 8, 2010 10:20 am 
net999Apr 14, 2011 1:13 pm 
Subject:Re: Nginx + php-fpm "504 Gateway Time-out" error with almost zeroload(on a test-server)
From:Rahul Bansal (rahu@rtcamp.com)
Date:Sep 8, 2010 4:01:52 am
List:ru.sysoev.nginx

Thanks Reinis.

request_terminate_timeout = 30s worked for me.

I also started using adaptive spawning mechanism.

What I am wondering about is: -I have same config without "request_terminate_timeout = 60s" and it handles around 20K page-views daily without any issues. -Issue appeared all of a sudden, then just 2 days back a test-site with 200MB database was created and running smoothly with 100 other sites without any problem. -PHP-FPM debug really produced very less info which was not helpful at all.

On sidenote, why php error shows up in nginx error.log and not in php-fpm?

On Tue, Sep 7, 2010 at 10:26 PM, Reinis Rozitis <r@roze.lv> wrote:

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 example):

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 (5) 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 needed.

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

rr