Discussion:
[Opendnssec-user] Superfluous use of xmlCleanupThreads()
Havard Eidnes
2016-11-27 09:38:39 UTC
Permalink
Hi,

with the upgrade to NetBSD 7.0 comes some additional consistency
checks in the pthread library, which turned out to fire for
OpenDNSSEC, leading to:

assertion "pthread__tsd_destructors[key] != NULL" failed: file "/usr/src/lib/libpthread/pthread_tsd.c", line 287, function "pthread_key_delete"
[1] Abort trap /usr/pkg/sbin/od...

The bug is that xmlCleanupThreads() from libxml2 is being called
after xmlCleanupParser() is called, and the latter has already
internally called the former. Therefore:

--- ./enforcer/utils/ksmutil.c.orig 2016-10-17 12:32:58.000000000 +0000
+++ ./enforcer/utils/ksmutil.c
@@ -4440,7 +4445,7 @@ main (int argc, char *argv[])

xmlCleanupParser();
xmlCleanupGlobals();
- xmlCleanupThreads();
+ /* xmlCleanupThreads(); Already done by xmlCleanupParser above */

exit(result);
}
--- signer/src/daemon/engine.c.orig 2016-10-17 12:32:58.000000000 +0000
+++ signer/src/daemon/engine.c
@@ -531,7 +531,7 @@ engine_setup(engine_type* engine)
engine = NULL;
xmlCleanupParser();
xmlCleanupGlobals();
- xmlCleanupThreads();
+ /* xmlCleanupThreads(); Done by xmlCleanupParser */
exit(0);
}
if (setsid() == -1) {
@@ -1085,7 +1085,7 @@ earlyexit:
ods_log_close();
xmlCleanupParser();
xmlCleanupGlobals();
- xmlCleanupThreads();
+ /* xmlCleanupThreads(); Already done by xmlCleanupParser */
}



(issues.opendnssec.org appears to be down at the moment,
otherwise I would have submitted there...)

There also appears to be some configure checks for
xmlCleanupThreads, xmlInitParser and xmlCleanupParser which can
probably all be dropped, as nothing appears to use the result of
those tests anyway, and the tests also appears to be wrong
because they don't link with -lxml2, so they are all mis-detected
with a result of "NO".

Regards,

- HÃ¥vard

Loading...