Welcome! Log In Create A New Profile

Advanced

Re: Nginx + PHP FASTCGI FAILS - how to debug ?

Daniel Hahler
February 12, 2010 08:24AM
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

--
http://daniel.hahler.de/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Nginx + PHP FASTCGI FAILS - how to debug ?

Niro January 12, 2010 01:05PM

Re: Nginx + PHP FASTCGI FAILS - how to debug ?

merlin corey January 12, 2010 07:52PM

Re: Nginx + PHP FASTCGI FAILS - how to debug ?

war59312 February 11, 2010 11:13PM

Re: Nginx + PHP FASTCGI FAILS - how to debug ?

Daniel Hahler February 12, 2010 08:24AM

Re: Nginx + PHP FASTCGI FAILS - how to debug ?

Reinis Rozitis February 12, 2010 09:14AM

Re: Nginx + PHP FASTCGI FAILS - how to debug ?

Piotr Karbowski February 12, 2010 09:20AM

Re: Nginx + PHP FASTCGI FAILS - how to debug ?

shaktale February 12, 2010 01:30PM

Re: Nginx + PHP FASTCGI FAILS - how to debug ?

Usu April 03, 2010 06:51PM

Re: Nginx + PHP FASTCGI FAILS - how to debug ?

jjjx128 April 03, 2010 11:09PM

Re: Nginx + PHP FASTCGI FAILS - how to debug ?

Usu April 04, 2010 03:55AM

Re: Nginx + PHP FASTCGI FAILS - how to debug ?

unclepieman April 04, 2010 02:38PM

Re: Nginx + PHP FASTCGI FAILS - how to debug ?

unclepieman April 03, 2010 10:48PM

Re: Nginx + PHP FASTCGI FAILS - how to debug ?

Usu April 04, 2010 02:59PM

Re: Nginx + PHP FASTCGI FAILS - how to debug ?

unclepieman April 04, 2010 03:19PM

Re: Nginx + PHP FASTCGI FAILS - how to debug ?

Usu April 04, 2010 03:21PM

Re: Nginx + PHP FASTCGI FAILS - how to debug ?

Don Burris June 20, 2010 05:32PM

Re: Nginx + PHP FASTCGI FAILS - how to debug ?

franky gman August 11, 2011 01:08PM

Re: Nginx + PHP FASTCGI FAILS - how to debug ?

Volodymyr Kostyrko August 12, 2011 01:38AM

Re: Nginx + PHP FASTCGI FAILS - how to debug ?

Reinis Rozitis August 12, 2011 07:34AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 220
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready