statschannel assertion failure

Timothy Holtzen tah at NebrWesleyan.edu
Wed Feb 25 20:17:27 UTC 2009


I applied the patch on my test system and ran my little test using wget
and this is the output I got in the log

Feb 25 13:51:12 arthur named[17030]: libxml2 Error: Input is not proper
UTF-8, indicate encoding !
Feb 25 13:51:12 arthur named[17030]: libxml2 Error:
xmlTextWriterWriteDocCallback : XML error 9 !
Feb 25 13:51:12 arthur named[17030]: libxml2 Error: write error
Feb 25 13:51:12 arthur named[17030]: statschannel.c:744: INSIST(xmlrc >=
0) failed
Feb 25 13:51:12 arthur named[17030]: exiting (due to assertion failure)

Since it failed with the full patch I figured removing xmlInitParser()
wouldn't make a difference.  I decided to try anyway and got the same
result.

JINMEI Tatuya / 神明達哉 wrote:
> At Tue, 24 Feb 2009 14:26:45 -0600,
> Timothy Holtzen <tah at 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 at lists.isc.org
> https://lists.isc.org/mailman/listinfo/bind-users
>   

-- 
Timothy A. Holtzen
Campus Network Administrator
Nebraska Wesleyan University




More information about the bind-users mailing list