atom feed19 messages in ru.sysoev.nginxRe: Nginx + PHP FASTCGI FAILS - how t...
FromSent OnAttachments
NiroJan 12, 2010 10:05 am 
merlin coreyJan 12, 2010 4:45 pm 
war59312Feb 11, 2010 8:12 pm 
Daniel HahlerFeb 12, 2010 5:20 am 
Reinis RozitisFeb 12, 2010 6:07 am 
Piotr KarbowskiFeb 12, 2010 6:13 am 
shaktaleFeb 12, 2010 10:29 am 
UsuApr 3, 2010 7:23 pm 
Payam ChychiApr 3, 2010 7:36 pm 
jjjx128Apr 3, 2010 8:08 pm 
UsuApr 4, 2010 12:55 am 
unclepiemanApr 4, 2010 11:37 am 
UsuApr 4, 2010 11:59 am 
unclepiemanApr 4, 2010 12:19 pm 
UsuApr 4, 2010 12:21 pm 
Don BurrisJun 20, 2010 2:28 pm 
franky gmanAug 11, 2011 10:05 am 
Volodymyr KostyrkoAug 11, 2011 10:25 am 
Reinis RozitisAug 12, 2011 4:31 am 
Subject:Re: Nginx + PHP FASTCGI FAILS - how to debug ?
From:Daniel Hahler (gen@thequod.de)
Date:Feb 12, 2010 5:20:25 am
List:ru.sysoev.nginx

Hi,

I have an Ubuntu 9.10 server on AMAZON EC2 running Nginx +PHP with PHP FASTCGI
via port 9000.

The server runs fine for a few minutes and after a few minutes (several
thousands of hits in this case) FastCGI dies and Nginx returns 502 Error.

Nginx log shows 2010/01/12 16:49:24 1093#0: *9965 connect() failed (111:
Connection refused) while connecting to upstream, client: 79.180.27.241, server:
localhost, request: "GET /data.php?data=7781 HTTP/1.1", upstream:
"fastcgi://127.0.0.1:9000", host: "site1.mysite.com", referrer:
"http://www.othersite.com/subc.asp?t=10"

I've experiencing something similar. After some time (some hours, but I'm getting not that much hits), PHP appears to be not responding anymore: Processes are running, but nginx times out: First with upstream timed out (110: Connection timed out) while reading response header from upstream then recv() failed (104: Connection reset by peer) while reading response header from upstream

This happened with php-cgi and a custom start script a few days ago (same symptoms, have not checked logs carefully), and today after I've switched to using php-fpm.

So, both php-cgi and php-fpm appear to not behave well with nginx. Those problems never appeared using lighttpd (in the same container/machine), but are happening now since I have only PHP running in the container/machine and nginx (acting as first proxy in line) is directly forwarding to it.

Maybe this did not happen with lighttpd before, because it (and the php-cgi process) was regularly restarted, which is not the case currently.

I've found http://bugs.php.net/bug.php?id=39809

I'm running PHP 5.3.1-0.dotdeb.1 and nginx 0.8.33-0~ppa2.

I guess this is rather a PHP than an nginx problem, since restarting php-fpm fixes it.

For now, I've tried bumping the number of child processes, hoping that this will prevent the PHP processes entering the ignoring state.

Here's a munin graph from the PHP container (http://i.imgur.com/MHbNi.png) - the failing started with the increasing number of established network connection: those are probably the connections from nginx queuing up, without being answered.

How can I debug what is causing FastCGI to die ?

So in your case there aren't any php-cgi processes anymore? Have you checked the php error log?

Cheers, Daniel