Hi All,

We think that we have identified a case where the Squid log will show the 
transaction result as TCP_HIT even though the cached page was expired.

We generate this condition (under ATS 6.1.1) by doing the following --

*         Enable negative caching with 120s time-out

*         Request a page from the O.S. via ATS that results in a 404 being 
cached

*         Disable the connectivity between ATS and its DNS server (TTL is set 
for 30s)

*         Wait for 120+ seconds to elapse

*         Request the same page via ATS again

We observed that the client receives 502 -- Cannot find server. However, the 
Squid log shows TCP_HIT/502.

It appears that the Squid log entry is generated as a response to the O.S. DNS 
look-up failure without the appropriate via_string is set.

*         In HttpTransact::HandleCacheOpenReadHitFreshness()

o   The following is set -- SET_VIA_STRING(VIA_DETAIL_CACHE_LOOKUP, 
VIA_DETAIL_MISS_EXPIRED)

o   However, via_string[VIA_CACHE_RESULT] remains VIA_IN_CACHE_FRESH

*         In HttpTransactHeaders::generate_and_set_squid_codes(), the end 
result is a TCP_HIT.


1.       Does this behavior look like a bug?

2.       Any issues or side-effects with doing the following --
In HandleCacheOpenReadHitFreshness(), also SET_VIA_STRING(VIA_CACHE_RESULT, 
VIA_IN_CACHE_STALE)

3.       In generate_and_set_squid_codes(), the above results in an interim 
log_code of SQUID_LOG_TCP_REFRESH_MISS
Then change the error over-rides as follows --
case VIA_ERROR_CONNECTION :
  if ((log_code == SQUID_LOG_TCP_MISS) ||
      (log_code == SQUID_LOG_TCP_REFRESH_MISS)) <-- add this
       log_code = SQUID_LOG_ERROR_CONNECT_FAIL
This results in a final Squid log output of ERR_CONNECT_FAIL/502

Note that we also observed this behavior in a parent-child cache setup, but I 
still need to investigate if any additional changes are required to address 
that case.

Appreciate any comments on this approach or any better recommendations.

I can create a GitHub PR (ported to master) if there is consensus that this is 
a bug and on the approach to address it.

Thanks,
Peter

Reply via email to