2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 21:47:59 +00:00

Reorder the nsupdate shutdown code to shutdown managers early

If the dns_request send callback is delayed, the dst API would get
deinitialized and then the detach from the tsig key would cause an
assertion failure.

Shutdown the isc_managers early, and only then dereference the dst
objects when cleaning up the resources used by nsupdate.
This commit is contained in:
Ondřej Surý 2022-03-03 14:44:28 +01:00
parent f3ca90a804
commit be34b1c535

View File

@ -719,12 +719,6 @@ doshutdown(void) {
dns_message_detach(&updatemsg); dns_message_detach(&updatemsg);
} }
if (is_dst_up) {
ddebug("Destroy DST lib");
dst_lib_destroy();
is_dst_up = false;
}
ddebug("Destroying request manager"); ddebug("Destroying request manager");
dns_requestmgr_detach(&requestmgr); dns_requestmgr_detach(&requestmgr);
@ -3305,6 +3299,9 @@ cleanup(void) {
} }
UNLOCK(&answer_lock); UNLOCK(&answer_lock);
ddebug("Shutting down managers");
isc_managers_destroy(&netmgr, &taskmgr, NULL);
#if HAVE_GSSAPI #if HAVE_GSSAPI
if (tsigkey != NULL) { if (tsigkey != NULL) {
ddebug("detach tsigkey x%p", tsigkey); ddebug("detach tsigkey x%p", tsigkey);
@ -3320,9 +3317,6 @@ cleanup(void) {
dst_key_free(&sig0key); dst_key_free(&sig0key);
} }
ddebug("Shutting down managers");
isc_managers_destroy(&netmgr, &taskmgr, NULL);
ddebug("Destroying event"); ddebug("Destroying event");
isc_event_free(&global_event); isc_event_free(&global_event);
@ -3356,6 +3350,12 @@ cleanup(void) {
isc_mem_destroy(&gmctx); isc_mem_destroy(&gmctx);
isc_mutex_destroy(&answer_lock); isc_mutex_destroy(&answer_lock);
if (is_dst_up) {
ddebug("Destroy DST lib");
dst_lib_destroy();
is_dst_up = false;
}
} }
static void static void