accept() failed (53: Software caused connection abort)

Maxim Dounin mdounin at
Wed Jul 13 17:27:14 MSD 2011


On Wed, Jul 13, 2011 at 01:41:59PM +0200, Adam PAPAI wrote:

> Maxim Dounin wrote:
> >Hello!
> >
> >Client closed connection before nginx was able to accept() it.
> >This may be normal (i.e. user just closed a browser page while images
> >was still loading) and may be not (i.e. nginx wasn't able to
> >accept() for a long time due to some problems and client bored
> >waiting and closed a page).
> >
> >Some number of such messages are expected to appear.  High number
> >of such errors may indicate problems, try looking at listen queues
> >at first (netstat -Lan).
> Dear Maxim,
> When the netstat -Lan shows over:
> tcp4  190/0/128
> tcp4  195/0/128
> tcp4  181/0/128
> It starts to throw the writev() failed (54: Connection reset by
> peer) while sending request  errors.
> What should I increase? Any ideas? What is the real meaning of the
> maxqlen? If it the qlen is greater than maxqlen it means...?

Maxqlen is maximum listen socket queue length (the queue of 
connections completed handshake but not yet accept()'ed by 
application), and FreeBSD will reset new connections if it's 
exhausted (or will just drop them if you have 

If you see qlen greater than maxqlen it means that your app can't 
cope with load.  If this happens for a fraction of a second due to 
connection bursts - this may be ok and you just need to increase 
queue length to compensate bursts.

But if you've been able to see it in netstat output - it certainly 
means there is something wrong with backends.  You either have to 
add more backends or find out/optimize bottlenecks in existing ones.

Maxim Dounin

More information about the nginx mailing list