I've been looking all over for some kind of fix for this problem.
I'm running nginx 1.0.12-1~dotdeb.0 + 5.3.10-1~dotdeb.1 on Debian 6.0.3 with apc (in other words, latest debian with the latest dotdeb). 95% of the time, it works great - blazing fast.
But sometimes I get 502 Bad Gateway. When I look in the site's error log, I see:
2012/03/12 15:08:32 [error] 9965#0: *12382 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: x.x.x.x, server: www.example.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm.sock:", host: "www.example.com"
This then continues until I restart php-fpm, and everything is back to wonderful.
The same page will not work, and then work fine after a php-fpm restart. It's not URI-specific. It's not memory on the server (400MBish used out of 1024MB), the database (works fine during the problem from the mysql command line), server load, or anything else I can figure out. Static files are server fine so I think it's php-fpm. nginx and php-fpm are on the same server and as you can see, I'm using a socket.
Anyone have any suggestions on where I could look to diagnose this problem?