Search code examples
nginxfastcgi

nginx errors readv() and recv() failed


I use nginx along with fastcgi. I see a lot of the following errors in the error logs

readv() failed (104: Connection reset by peer) while reading upstream and recv() failed (104: Connection reset by peer) while reading response header from upstream

I don't see any problem using the application. Are these errors serious or how to get rid of them.


Solution

  • I was using php-fpm in the background and slow scripts were getting killed after a said timeout because it was configured that way. Thus, scripts taking longer than a specified time would get killed and nginx would report a recv or readv error as the connection is closed from the php-fpm engine/process.