[squid-users] Inconsistent stale-on-error behavior

From: Joseph Hoffmann <jhoff3ca_at_gmail.com>
Date: Sat, 14 Aug 2010 14:15:36 -0400

Hello squid-users,

I'm using Squid in a reverse proxy setup. Recently I was surprised to
see some errors being served on popular pages since I have max_stale 1
day and stale-while-refresh=1200 set. Upon inspection I found Squid to
be replacing stale content (which had a return status of 200) with an
error page (return status of 500) and returning negative hits on
subsequent requests as seen in the following log excerpts:

     TCP_STALE_HIT/200 71890 GET http://example.com:8881 -
DIRECT/10.190.1.29 text/html
     TCP_ASYNC_MISS/500 335 GET
http://app-server.example.com:8080/rewrite+to+homepage -
DIRECT/10.190.1.29 text/html
     TCP_NEGATIVE_HIT/500 442 GET http://example.com:8881/ - NONE/- text/html
     TCP_NEGATIVE_HIT/500 442 GET http://example.com:8881/ - NONE/- text/html

This is in contrast with what happens when Squid can not contact the
origin server at all. When the origin server is down Squid will serve
stale content rather then errors, and will not replace the stale
content in cache with a negatively cached error. I expected Squid to
respond the same in both circumstances, and continue serving stale
content until max_stale was reached. Are my expectations incorrect? Is
there a way I can make Squid behave the same way it does when the
origin is down when it receives an error page with a 500 return code
from the origin?

When shutting down the origin completely I see messages like the following:

     TCP_STALE_HIT/200 71890 GET http://example.com:8881 -
DIRECT/10.190.1.29 text/html
     TCP_ASYNC_MISS/504 1359 GET
http://app-server.example.com:8080/rewrite+to+homepage -
DIRECT/10.190.1.29 text/html
     TCP_STALE_HIT/200 71891 GET http://example.com:8881/homepage -
DIRECT/10.190.1.29 text/html
     TCP_ASYNC_MISS/504 1359 GET
http://app-server.example.com:8080/rewrite+to+homepage -
DIRECT/10.190.1.29 text/html
     TCP_STALE_HIT/200 71891 GET http://example.com:8881/homepage -
DIRECT/10.190.1.29 text/html
     TCP_ASYNC_MISS/504 1359 GET
http://app-server.example.com:8080/rewrite+to+homepage -
DIRECT/10.190.1.29 text/html

with TCP_REFRESH_FAIL_HIT's starting once stale-while-revalidate expires.
Received on Sat Aug 14 2010 - 18:16:03 MDT

This archive was generated by hypermail 2.2.0 : Sun Aug 15 2010 - 12:00:02 MDT