You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2016/05/26 21:59:23 UTC

[trafficserver] branch 6.1.x updated: TS-4403: Fix stale-while-revalidate on DNS lookup failures (#609)

This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 6.1.x
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/6.1.x by this push:
       new  5712179   TS-4403: Fix stale-while-revalidate on DNS lookup failures (#609)
5712179 is described below

commit 5712179404e1bace464d44d51b277dde684ee5b6
Author: Thomas Jackson <ja...@gmail.com>
AuthorDate: Mon May 2 08:34:05 2016 -0700

    TS-4403: Fix stale-while-revalidate on DNS lookup failures (#609)
    
    HostDB's "stale-while-revalidate" feature allows hostdb to return stale records while doing the DNS lookup in the background. This works properly in the case where the resolver goes away, but in the case that an error was returned from the resolver the record in cache was thrown away. This means that a transient error out in the DNS infrastructure would cause ATS to drop its stale record it would have contently served-- this patch simply makes hostdb honor its stale-while-revalidate c [...]
    
    This closes #609
    (cherry picked from commit 131875cbe7b0975c8c3c4f3d20aa55a5c7caba86)
---
 iocore/hostdb/HostDB.cc | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index 9a7064b..350a451 100644
--- a/iocore/hostdb/HostDB.cc
+++ b/iocore/hostdb/HostDB.cc
@@ -1523,7 +1523,12 @@ HostDBContinuation::dnsEvent(int event, HostEnt *e)
     HostDBInfo *r = NULL;
     IpAddr tip; // temp storage if needed.
 
-    if (is_byname()) {
+    // If the DNS lookup failed (errors such as NXDOMAIN, SERVFAIL, etc.) but we have an old record
+    // which is okay with being served stale-- lets continue to serve the stale record as long as
+    // the record is willing to be served.
+    if (failed && old_r && old_r->serve_stale_but_revalidate()) {
+      r = old_r;
+    } else if (is_byname()) {
       if (first)
         ip_addr_set(tip, af, first);
       r = lookup_done(tip, md5.host_name, rr, ttl_seconds, failed ? 0 : &e->srv_hosts);

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].