mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 13:38:26 +00:00
Fix serve-stale hang at shutdown
The 'refresh_rrset' variable is used to determine if we can detach from the client. This can cause a hang on shutdown. To fix this, move setting of the 'nodetach' variable up to where 'refresh_rrset' is set (in query_lookup(), and thus not in ns_query_done()), and set it to false when actually refreshing the RRset, so that when this lookup is completed, the client will be detached.
This commit is contained in:
parent
240caa32b9
commit
ff5bacf17c
@ -5827,6 +5827,7 @@ query_refresh_rrset(query_ctx_t *orig_qctx) {
|
|||||||
qctx.client->query.dboptions &= ~(DNS_DBFIND_STALETIMEOUT |
|
qctx.client->query.dboptions &= ~(DNS_DBFIND_STALETIMEOUT |
|
||||||
DNS_DBFIND_STALEOK |
|
DNS_DBFIND_STALEOK |
|
||||||
DNS_DBFIND_STALEENABLED);
|
DNS_DBFIND_STALEENABLED);
|
||||||
|
qctx.client->nodetach = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We'll need some resources...
|
* We'll need some resources...
|
||||||
@ -6100,7 +6101,14 @@ query_lookup(query_ctx_t *qctx) {
|
|||||||
"%s stale answer used, an attempt to "
|
"%s stale answer used, an attempt to "
|
||||||
"refresh the RRset will still be made",
|
"refresh the RRset will still be made",
|
||||||
namebuf);
|
namebuf);
|
||||||
|
|
||||||
qctx->refresh_rrset = STALE(qctx->rdataset);
|
qctx->refresh_rrset = STALE(qctx->rdataset);
|
||||||
|
/*
|
||||||
|
* If we are refreshing the RRSet, we must not
|
||||||
|
* detach from the client in query_send().
|
||||||
|
*/
|
||||||
|
qctx->client->nodetach = qctx->refresh_rrset;
|
||||||
|
|
||||||
if (stale_found) {
|
if (stale_found) {
|
||||||
ns_client_extendederror(
|
ns_client_extendederror(
|
||||||
qctx->client, ede,
|
qctx->client, ede,
|
||||||
@ -11961,12 +11969,7 @@ ns_query_done(query_ctx_t *qctx) {
|
|||||||
/*
|
/*
|
||||||
* Client may have been detached after query_send(), so
|
* Client may have been detached after query_send(), so
|
||||||
* we test and store the flag state here, for safety.
|
* we test and store the flag state here, for safety.
|
||||||
* If we are refreshing the RRSet, we must not detach from the client
|
|
||||||
* in the query_send(), so we need to override the flag.
|
|
||||||
*/
|
*/
|
||||||
if (qctx->refresh_rrset) {
|
|
||||||
qctx->client->nodetach = true;
|
|
||||||
}
|
|
||||||
nodetach = qctx->client->nodetach;
|
nodetach = qctx->client->nodetach;
|
||||||
query_send(qctx->client);
|
query_send(qctx->client);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user