[squid-users] TCP connections keep alive problem after 302 HTTP response from web

From: Itzcak Pechtalt <itzcak_at_gmail.com>
Date: Sun, 30 Nov 2008 17:41:01 +0200

Hi

I found some inefficiency in Squid TCP connection handling toward servers .
In some cases Squid closes TCP connection to servers immediately after
304 not modified response and doesn't save it for reuse.
There is no visbible reason why Squid closes the connection. Squid
Sends "Connection: Keep-Alive" in HTTP request and the web server
returns "Connection: Keep-Alive" on the response, Also pconn_timeout
is configured to 1 minute.

After digging into the problem, I found that the the problem occurs
only in cases the object type is PRIVATE. It seems like when
client_side code hadnles 304 not modified reply it calls
store_unregister which closes store entry and TCP connection in turn.

To reproduce it do the following
1) Browse www.cnn.com
2) Delete browser cache.
3) Browse again. The case will occur here.

Does someone know about it ?

Itzcak

Following short Wireshark sniff with 1 sample, 10.50.0.100 is Squid
IP. See FIN packet from Squid.

0.000000 10.50.0.100 -> 205.128.90.126 TCP 4006 > http [SYN] Seq=0
Len=0 MSS=1460 WS=2
0.085216 205.128.90.126 -> 10.50.0.100 TCP http > 4006 [SYN, ACK]
Seq=0 Ack=1 Win=5840 Len=0 MSS=1460 WS=7
0.085226 10.50.0.100 -> 205.128.90.126 TCP 4006 > http [ACK] Seq=1
Ack=1 Win=5840 Len=0
0.085230 10.50.0.100 -> 205.128.90.126 HTTP GET
/cnn/.element/css/2.0/common.css HTTP/1.0
GET /cnn/.element/css/2.0/common.css HTTP/1.0
If-Modified-Since: Tue, 16 Sep 2008 14:48:32 GMT
Accept: */*
Referer: http://www.cnn.com/
Accept-Language: en-us
UA-CPU: x86
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET
CLR 2.0.50727; .NET CLR 3.0.04506.30)
Host: i.cdn.turner.com
Cache-Control: max-age=259200
Connection: keep-alive

0.172250 205.128.90.126 -> 10.50.0.100 TCP http > 4006 [ACK] Seq=1
Ack=366 Win=6912 Len=0
0.172934 205.128.90.126 -> 10.50.0.100 HTTP HTTP/1.1 304 Not Modified
HTTP/1.1 304 Not Modified
Date: Wed, 26 Nov 2008 12:33:33 GMT
Expires: Wed, 26 Nov 2008 13:03:51 GMT
Last-Modified: Tue, 16 Sep 2008 14:48:32 GMT
Cache-Control: max-age=3600
Connection: keep-alive

0.173145 10.50.0.100 -> 205.128.90.126 TCP 4006 > http [ACK] Seq=366
Ack=206 Win=6912 Len=0
0.173238 10.50.0.100 -> 205.128.90.126 TCP 4006 > http [FIN, ACK]
Seq=366 Ack=206 Win=6912 Len=0
0.259520 205.128.90.126 -> 10.50.0.100 TCP http > 4006 [FIN, ACK]
Seq=206 Ack=367 Win=6912 Len=0
0.259906 10.50.0.100 -> 205.128.90.126 TCP 4006 > http [ACK] Seq=367
Ack=207 Win=6912 Len=0
0.565702 205.128.90.126 -> 10.50.0.100 TCP http > 4006 [FIN, ACK]
Seq=206 Ack=367 Win=6912 Len=0
0.565842 10.50.0.100 -> 205.128.90.126 TCP [TCP Dup ACK 10#1] 4006 >
http [ACK] Seq=367 Ack=207 Win=6912 Len=0
Received on Sun Nov 30 2008 - 15:41:04 MST

This archive was generated by hypermail 2.2.0 : Sun Nov 30 2008 - 12:00:04 MST