]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
add a stats counter for clients dropped due to recursive-clients limit
authorEvan Hunt <each@isc.org>
Tue, 26 Nov 2019 05:28:10 +0000 (21:28 -0800)
committerEvan Hunt <each@isc.org>
Tue, 26 Nov 2019 19:20:12 +0000 (11:20 -0800)
(cherry picked from commit 715afa9c5771ca5b483aad77fe21906685d63889)

CHANGES
bin/named/statschannel.c
bin/tests/system/fetchlimit/tests.sh
lib/ns/client.c
lib/ns/include/ns/stats.h

diff --git a/CHANGES b/CHANGES
index f109f7681f30ebc329e7f6c85d19a46084e52cce..966c9044bd5b414de9c9df025c1e66ad0b696417 100644 (file)
--- 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]
index abaeed5e8ed697e10cfb0b2e557f1f10c55566dd..3c8383418f8d59240583c682f049002cb13988dd 100644 (file)
@@ -317,6 +317,9 @@ init_desc(void) {
                       "QryUsedStale");
        SET_NSSTATDESC(prefetch, "queries triggered prefetch", "Prefetch");
        SET_NSSTATDESC(keytagopt, "Keytag option received", "KeyTagOpt");
+       SET_NSSTATDESC(reclimitdropped,
+                      "queries dropped due to recursive client limit",
+                      "RecLimitDropped");
 
        INSIST(i == ns_statscounter_max);
 
index 747ae07dfc9891e323ac4eb871bf35b6c190089b..3065060d06f83cb48bd10712221948533d4fa672 100644 (file)
@@ -179,5 +179,17 @@ echo_i "clients count exceeded 380 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
index 84b78ac0fe998bc315caf16b10f241aea4ac981c..0fe930f85b175f850904dcea5189b881e3144508 100644 (file)
@@ -278,8 +278,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
+               ns_stats_increment(client->sctx->nsstats,
+                                  ns_statscounter_reclimitdropped);
+       } else {
                UNLOCK(&client->manager->reclock);
+       }
 }
 
 void
index 175813113ebffa3ff6f5f797499c533e044869cf..8afe14260f1aa578b70843732e011d7de9ca67b0 100644 (file)
@@ -104,7 +104,9 @@ enum {
 
        ns_statscounter_tcphighwater = 65,
 
-       ns_statscounter_max = 66,
+       ns_statscounter_reclimitdropped = 66,
+
+       ns_statscounter_max = 67,
 };
 
 void