mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-11 07:00:00 -04:00
Merge branch '3147-fix-more-ns_statscounter_recursclients-underflows-v9_18' into 'v9_18'
[v9_18] Fix more ns_statscounter_recursclients underflows See merge request isc-projects/bind9!5880
This commit is contained in:
commit
9862265cc9
4 changed files with 28 additions and 30 deletions
3
CHANGES
3
CHANGES
|
|
@ -1,3 +1,6 @@
|
|||
5814. [bug] The RecursClients statistics counter could underflow
|
||||
in certain resolution scenarios. [GL #3147]
|
||||
|
||||
5812. [func] Drop the artificial limit on the number of queries
|
||||
processed in a single TCP read callback. [GL #3141]
|
||||
|
||||
|
|
|
|||
|
|
@ -88,3 +88,9 @@ Bug Fixes
|
|||
not implemented when the BIND 9 networking stack was refactored in 9.16.
|
||||
The missing functionality has been re-implemented and outgoing zone
|
||||
transfers now time out properly when not progressing. :gl:`#1897`
|
||||
|
||||
- The statistics counter representing the current number of clients
|
||||
awaiting recursive resolution results (``RecursClients``) could be
|
||||
miscalculated in certain resolution scenarios, potentially causing the
|
||||
value of the counter to drop below zero. This has been fixed.
|
||||
:gl:`#3147`
|
||||
|
|
|
|||
|
|
@ -267,8 +267,7 @@ struct ns_client {
|
|||
#define NS_CLIENTATTR_WANTPAD 0x08000 /*%< pad reply */
|
||||
#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 */
|
||||
#define NS_CLIENTATTR_NOSETFC 0x20000 /*%< don't set servfail cache */
|
||||
|
||||
/*
|
||||
* Flag to use with the SERVFAIL cache to indicate
|
||||
|
|
|
|||
|
|
@ -2530,6 +2530,8 @@ prefetch_done(isc_task_t *task, isc_event_t *event) {
|
|||
*/
|
||||
if (client->recursionquota != NULL) {
|
||||
isc_quota_detach(&client->recursionquota);
|
||||
ns_stats_decrement(client->sctx->nsstats,
|
||||
ns_statscounter_recursclients);
|
||||
}
|
||||
|
||||
free_devent(client, &event, &devent);
|
||||
|
|
@ -2557,10 +2559,15 @@ query_prefetch(ns_client_t *client, dns_name_t *qname,
|
|||
if (client->recursionquota == NULL) {
|
||||
result = isc_quota_attach(&client->sctx->recursionquota,
|
||||
&client->recursionquota);
|
||||
if (result == ISC_R_SOFTQUOTA) {
|
||||
switch (result) {
|
||||
case ISC_R_SUCCESS:
|
||||
ns_stats_increment(client->sctx->nsstats,
|
||||
ns_statscounter_recursclients);
|
||||
break;
|
||||
case ISC_R_SOFTQUOTA:
|
||||
isc_quota_detach(&client->recursionquota);
|
||||
}
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -2770,10 +2777,15 @@ query_rpzfetch(ns_client_t *client, dns_name_t *qname, dns_rdatatype_t type) {
|
|||
if (client->recursionquota == NULL) {
|
||||
result = isc_quota_attach(&client->sctx->recursionquota,
|
||||
&client->recursionquota);
|
||||
if (result == ISC_R_SOFTQUOTA) {
|
||||
switch (result) {
|
||||
case ISC_R_SUCCESS:
|
||||
ns_stats_increment(client->sctx->nsstats,
|
||||
ns_statscounter_recursclients);
|
||||
break;
|
||||
case ISC_R_SOFTQUOTA:
|
||||
isc_quota_detach(&client->recursionquota);
|
||||
}
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -6185,15 +6197,6 @@ 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);
|
||||
|
|
@ -6332,7 +6335,6 @@ check_recursionquota(ns_client_t *client) {
|
|||
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) {
|
||||
|
|
@ -6381,18 +6383,6 @@ check_recursionquota(ns_client_t *client) {
|
|||
|
||||
dns_message_clonebuffer(client->message);
|
||||
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);
|
||||
}
|
||||
|
||||
return (result);
|
||||
|
|
|
|||
Loading…
Reference in a new issue