3
2010/09/19 14:52:07 [error] 1419#0: *10220 recv() failed
(104: Connection reset by peer) while reading response header from upstream,
client: [...], server: [...], request: "POST /[...] HTTP/1.1", upstream: 
"fastcgi://unix:/server/php-fpm.sock:", host: "[...]",
referrer: "[...]"

This is the error I'm receiving randomly. 95% of the time my setup works perfectly, but once in a while I'm getting 502 for 3-4 subsequent requests.

I'm using Unix socket between the server and the PHP process as you can see, also have set up FastCGI params (SCRIPT_FILENAME), etc. correctly.

What can I do about it to strengthen the connection between these services?

Thank you very much in advance.

1
  • Aside from the answers already given, check for situations where a PHP request is making another PHP request (e.g. via CURL) to the same web server. Doing so can be disastrous.
    – tylerl
    Sep 8, 2011 at 3:48

3 Answers 3

4

take a look at your php5-fpm.conf, you might have reach the pm.max_children limit, which is also the amount of simultaneous requests your server can handle.

this limit can be easily reached if you have scripts that may spawn processes (beware of zombies!), or if you have long execution's time requests

1

I've often heard that PHP-FPM has problems with Unix sockets. Try switching to Inet sockets. Frankly, it didn't help me in the same situation, but it may help you :).

1

You should've ran out of some system resource (e.g somaxcon, maxfiles etc)
Check your

 # netstat -s

for drops, errors and no buffers

So you can play with sysctl's (e.g. max_dgram_qlen)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .