At Tue, 24 Feb 2009 14:26:45 -0600, Timothy Holtzen <t...@nebrwesleyan.edu> wrote:
> Hi guys I'm getting this assertion failure again under Bind 9.5.1-P1 on > RHEL 5.2. > > Feb 23 22:00:01 foo named[18476]: statschannel.c:696: INSIST(xmlrc >= 0) > failed > Feb 23 22:00:01 foo named[18476]: exiting (due to assertion failure) > > I posted about it once before. I understand that this is caused by a > failure in xmlTextWriterEndElement() which should normally succeed. It > was suggested last time that this could be caused by a memory allocation > failure and it was suggested that as a work around I suppress memory > usage using max-cache-size. I went ahead and limited it to 130Meg and > have been monitoring since. I've never seen the memory footprint for > bind go up beyond a few hundred Meg on a system with 2Gig of ram so I'm > thinking that memory allocation may not be the problem. Can you try the patch copied below? It will make allow named to log libxml internal errors. Hopefully this will provide some hints about what happened. The patch also does libxml2 initialization at the named's own initialization step. Most of our use of libxml2 should be thread-safe, but some of the initialization steps (which are currently triggered first time statistics is dump) could cause a race. If this is the case, it may fix the crash as well. I actually doubt that, but if that is the case, please also try removing the following line in the patch: xmlInitParser(); to see whether you can reproduce it again. Thanks, --- JINMEI, Tatuya Internet Systems Consortium, Inc. Index: statschannel.c =================================================================== RCS file: /proj/cvs/prod/bind9/bin/named/statschannel.c,v retrieving revision 1.2.2.13.2.1 diff -u -r1.2.2.13.2.1 statschannel.c --- statschannel.c 18 Dec 2008 02:39:12 -0000 1.2.2.13.2.1 +++ statschannel.c 25 Feb 2009 04:14:21 -0000 @@ -109,10 +109,58 @@ #endif } +#ifdef HAVE_LIBXML2 +static void +error_libxml2(void *ctx, xmlErrorPtr error) { + xmlParserCtxtPtr pctx; + ns_server_t *server = ctx; + char *msg, *cp; + + REQUIRE(server != NULL); + REQUIRE(error != NULL); + + /* + * Save the error code, if available, so that it can be used in the main + * code. No lock is necessary here. + */ + pctx = error->ctxt; + if (pctx != NULL && pctx->myDoc != NULL && + pctx->myDoc->_private != NULL) { + *(int *)pctx->myDoc->_private = error->code; + } + + /* + * Log the error message. Since some libxml2 error messages are + * terminated with a CR, we make a local copy to remove it. This is + * expensive, but should be okay as we don't expect to see libxml2 + * errors so often. + */ + if (error->message != NULL) { + msg = isc_mem_strdup(server->mctx, error->message); + if (msg == NULL) + return; + cp = strchr(msg, '\n'); + if (cp != NULL) + *cp = '\0'; + + isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, + NS_LOGMODULE_SERVER, ISC_LOG_INFO, + "libxml2 Error: %s", msg); + + isc_mem_free(server->mctx, msg); + } +} +#endif + static void init_desc(void) { int i; +#ifdef HAVE_LIBXML2 + xmlSetStructuredErrorFunc(ns_g_server, error_libxml2); + xmlInitParser(); +#endif + /* Initialize name server statistics */ memset(nsstats_desc, 0, dns_nsstatscounter_max * sizeof(nsstats_desc[0])); _______________________________________________ bind-users mailing list bind-users@lists.isc.org https://lists.isc.org/mailman/listinfo/bind-users