Growing Writing Connections

Maxim Dounin mdounin at
Thu Dec 2 14:03:22 UTC 2021


On Thu, Dec 02, 2021 at 04:30:57PM +0300, Наталья Пучкова wrote:

> I faced a problem that when there is a connection and the 
> Internet or?VPN is disconnected while user on our site, the 
> connection gets stuck in the writing state and does not 
> disappear anymore. I am assuming that nginx does not detect that 
> the connection has been interrupted.
> Has anyone encountered a similar situation? Maybe you know how 
> to solve it (for example, add some setting in the 
> configuration)?

The connection is expected to be closed once the relevant timeout 
expires or the TCP layer detects that the connection is no longer 
alive.  Usually the send_timeout applies.

If you see connections which are stuck for much longer than 
configured timeouts, this might indicate you are facing a socket 
leak somewhere.  Usually such connections can be also seen as 
"CLOSED" or "CLOSE_WAIT" in netstat output.  In this case first of 
all I would recommend to make sure you are using a recent enough 
nginx version, at least 1.20.2 or 1.21.4.

Maxim Dounin

More information about the nginx mailing list