Segfault in lxml during element copy
John Krukoff <jkrukoff <at> ltgc.com>
2006-08-01 03:33:52 GMT
I've been working on an XML based middleware system written in python
and lxml, and I've started experiencing a segfault problem with lxml
just as it's being rolled out to the rest of the team. Embarrassing,
It looks like a double free problem, as the crash is always acompanied
by a glibc message that looks like this:
*** glibc detected *** free(): invalid pointer: 0x0813e1a4 ***
I've tried to come up with a stripped down test case to repeat the
problem, but have been unable to reproduce it except in the full
application. It's not absolutely consistent, I'll have to run the same
request 3 or 4 times before it crashes, but it always does, even while
generating identical output from identical input for those 3 or 4 calls.
I've tracked down the line it crashes at, and it's a simple copy
called on an XML element:
copied = copy.copy( element )
If I remove it, and operate on the source xml directly instead of
copying it (it's really just a safety mechanism), it still crashes,
just in more random locations.
I'm running lxml 1.0.2, on Python 2.4.3, with libxml2 2.6.26 and
libxslt 1.1.17 if it matters. The problem is reproducible on a
coworkers machine, also running lxml 1.0.2 with slightly different
minor revisions of the xml libraries.