2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

Merge branch '1719-observed-stats-underflow-in-multiple-stats' into 'main'

Resolve "Observed stats underflow in multiple stats"

Closes #1719

See merge request isc-projects/bind9!3818
This commit is contained in:
Diego dos Santos Fronza
2020-07-13 18:28:58 +00:00
4 changed files with 35 additions and 1 deletions

View File

@@ -1,3 +1,6 @@
5466. [bug] Addressed an error in recursive clients stats reporting.
[GL #1719]
5465. [func] Fallback to built in trust-anchors, managed-keys, or
trusted-keys if the bindkeys-file (bind.keys) cannot
be parsed. [GL #1235]

View File

@@ -49,6 +49,14 @@ Feature Changes
Bug Fixes
~~~~~~~~~
- Addressed an error in recursive clients stats reporting.
There were occasions when an incoming query could trigger a prefetch for
some eligible rrset, and if the prefetch code were executed before recursion,
no increment in recursive clients stats would take place. Conversely,
when processing the answers, if the recursion code were executed before the
prefetch, the same counter would be decremented without a matching increment.
[GL #1719]
- The DS set returned by ``dns_keynode_dsset()`` was not thread-safe.
This could result in an INSIST being triggered. [GL #1926]

View File

@@ -264,6 +264,7 @@ struct ns_client {
#define NS_CLIENTATTR_USEKEEPALIVE 0x10000 /*%< use TCP keepalive */
#define NS_CLIENTATTR_NOSETFC 0x20000 /*%< don't set servfail cache */
#define NS_CLIENTATTR_RECURSING 0x40000 /*%< client is recursing */
/*
* Flag to use with the SERVFAIL cache to indicate

View File

@@ -5686,6 +5686,15 @@ fetch_callback(isc_task_t *task, isc_event_t *event) {
isc_quota_detach(&client->recursionquota);
ns_stats_decrement(client->sctx->nsstats,
ns_statscounter_recursclients);
} else if (client->attributes & NS_CLIENTATTR_RECURSING) {
client->attributes &= ~NS_CLIENTATTR_RECURSING;
/*
* Detached from recursionquota via prefetch_done(),
* but need to decrement recursive client stats here anyway,
* since it was incremented in ns_query_recurse().
*/
ns_stats_decrement(client->sctx->nsstats,
ns_statscounter_recursclients);
}
LOCK(&client->manager->reclock);
@@ -5834,6 +5843,7 @@ ns_query_recurse(ns_client_t *client, dns_rdatatype_t qtype, dns_name_t *qname,
if (result == ISC_R_SUCCESS || result == ISC_R_SOFTQUOTA) {
ns_stats_increment(client->sctx->nsstats,
ns_statscounter_recursclients);
client->attributes |= NS_CLIENTATTR_RECURSING;
}
if (result == ISC_R_SOFTQUOTA) {
@@ -5887,6 +5897,18 @@ ns_query_recurse(ns_client_t *client, dns_rdatatype_t qtype, dns_name_t *qname,
}
ns_client_recursing(client);
} else if ((client->attributes & NS_CLIENTATTR_RECURSING) == 0) {
client->attributes |= NS_CLIENTATTR_RECURSING;
/*
* query_prefetch() attached first to client->recursionquota,
* but we must check if NS_CLIENTATTR_RECURSING attribute is
* on, if not then turn it on and increment recursing clients
* stats counter only once. The attribute is also checked in
* fetch_callback() to know if a matching decrement to this
* counter should be applied.
*/
ns_stats_increment(client->sctx->nsstats,
ns_statscounter_recursclients);
}
/*