statschannel assertion failure

JINMEI Tatuya / 神明達哉 Jinmei_Tatuya at isc.org
Thu Feb 26 17:47:30 UTC 2009


At Thu, 26 Feb 2009 07:58:29 -0600,
Timothy Holtzen <tah at NebrWesleyan.edu> wrote:

> No it is a single processor on both production and test systems. 
> Production is an Opteron and the test system is an Athlon64 but both are
> single core processors.  Just to be sure I did a configured with a
> --disable-threads on the test system and tried again.  Testing still
> triggers the exception with the same errors.

Okay, then please try the revised patch.  This will make named abort
itself in the context of the libxml2 error, so please then get the
stack trace of the core dump and show it.

BTW, I tried to reproduce the problem by mostly concurrent access
like:
  wget http://127.0.0.1:5300/ &; wget http://127.0.0.1:5300/
but couldn't see the crash.

Also, since this happened even --disable-threads, it's very unlikely
to be a kind of race condition.  I have no idea how the concurrent
access relates to the problem at this moment.

---
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	26 Feb 2009 17:43:50 -0000
@@ -109,10 +109,60 @@
 #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);
+
+		INSIST(0);
+	}
+}
+#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]));



More information about the bind-users mailing list