[squid-users] server request timeout not working

Amos Jeffries squid3 at treenet.co.nz
Wed Jun 8 09:43:39 UTC 2016


On 25/05/2016 8:26 a.m., Heiler Bemerguy wrote:
> 
> If you connect to squid and ask it to get a file on a server which
> accepts the tcp connection but won't reply anything, the connection will
> never timeout.
> 
> Like this: (client side)
> 
> GET http://10.1.4.60:8080/pehasuzyjireohwwlik.txt HTTP/1.1
> Accept: */*
> Accept-Encoding: identity
> Range: bytes=20-80
> User-Agent: FakeUser/0.0
> Proxy-Connection: Keep-Alive
> Host: 10.1.4.60
> 
> Gives this on server side:
> 
> GET /pehasuzyjireohwwlik.txt HTTP/1.1
> Accept: */*
> Accept-Encoding: identity
> User-Agent: FakeUser/0.0
> Host: 10.1.4.60:8080
> Via: 1.1 jasperserver (squid)
> X-Forwarded-For: 10.1.4.60
> Cache-Control: max-age=29030400
> Connection: keep-alive
> 
> It does connect to 10.1.4.60:8080, this port is open and accepting
> connections.. but it won't reply anything to squid, and squid will
> remain connected to it and waiting forever

How long was the longest actual test you made?
 read_timeout is 15 minutes.


> 
> client_idle_pconn_timeout 30 seconds

 - how long to wait for the next client request to arrive on a
persistent connection.

 NP: ideally you want long-ish client persistence and short server
persistence.

This is because clients may be a browser waiting for user to read a page
before clicking onwards. CLosing them early means higher latency when
user clicks on web links, etc.

But server connections are multiplexed and shared for outgoing requests.
So many active clients will use them more frequently than a single
client. Holding onto these for long times also ties up the server
resources needlessly and risks being disconnected from the other end
which causes problems.


> 
> client_persistent_connections on
> server_persistent_connections on

 - enable "Connection:keep-alive" feature of HTTP on both client and
server connections.


> connect_timeout 60 seconds

 - how long to wait for TCP SYN ACK packet when making an outbound
connection to some server.


> request_timeout 30 seconds

 - how long to wait for *client* to *send us* the request headers after
is connects.

> persistent_request_timeout 30 seconds

 - An obsolete directive replaced by client_idle_pconn_timeout in Squid-3.2.


> collapsed_forwarding on
> 

Allow client requests to get a HIT on a transaction that has not yet
completed, or possibly only just started being sent to the server.


Notice how none of those settings is related to outgoing server request
timing.

Once the request is written (governed by write_timeout) the next thing
Squid does on that connection is wait for the response (governed by
read_timeout). When the response is finished it gets put back into the
idle pool (governed by server_idle_pconn_timeout).


Amos



More information about the squid-users mailing list