]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Reduce the default value for max-stale-ttl from 1 week to 12 hours
authorOndřej Surý <ondrej@isc.org>
Wed, 27 May 2020 15:48:39 +0000 (17:48 +0200)
committerOndřej Surý <ondrej@isc.org>
Wed, 3 Jun 2020 10:45:09 +0000 (10:45 +0000)
Originally, the default value for max-stale-ttl was 1 week, which could
and in some scenarios lead to cache exhaustion on a busy resolvers.
Picking the default value will always be juggling between value that's
useful (e.g. keeping the already cached records after they have already
expired and the upstream name servers are down) and not bloating the
cache too much (e.g. keeping everything for a very long time).  The new
default reflects what we think is a reasonable to time to react on both
sides (upstream authoritative and downstream recursive).

(cherry picked from commit 13fd3ecfab812526a730e21517cc669e4278930f)

bin/named/config.c
bin/tests/system/serve-stale/tests.sh
doc/arm/reference.rst

index 862f3e5025121ae63cc0086a32575d03376f351f..878dcfda5086c94509516bf6fc963b06c504fb49 100644 (file)
@@ -169,7 +169,7 @@ options {\n\
        max-ncache-ttl 10800; /* 3 hours */\n\
        max-recursion-depth 7;\n\
        max-recursion-queries 75;\n\
-       max-stale-ttl 604800; /* 1 week */\n\
+       max-stale-ttl 43200; /* 12 hours */\n\
        message-compression yes;\n\
        min-ncache-ttl 0; /* 0 hours */\n\
        min-cache-ttl 0; /* 0 seconds */\n\
index 252eeab994ca1eb592cf4f6766ebc69a30a0e5da..c1271f5640735559f01ad2d2c50d167d0d6b593b 100755 (executable)
@@ -22,6 +22,8 @@ waitfile () {
     done
 }
 
+max_stale_ttl=$(sed -ne 's,^[[:space:]]*max-stale-ttl \([[:digit:]]*\).*,\1,p' $TOP/bin/named/config.c)
+
 status=0
 n=0
 
@@ -724,7 +726,7 @@ n=$((n+1))
 echo_i "check 'rndc serve-stale status' ($n)"
 ret=0
 $RNDCCMD 10.53.0.3 serve-stale status > rndc.out.test$n 2>&1 || ret=1
-grep '_default: off (stale-answer-ttl=1 max-stale-ttl=604800)' rndc.out.test$n > /dev/null || ret=1
+grep "_default: off (stale-answer-ttl=1 max-stale-ttl=$max_stale_ttl)" rndc.out.test$n > /dev/null || ret=1
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=$((status+ret))
 
@@ -805,7 +807,7 @@ n=$((n+1))
 echo_i "check 'rndc serve-stale status' ($n)"
 ret=0
 $RNDCCMD 10.53.0.3 serve-stale status > rndc.out.test$n 2>&1 || ret=1
-grep '_default: on (rndc) (stale-answer-ttl=1 max-stale-ttl=604800)' rndc.out.test$n > /dev/null || ret=1
+grep "_default: on (rndc) (stale-answer-ttl=1 max-stale-ttl=$max_stale_ttl)" rndc.out.test$n > /dev/null || ret=1
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=$((status+ret))
 
@@ -952,7 +954,7 @@ n=$((n+1))
 echo_i "check 'rndc serve-stale status' ($n)"
 ret=0
 $RNDCCMD 10.53.0.4 serve-stale status > rndc.out.test$n 2>&1 || ret=1
-grep '_default: off (stale-answer-ttl=1 max-stale-ttl=604800)' rndc.out.test$n > /dev/null || ret=1
+grep "_default: off (stale-answer-ttl=1 max-stale-ttl=$max_stale_ttl)" rndc.out.test$n > /dev/null || ret=1
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=$((status+ret))
 
index 7b2eb4c2a45637d174a3dc7c1edeed0ff908a675..34904cc208df99ccbb72bb796f101edcc0caae91 100644 (file)
@@ -3274,7 +3274,7 @@ Tuning
    If stale answers are enabled, ``max-stale-ttl`` sets the maximum time
    for which the server retains records past their normal expiry to
    return them as stale records, when the servers for those records are
-   not reachable. The default is 1 week. The minimum allowed is 1
+   not reachable. The default is 12 hours. The minimum allowed is 1
    second; a value of 0 is updated silently to 1 second.
 
    For stale answers to be returned, they must be enabled, either in the