daemon shutdown time with large zones (bind 9.2.4)

JINMEI Tatuya / 神明達哉 jinmei at isl.rdc.toshiba.co.jp
Sat Oct 2 00:34:40 UTC 2004


>>>>> On Sat, 02 Oct 2004 07:20:07 +0900, 
>>>>> JINMEI Tatuya <jinmei at isl.rdc.toshiba.co.jp> said:

>> Yes - that is right.  The daemon shuts down in ~6:36 now.

> Hmm, okay.  If you have time for an experimental, more-aggressive
> solution, could you try the attached patch to see how it works (either
> with or without ISC_MEM_USE_INTERNAL_MALLOC)?  It will completely skip
> freeing actual memory at the shutdown procedure.

Oops, sorry, the previous patch was not really correct (it had missing
initialization).  Please use this one (attached below) instead.

					JINMEI, Tatuya
					Communication Platform Lab.
					Corporate R&D Center, Toshiba Corp.
					jinmei at isl.rdc.toshiba.co.jp

diff -r -u bind-9.2.4.orig/bin/named/server.c bind-9.2.4/bin/named/server.c
--- bind-9.2.4.orig/bin/named/server.c	Fri May 14 10:04:46 2004
+++ bind-9.2.4/bin/named/server.c	Sat Oct  2 09:32:56 2004
@@ -2368,6 +2368,7 @@
 	     view = view_next) {
 		view_next = ISC_LIST_NEXT(view, link);
 		ISC_LIST_UNLINK(server->viewlist, view, link);
+		isc_mem_setshutdown(view->mctx);
 		if (flush)
 			dns_view_flushanddetach(&view);
 		else
diff -r -u bind-9.2.4.orig/lib/isc/include/isc/mem.h bind-9.2.4/lib/isc/include/isc/mem.h
--- bind-9.2.4.orig/lib/isc/include/isc/mem.h	Tue Mar  9 15:11:58 2004
+++ bind-9.2.4/lib/isc/include/isc/mem.h	Sat Oct  2 09:32:56 2004
@@ -410,6 +410,8 @@
  *	limit > 0
  */
 
+void
+isc_mem_setshutdown(isc_mem_t *ctx);
 
 /*
  * Pseudo-private functions for use via macros.  Do not call directly.
diff -r -u bind-9.2.4.orig/lib/isc/mem.c bind-9.2.4/lib/isc/mem.c
--- bind-9.2.4.orig/lib/isc/mem.c	Tue Mar  9 15:11:48 2004
+++ bind-9.2.4/lib/isc/mem.c	Sat Oct  2 09:32:56 2004
@@ -146,6 +146,8 @@
 #endif
 
 	unsigned int		memalloc_failures;
+
+	isc_boolean_t		shuttingdown;
 };
 
 #define MEMPOOL_MAGIC		ISC_MAGIC('M', 'E', 'M', 'p')
@@ -616,7 +618,8 @@
 #else
 	UNUSED(size);
 #endif
-	(ctx->memfree)(ctx->arg, mem);
+	if (!ctx->shuttingdown)
+		(ctx->memfree)(ctx->arg, mem);
 }
 
 /*
@@ -722,6 +725,7 @@
 	ctx->arg = arg;
 	ctx->stats = NULL;
 	ctx->checkfree = ISC_TRUE;
+	ctx->shuttingdown = ISC_FALSE;
 	ISC_LIST_INIT(ctx->pools);
 
 #if ISC_MEM_USE_INTERNAL_MALLOC
@@ -1723,4 +1727,13 @@
 		UNLOCK(mpctx->lock);
 
 	return (fillcount);
+}
+
+void
+isc_mem_setshutdown(isc_mem_t *ctx) {
+	REQUIRE(VALID_CONTEXT(ctx));
+
+	LOCK(&ctx->lock);
+	ctx->shuttingdown = ISC_TRUE;
+	UNLOCK(&ctx->lock);
 }


More information about the bind-users mailing list