Nginx – socket() failed: No buffer space available while connecting to upstream

500-errorfcginginxUbuntu

On my ubuntu 10.04 VPS, I get a regular 500 error on nginx (0.7.??)+ fcgi web server running a durpal site and when I trace the nginx error log I see plenty of these:

socket() failed: No buffer space
available) while connecting to
upstream …,

I have tried differnt combination of configs but none fixed the problem. Currently I have 3 nginx workers, Keep-alive time out 15 seconds and and

PHP_FCGI_CHILDREN=5
PHP_FCGI_MAX_REQUESTS=1000

I really appreciate if you Can you suggest a solution to this annoying problem.

Best Answer

You are probably reaching your limit of RAM or of open sockets. Check the number of sockets with cat /proc/sys/fs/file-max and increase it with sysctl -w fs.file-max=[BIG NUMBER]