Connections to backend not closing

Thimo E. abc at digithi.de
Wed Feb 10 01:02:40 CET 2010


Dear all,

first of all, varnish is a really nice software! But... :)
...At the moment I have some problems with varnish and its backend 
connection(s).

Symptom:
After some time of running varnish (with some client connects and so 
one)  I see something like this in netstat -p:
...
tcp        0      0 localhost:1234       localhost:37447         
FIN_WAIT2   19643/webserver
tcp        3      0 localhost:37447         localhost:1234       
CLOSE_WAIT  19139/varnishd
...

- FIN_WAIT2 means the backend webserver has sent a TCP FIN packet, got a 
TCP ACK und waits for the TCP FIN from the other side (varnish).
- The CLOSE_WAIT state means that the varnish received the TCP FIN 
packet, acknowledged it with TCP ACK and shall now close the connection 
with a close() call.

Some time later (at least 5 minutes !) the last entry "CLOSE_WAIT" 
disappears but the "FIN_WAIT2" persists, so the webserver still has a 
semi-open socket:
...
tcp        0      0 localhost:1234       localhost:37447         
FIN_WAIT2   19643/webserver
...

The number of those entries grow over the time.

It seems as if the TCP connection closing in varnish doesn't perform 
correctly, the close() call in varnish is sometimes executed too late.

I am using varnish 2.0.6, linux 2.6.31
The backend is configured als follows:
...
backend vs_1x1 {
     .host = "127.0.0.1";
     .port = "1234";
     .connect_timeout = 5s;
     .first_byte_timeout = 300s;
     .between_bytes_timeout = 300s;
}
...

Any ideas why this happens ? Did I miss something in my backend 
configuration ?

Best regards
   Thimo E.


More information about the varnish-misc mailing list