max-cache-size doesn't work with 9.5.0b1
Mark Andrews
Mark_Andrews at isc.org
Sun Feb 3 16:04:44 PST 2008
> On 2008.01.30. 3:28, JINMEI Tatuya / ç¥æéå wrote:
> > Okay, please use the attached patch (applicable to 9.5.0b1, and also
> > to 9.5.0b2 when it's published). Build it with:
> > % STD_CDEFINES='-DLRU_DEBUG2=2' ./configure --enable-threads
> > (or set STD_CDEFINES using setenv if you use a csh variant)
> >
> > The log messages shouldn't be very noisy, but if you find them too
> > frequent, rebuild it with:
> > % STD_CDEFINES='-DLRU_DEBUG2=1' ./configure --enable-threads
> >
> > Note that, if this is a thread-related bug, it may not always be
> > reproduceable; please try several times if the problem doesn't seem to
> > happen. (BTW: did it always occur when you first found the problem?)
> >
> Yes, if bind was built with threads, the memory usage always grew behind
> max-cache-size very quickly.
>
> Here is the log:
> http://people.fsn.hu/~bra/freebsd/bind950-memory-20080203/bind950b1
> the memory usage (RSS, reported by top) in megabytes:
> 19:10:37 466
> 19:11:20 522
> 19:11:53 566
> 19:13:06 666
> 19:14:17 766
>
> max-cache-size was set to 64M.
Please try this patch.
Mark
Index: lib/dns/cache.c
===================================================================
RCS file: /proj/cvs/prod/bind9/lib/dns/cache.c,v
retrieving revision 1.76
diff -u -r1.76 cache.c
--- lib/dns/cache.c 19 Oct 2007 17:15:53 -0000 1.76
+++ lib/dns/cache.c 3 Feb 2008 23:59:46 -0000
@@ -708,8 +708,11 @@
LOCK(&cache->cleaner.lock);
- dns_db_overmem(cache->db, overmem);
- cache->cleaner.overmem = overmem;
+ if (overmem != cache->cleaner.overmem) {
+ dns_db_overmem(cache->db, overmem);
+ cache->cleaner.overmem = overmem;
+ isc_mem_water(cache->mctx, mark);
+ }
UNLOCK(&cache->cleaner.lock);
}
Index: lib/isc/mem.c
===================================================================
RCS file: /proj/cvs/prod/bind9/lib/isc/mem.c,v
retrieving revision 1.140
diff -u -r1.140 mem.c
--- lib/isc/mem.c 18 Jan 2008 23:46:58 -0000 1.140
+++ lib/isc/mem.c 3 Feb 2008 23:59:48 -0000
@@ -1086,7 +1086,6 @@
ADD_TRACE(ctx, ptr, size, file, line);
if (ctx->hi_water != 0U && !ctx->hi_called &&
ctx->inuse > ctx->hi_water) {
- ctx->hi_called = ISC_TRUE;
call_water = ISC_TRUE;
}
if (ctx->inuse > ctx->maxinuse) {
@@ -1144,8 +1143,6 @@
*/
if (ctx->hi_called &&
(ctx->inuse < ctx->lo_water || ctx->lo_water == 0U)) {
- ctx->hi_called = ISC_FALSE;
-
if (ctx->water != NULL)
call_water = ISC_TRUE;
}
@@ -1155,6 +1152,18 @@
(ctx->water)(ctx->water_arg, ISC_MEM_LOWATER);
}
+void
+isc_mem_water(isc_mem_t *ctx, int flag) {
+ REQUIRE(VALID_CONTEXT(ctx));
+
+ MCTXLOCK(ctx, &ctx->lock);
+ if (flag == ISC_MEM_LOWATER)
+ ctx->hi_called = ISC_FALSE;
+ else if (flag == ISC_MEM_HIWATER)
+ ctx->hi_called = ISC_TRUE;
+ MCTXUNLOCK(ctx, &ctx->lock);
+}
+
#if ISC_MEM_TRACKLINES
static void
print_active(isc_mem_t *mctx, FILE *out) {
--
Mark Andrews, ISC
1 Seymour St., Dundas Valley, NSW 2117, Australia
PHONE: +61 2 9871 4742 INTERNET: Mark_Andrews at isc.org
More information about the freebsd-performance
mailing list