From: Evan Hunt Date: Tue, 26 Nov 2019 05:28:10 +0000 (-0800) Subject: add a stats counter for clients dropped due to recursive-clients limit X-Git-Tag: v9.11.14~23^2 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=47da3129fd6af8cde69703c696514ec1e25b93bb;p=thirdparty%2Fbind9.git add a stats counter for clients dropped due to recursive-clients limit (cherry picked from commit 715afa9c5771ca5b483aad77fe21906685d63889) --- diff --git a/CHANGES b/CHANGES index c9751295a39..500ff6c1be8 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +5327. [func] Added a statistics counter to track queries + dropped because the recursive-clients quota was + exceeded. [GL #1399] + 5326. [bug] Add python dependancy on 'distutils.core' to configure. 'distutils.core' is required for installation. [GL #1397] diff --git a/bin/named/client.c b/bin/named/client.c index 50fa2cd6c4d..f8431bc36ad 100644 --- a/bin/named/client.c +++ b/bin/named/client.c @@ -286,8 +286,11 @@ ns_client_killoldestquery(ns_client_t *client) { ISC_LIST_UNLINK(client->manager->recursing, oldest, rlink); UNLOCK(&client->manager->reclock); ns_query_cancel(oldest); - } else + isc_stats_increment(ns_g_server->nsstats, + dns_nsstatscounter_reclimitdropped); + } else { UNLOCK(&client->manager->reclock); + } } void diff --git a/bin/named/include/named/server.h b/bin/named/include/named/server.h index 7ee8f66d28a..3f96b7b78f8 100644 --- a/bin/named/include/named/server.h +++ b/bin/named/include/named/server.h @@ -222,7 +222,9 @@ enum { dns_nsstatscounter_tcphighwater = 57, - dns_nsstatscounter_max = 58 + dns_nsstatscounter_reclimitdropped = 58, + + dns_nsstatscounter_max = 59 }; /*% diff --git a/bin/named/statschannel.c b/bin/named/statschannel.c index 4cdf7d6fb66..a243599ab17 100644 --- a/bin/named/statschannel.c +++ b/bin/named/statschannel.c @@ -297,6 +297,9 @@ init_desc(void) { "QryNXRedirRLookup"); SET_NSSTATDESC(badcookie, "sent badcookie response", "QryBADCOOKIE"); SET_NSSTATDESC(keytagopt, "Keytag option received", "KeyTagOpt"); + SET_NSSTATDESC(reclimitdropped, + "queries dropped due to recursive client limit", + "RecLimitDropped"); INSIST(i == dns_nsstatscounter_max); /* Initialize resolver statistics */ diff --git a/bin/tests/system/fetchlimit/tests.sh b/bin/tests/system/fetchlimit/tests.sh index b77ba7bb9e2..b27d464fbe3 100644 --- a/bin/tests/system/fetchlimit/tests.sh +++ b/bin/tests/system/fetchlimit/tests.sh @@ -179,5 +179,17 @@ echo_i "clients count exceeded 360 on $exceeded trials (expected 0)" if [ $ret != 0 ]; then echo_i "failed"; fi status=`expr $status + $ret` +echo_i "checking drop statistics" +rm -f ns3/named.stats +$RNDCCMD stats +for try in 1 2 3 4 5; do + [ -f ns3/named.stats ] && break + sleep 1 +done +drops=`grep 'queries dropped due to recursive client limit' ns3/named.stats | sed 's/\([0-9][0-9]*\) queries.*/\1/'` +[ "${drops:-0}" -ne 0 ] || ret=1 +if [ $ret != 0 ]; then echo_i "failed"; fi +status=`expr $status + $ret` + echo_i "exit status: $status" [ $status -eq 0 ] || exit 1