From c54210716ee55b55e22d8dad56fd696a641fc98d Mon Sep 17 00:00:00 2001 From: Bob Halley Date: Wed, 11 Jul 2001 01:19:56 +0000 Subject: [PATCH] avoid deadlock with the ADB when shutting down [RT #1324] --- CHANGES | 4 ++++ lib/dns/resolver.c | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index a2e8137617..747b87efd8 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,8 @@ + 926. [bug] The resolver could deadlock with the ADB when + shutting down (multithreaded builds only). + [RT #1324] + 925. [cleanup] Remove openssl from the distribution; require that --with-openssl be specified if DNSSEC is needed. diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index f5a519c7f4..49734ae471 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: resolver.c,v 1.217 2001/06/04 19:33:09 tale Exp $ */ +/* $Id: resolver.c,v 1.218 2001/07/11 01:19:56 halley Exp $ */ #include @@ -1959,6 +1959,13 @@ fctx_doshutdown(isc_task_t *task, isc_event_t *event) { validator = ISC_LIST_NEXT(validator, link); } + /* + * Shut down anything that is still running on behalf of this + * fetch. To avoid deadlock with the ADB, we must do this + * before we lock the bucket lock. + */ + fctx_stopeverything(fctx, ISC_FALSE); + LOCK(&res->buckets[bucketnum].lock); INSIST(fctx->state == fetchstate_active || @@ -1966,7 +1973,6 @@ fctx_doshutdown(isc_task_t *task, isc_event_t *event) { INSIST(fctx->want_shutdown); if (fctx->state != fetchstate_done) { - fctx_stopeverything(fctx, ISC_FALSE); fctx->state = fetchstate_done; fctx_sendevents(fctx, ISC_R_CANCELED); }