Can anyone please tell me if I should check nginx OR php-fpm for the issues?<br clear="all"><br><div>-Rahul :|<br>
<br><br><div class="gmail_quote">On Tue, Sep 7, 2010 at 11:09 AM, rahul286 <span dir="ltr">&lt;<a href="mailto:nginx-forum@nginx.us">nginx-forum@nginx.us</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

(note - this is reposting of -<br>
<a href="http://forum.nginx.org/read.php?11,127694" target="_blank">http://forum.nginx.org/read.php?11,127694</a>)<br>
<br>
Hi All,<br>
<br>
After debugging for 6-hours - I am giving this up :|<br>
<br>
We have a nginx+php-fpm+mysql in LAN with almost 100 wordpress (created<br>
and used by different designers/developers all working on test wordpres<br>
setup)<br>
<br>
We are using nginx without any issues from long.<br>
<br>
Today, all of a sudden - nginx started returning [b]&quot;504 Gateway<br>
Time-out&quot;[/b] out of the blue...<br>
<br>
I checked nginx error log for a virtual host...<br>
[code]<br>
2010/09/06 21:24:24 [error] 12909#0: *349 upstream timed out (110:<br>
Connection timed out) while reading response header from upstream,<br>
client: 192.168.0.1, server: <a href="http://rahul286.rtcamp.info" target="_blank">rahul286.rtcamp.info</a>, request: &quot;GET<br>
/favicon.ico HTTP/1.1&quot;, upstream: &quot;fastcgi://<a href="http://127.0.0.1:9000" target="_blank">127.0.0.1:9000</a>&quot;, host:<br>
&quot;<a href="http://rahul286.rtcamp.info" target="_blank">rahul286.rtcamp.info</a>&quot;<br>
2010/09/06 21:25:11 [error] 12909#0: *349 recv() failed (104: Connection<br>
reset by peer) while reading response header from upstream, client:<br>
192.168.0.1, server: <a href="http://rahul286.rtcamp.info" target="_blank">rahul286.rtcamp.info</a>, request: &quot;GET /favicon.ico<br>
HTTP/1.1&quot;, upstream: &quot;fastcgi://<a href="http://127.0.0.1:9000" target="_blank">127.0.0.1:9000</a>&quot;, host:<br>
&quot;<a href="http://rahul286.rtcamp.info" target="_blank">rahul286.rtcamp.info</a>&quot;<br>
2010/09/06 21:25:11 [error] 12909#0: *443 recv() failed (104: Connection<br>
reset by peer) while reading response header from upstream, client:<br>
192.168.0.1, server: <a href="http://rahul286.rtcamp.info" target="_blank">rahul286.rtcamp.info</a>, request: &quot;GET /info.php<br>
HTTP/1.1&quot;, upstream: &quot;fastcgi://<a href="http://127.0.0.1:9000" target="_blank">127.0.0.1:9000</a>&quot;, host:<br>
&quot;<a href="http://rahul286.rtcamp.info" target="_blank">rahul286.rtcamp.info</a>&quot;<br>
2010/09/06 21:25:12 [error] 12909#0: *443 connect() failed (111:<br>
Connection refused) while connecting to upstream, client: 192.168.0.1,<br>
server: <a href="http://rahul286.rtcamp.info" target="_blank">rahul286.rtcamp.info</a>, request: &quot;GET /favicon.ico HTTP/1.1&quot;,<br>
upstream: &quot;fastcgi://<a href="http://127.0.0.1:9000" target="_blank">127.0.0.1:9000</a>&quot;, host: &quot;<a href="http://rahul286.rtcamp.info" target="_blank">rahul286.rtcamp.info</a>&quot;<br>
2010/09/06 22:08:32 [error] 12909#0: *1025 upstream timed out (110:<br>
Connection timed out) while reading response header from upstream,<br>
client: 192.168.0.1, server: <a href="http://rahul286.rtcamp.info" target="_blank">rahul286.rtcamp.info</a>, request: &quot;GET /<br>
HTTP/1.1&quot;, upstream: &quot;fastcgi://<a href="http://127.0.0.1:9000" target="_blank">127.0.0.1:9000</a>&quot;, host:<br>
&quot;<a href="http://rahul286.rtcamp.info" target="_blank">rahul286.rtcamp.info</a>&quot;<br>
2010/09/06 22:09:33 [error] 12909#0: *1025 upstream timed out (110:<br>
Connection timed out) while reading response header from upstream,<br>
client: 192.168.0.1, server: <a href="http://rahul286.rtcamp.info" target="_blank">rahul286.rtcamp.info</a>, request: &quot;GET<br>
/favicon.ico HTTP/1.1&quot;, upstream: &quot;fastcgi://<a href="http://127.0.0.1:9000" target="_blank">127.0.0.1:9000</a>&quot;, host:<br>
&quot;<a href="http://rahul286.rtcamp.info" target="_blank">rahul286.rtcamp.info</a>&quot;<br>
2010/09/06 22:09:40 [error] 12909#0: *1064 recv() failed (104:<br>
Connection reset by peer) while reading response header from upstream,<br>
client: 192.168.0.1, server: <a href="http://rahul286.rtcamp.info" target="_blank">rahul286.rtcamp.info</a>, request: &quot;GET<br>
/info.php HTTP/1.1&quot;, upstream: &quot;fastcgi://<a href="http://127.0.0.1:9000" target="_blank">127.0.0.1:9000</a>&quot;, host:<br>
&quot;<a href="http://rahul286.rtcamp.info" target="_blank">rahul286.rtcamp.info</a>&quot;<br>
2010/09/06 22:09:40 [error] 12909#0: *1064 connect() failed (111:<br>
Connection refused) while connecting to upstream, client: 192.168.0.1,<br>
server: <a href="http://rahul286.rtcamp.info" target="_blank">rahul286.rtcamp.info</a>, request: &quot;GET /favicon.ico HTTP/1.1&quot;,<br>
upstream: &quot;fastcgi://<a href="http://127.0.0.1:9000" target="_blank">127.0.0.1:9000</a>&quot;, host: &quot;<a href="http://rahul286.rtcamp.info" target="_blank">rahul286.rtcamp.info</a>&quot;<br>
2010/09/06 22:24:44 [error] 12909#0: *1313 upstream timed out (110:<br>
Connection timed out) while reading response header from upstream,<br>
client: 192.168.0.1, server: <a href="http://rahul286.rtcamp.info" target="_blank">rahul286.rtcamp.info</a>, request: &quot;GET /<br>
HTTP/1.1&quot;, upstream: &quot;fastcgi://<a href="http://127.0.0.1:9000" target="_blank">127.0.0.1:9000</a>&quot;, host:<br>
&quot;<a href="http://rahul286.rtcamp.info" target="_blank">rahul286.rtcamp.info</a>&quot;<br>
2010/09/06 22:24:53 [error] 12909#0: *1313 recv() failed (104:<br>
Connection reset by peer) while reading response header from upstream,<br>
client: 192.168.0.1, server: <a href="http://rahul286.rtcamp.info" target="_blank">rahul286.rtcamp.info</a>, request: &quot;GET<br>
/favicon.ico HTTP/1.1&quot;, upstream: &quot;fastcgi://<a href="http://127.0.0.1:9000" target="_blank">127.0.0.1:9000</a>&quot;, host:<br>
&quot;<a href="http://rahul286.rtcamp.info" target="_blank">rahul286.rtcamp.info</a>&quot;<br>
[/code]<br>
<br>
As I run php-fpm on port 9000 via TCP mode, I ran &quot;netstat | grep 9000&quot;<br>
and noticed something unusual...<br>
[code]<br>
tcp     1321      0 localhost:9000          localhost:46643<br>
CLOSE_WAIT  -<br>
tcp        9      0 localhost:9000          localhost:36087<br>
CLOSE_WAIT  14272/php5-fpm<br>
tcp     1257      0 localhost:9000          localhost:46664<br>
CLOSE_WAIT  -<br>
tcp        0      0 localhost:46666         localhost:9000<br>
ESTABLISHED 12909/nginx: worker<br>
tcp        9      0 localhost:9000          localhost:36100<br>
CLOSE_WAIT  14276/php5-fpm<br>
tcp     1321      0 localhost:9000          localhost:46629<br>
CLOSE_WAIT  -<br>
tcp        9      0 localhost:9000          localhost:36106<br>
CLOSE_WAIT  14275/php5-fpm<br>
tcp     1257      0 localhost:9000          localhost:46656<br>
CLOSE_WAIT  -<br>
tcp        9      0 localhost:9000          localhost:36091<br>
CLOSE_WAIT  14277/php5-fpm<br>
tcp     1321      0 localhost:9000          localhost:46625<br>
CLOSE_WAIT  -<br>
tcp     1257      0 localhost:9000          localhost:46658<br>
CLOSE_WAIT  -<br>
tcp     1321      0 localhost:9000          localhost:46641<br>
CLOSE_WAIT  -<br>
tcp        0      0 localhost:46682         localhost:9000<br>
ESTABLISHED 12909/nginx: worker<br>
tcp     1321      0 localhost:9000          localhost:46633<br>
CLOSE_WAIT  -<br>
tcp     1257      0 localhost:9000          localhost:36133<br>
CLOSE_WAIT  -<br>
tcp     1336      0 localhost:9000          localhost:46676<br>
ESTABLISHED -<br>
tcp     1257      0 localhost:9000          localhost:36131<br>
CLOSE_WAIT  -<br>
tcp     1257      0 localhost:9000          localhost:46660<br>
CLOSE_WAIT  -<br>
tcp     1249      0 localhost:9000          localhost:36117<br>
CLOSE_WAIT  -<br>
tcp        9      0 localhost:9000          localhost:36094<br>
CLOSE_WAIT  14269/php5-fpm<br>
tcp        0      0 localhost:46664         localhost:9000<br>
FIN_WAIT2   -<br>
tcp     1257      0 localhost:9000          localhost:36135<br>
CLOSE_WAIT  -<br>
tcp     1257      0 localhost:9000          localhost:36125<br>
CLOSE_WAIT  -<br>
tcp        9      0 localhost:9000          localhost:36102<br>
CLOSE_WAIT  14268/php5-fpm<br>
tcp        0      0 localhost:46662         localhost:9000<br>
FIN_WAIT2   -<br>
tcp      745      0 localhost:9000          localhost:46644<br>
CLOSE_WAIT  -<br>
tcp        0      0 localhost:46658         localhost:9000<br>
FIN_WAIT2   -<br>
tcp     1265      0 localhost:9000          localhost:46607<br>
CLOSE_WAIT  -<br>
tcp        0      0 localhost:46672         localhost:9000<br>
ESTABLISHED 12909/nginx: worker<br>
tcp     1257      0 localhost:9000          localhost:36119<br>
CLOSE_WAIT  -<br>
tcp     1265      0 localhost:9000          localhost:46613<br>
CLOSE_WAIT  -<br>
tcp        0      0 localhost:46646         localhost:9000<br>
FIN_WAIT2   -<br>
tcp     1257      0 localhost:9000          localhost:36137<br>
CLOSE_WAIT  -<br>
tcp        0      0 localhost:46670         localhost:9000<br>
ESTABLISHED 12909/nginx: worker<br>
tcp     1265      0 localhost:9000          localhost:46619<br>
CLOSE_WAIT  -<br>
tcp     1336      0 localhost:9000          localhost:46668<br>
ESTABLISHED -<br>
tcp        0      0 localhost:46648         localhost:9000<br>
FIN_WAIT2   -<br>
tcp     1336      0 localhost:9000          localhost:46670<br>
ESTABLISHED -<br>
tcp        9      0 localhost:9000          localhost:36108<br>
CLOSE_WAIT  14274/php5-fpm<br>
tcp     1336      0 localhost:9000          localhost:46684<br>
ESTABLISHED -<br>
tcp        0      0 localhost:46674         localhost:9000<br>
ESTABLISHED 12909/nginx: worker<br>
tcp     1336      0 localhost:9000          localhost:46666<br>
ESTABLISHED -<br>
tcp     1257      0 localhost:9000          localhost:46648<br>
CLOSE_WAIT  -<br>
tcp     1336      0 localhost:9000          localhost:46678<br>
ESTABLISHED -<br>
tcp        0      0 localhost:46668         localhost:9000<br>
ESTABLISHED 12909/nginx: worker<br>
tcp     1321      0 localhost:9000          localhost:46635<br>
CLOSE_WAIT  -<br>
tcp        0      0 localhost:46676         localhost:9000<br>
ESTABLISHED 12909/nginx: worker<br>
tcp     1336      0 localhost:9000          localhost:46682<br>
ESTABLISHED -<br>
tcp     1257      0 localhost:9000          localhost:36127<br>
CLOSE_WAIT  -<br>
tcp     1265      0 localhost:9000          localhost:46617<br>
CLOSE_WAIT  -<br>
tcp        0      0 localhost:46684         localhost:9000<br>
ESTABLISHED -<br>
tcp     1265      0 localhost:9000          localhost:46621<br>
CLOSE_WAIT  -<br>
tcp     1265      0 localhost:9000          localhost:46623<br>
CLOSE_WAIT  -<br>
tcp     1257      0 localhost:9000          localhost:46652<br>
CLOSE_WAIT  -<br>
tcp     1321      0 localhost:9000          localhost:46627<br>
CLOSE_WAIT  -<br>
tcp     1257      0 localhost:9000          localhost:46654<br>
CLOSE_WAIT  -<br>
tcp     1265      0 localhost:9000          localhost:46611<br>
CLOSE_WAIT  -<br>
tcp        0      0 localhost:46654         localhost:9000<br>
FIN_WAIT2   -<br>
tcp        0      0 localhost:46644         localhost:9000<br>
FIN_WAIT2   -<br>
tcp        0      0 localhost:46678         localhost:9000<br>
ESTABLISHED 12909/nginx: worker<br>
tcp     1321      0 localhost:9000          localhost:46637<br>
CLOSE_WAIT  -<br>
tcp     1257      0 localhost:9000          localhost:36121<br>
CLOSE_WAIT  -<br>
tcp     1265      0 localhost:9000          localhost:46605<br>
CLOSE_WAIT  -<br>
tcp     1265      0 localhost:9000          localhost:46609<br>
CLOSE_WAIT  -<br>
tcp     1336      0 localhost:9000          localhost:46680<br>
ESTABLISHED -<br>
tcp     1257      0 localhost:9000          localhost:46662<br>
CLOSE_WAIT  -<br>
tcp     1321      0 localhost:9000          localhost:46631<br>
CLOSE_WAIT  -<br>
tcp        0      0 localhost:46652         localhost:9000<br>
FIN_WAIT2   -<br>
tcp        0      0 localhost:46660         localhost:9000<br>
FIN_WAIT2   -<br>
tcp     1249      0 localhost:9000          localhost:36114<br>
CLOSE_WAIT  -<br>
tcp     1336      0 localhost:9000          localhost:46672<br>
ESTABLISHED -<br>
tcp     1257      0 localhost:9000          localhost:36123<br>
CLOSE_WAIT  -<br>
tcp        9      0 localhost:9000          localhost:36113<br>
CLOSE_WAIT  14273/php5-fpm<br>
tcp     1321      0 localhost:9000          localhost:46639<br>
CLOSE_WAIT  -<br>
tcp     1265      0 localhost:9000          localhost:46615<br>
CLOSE_WAIT  -<br>
tcp     1336      0 localhost:9000          localhost:46674<br>
ESTABLISHED -<br>
tcp        9      0 localhost:9000          localhost:36085<br>
CLOSE_WAIT  14270/php5-fpm<br>
tcp        0      0 localhost:46656         localhost:9000<br>
FIN_WAIT2   -<br>
tcp        0      0 localhost:46650         localhost:9000<br>
FIN_WAIT2   -<br>
tcp        9      0 localhost:9000          localhost:36097<br>
CLOSE_WAIT  14271/php5-fpm<br>
tcp     1257      0 localhost:9000          localhost:36129<br>
CLOSE_WAIT  -<br>
tcp     1257      0 localhost:9000          localhost:46646<br>
CLOSE_WAIT  -<br>
tcp     1257      0 localhost:9000          localhost:46650<br>
CLOSE_WAIT  -<br>
tcp        0      0 localhost:46680         localhost:9000<br>
ESTABLISHED 12909/nginx: worker<br>
[/code]<br>
<br>
There are plenty of &quot;CLOSE_WAIT&quot; and kind of pairs as like below:<br>
[code]<br>
tcp     1337      0 localhost:9000          localhost:46680<br>
CLOSE_WAIT  -<br>
tcp        0      0 localhost:46680         localhost:9000<br>
FIN_WAIT2   -<br>
[/code]<br>
<br>
Please note port [b]46680[/b] in above.<br>
<br>
I enabled mysql slow queries error log, but it didn&#39;t work.<br>
<br>
As of now restarting php5-fpm every minute via a cronjob (see command<br>
below) keeping everything running &quot;smoothly&quot; but I hate patchwork and<br>
want to solve this...<br>
[code]<br>
1 * * * * service php5-fpm restart &gt; /dev/null<br>
[/code]<br>
<br>
<br>
I searched extensively on Google - got no help.<br>
As mentioned, this a test-server in LAN, CPU load is never crossed 0.10<br>
and memory usage is also below 25% (System has 2GB RAM and ubuntu-server<br>
installed)<br>
So if you find its time-confusing to help me out, please atleast drop a<br>
hint.<br>
<br>
Thanks in advance for help.<br>
-Rahul<br>
<br>
Posted at Nginx Forum: <a href="http://forum.nginx.org/read.php?2,127854,127854#msg-127854" target="_blank">http://forum.nginx.org/read.php?2,127854,127854#msg-127854</a><br>
<br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://nginx.org/mailman/listinfo/nginx" target="_blank">http://nginx.org/mailman/listinfo/nginx</a><br>
</blockquote></div><br></div>