From: Evan Hunt Date: Tue, 23 May 2023 21:33:28 +0000 (-0700) Subject: don't set SHUTTINGDOWN until after calling the request callbacks X-Git-Tag: v9.19.14~24^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=512e5e786be5445bc5659ea4a0a7be9e5306b8e8;p=thirdparty%2Fbind9.git don't set SHUTTINGDOWN until after calling the request callbacks if we set ISC_HTTPDMGR_SHUTTINGDOWN in the http manager before calling the pending request callbacks, it can trigger an assertion. --- diff --git a/lib/isc/httpd.c b/lib/isc/httpd.c index 2dd7061f82e..25605cd72a3 100644 --- a/lib/isc/httpd.c +++ b/lib/isc/httpd.c @@ -940,15 +940,17 @@ isc_httpdmgr_shutdown(isc_httpdmgr_t **httpdmgrp) { isc_nm_stoplistening(httpdmgr->sock); LOCK(&httpdmgr->lock); - httpdmgr->flags |= ISC_HTTPDMGR_SHUTTINGDOWN; - isc_httpd_t *httpd, *next; + isc_httpd_t *httpd = NULL, *next = NULL; ISC_LIST_FOREACH_SAFE (httpdmgr->running, httpd, link, next) { if (httpd->handle != NULL) { httpd_request(httpd->handle, ISC_R_SUCCESS, NULL, httpd); } } + + httpdmgr->flags |= ISC_HTTPDMGR_SHUTTINGDOWN; + UNLOCK(&httpdmgr->lock); isc_nmsocket_close(&httpdmgr->sock);