Last modified: 2012-10-29 17:24:16 UTC
SquidUpdate employs a somewhat curious scheme whereby rather than parsing the HTTP response from Squid it just waits until it has received a certain number of bytes or a certain amount of time has passed. When it opens the first socket to each server it sends the first request as a test of some sort, then collects the response. After all the connections are open it loops reading responses and sending more requests before finally collecting the last response. Unfortunately for the first socket the response has already been collected when the socket was opened, so no more bytes are read by the later code and it has to wait for the timeout to expire. That timeout appears to be intended to be 4 milliseconds as it is 200 passes of a loop with a 20 microsecond delay call. Very few machines can actually do a usleep(20) that fast though, so in reality the sleep is longer and so is the total expiry. On the system where I encountered this problem each call to usleep(20) actually took about 40 milliseconds, which when repeated 200 times gave a total timeout of 8 seconds. The result is that each call to SquidUpdate() takes about 8s (or a multiple thereof with more that one Squid server).
Is this behaviour still current? (version 1.14alpha)
It doesn't look like there has been any significant change between 1.12.0 and trunk that would fix this.