From 3df3b5efbdd5dea902f46c7546ffecf60c13889b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Fri, 14 Apr 2023 05:43:53 +0200 Subject: [PATCH 1/2] Run the forward_cancel on the appropriate zone->loop If the zone forwards are canceled from dns_zonemgr_shutdown(), the forward_cancel() would get called from the main loop, which is wrong. It needs to be called from the matching zone->loop. Run the dns_request_cancel() via isc_async_run() on the loop associated with the zone instead of calling the dns_request_cancel() directly from the main loop. --- lib/dns/zone.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/dns/zone.c b/lib/dns/zone.c index 5dd59da646..0a7d1d9d5d 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -11845,6 +11845,13 @@ checkds_cancel(dns_zone_t *zone) { } } +static void +forward_cancel_cb(void *arg) { + dns_request_t *request = arg; + dns_request_cancel(request); + dns_request_detach(&request); +} + static void forward_cancel(dns_zone_t *zone) { dns_forward_t *forward; @@ -11859,7 +11866,9 @@ forward_cancel(dns_zone_t *zone) { forward = ISC_LIST_NEXT(forward, link)) { if (forward->request != NULL) { - dns_request_cancel(forward->request); + dns_request_t *request = NULL; + dns_request_attach(forward->request, &request); + isc_async_run(zone->loop, forward_cancel_cb, request); } } } From 2423907b8754f550d983da455f6a9534a07ca87f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Fri, 14 Apr 2023 06:12:54 +0200 Subject: [PATCH 2/2] Add CHANGES note for [GL #4015] --- CHANGES | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGES b/CHANGES index f58c4e6c9f..2aa2225de3 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,9 @@ +6150. [bug] If the zones have active upstream forwards, the + shutting down the server might cause assertion + failures as the forward were all canceled from + the main loop instead from the loops associated + with the zone. [GL #4015] + 6149. [test] As a workaround, include an OpenSSL header file before including cmocka.h in the unit tests, because OpenSSL 3.1.0 uses __attribute__(malloc), conflicting with a