[lxml-dev] *** glibc detected *** free(): invalid pointer: 0x086449e7 ***

Doug Winter doug at isotoma.com
Mon Mar 5 15:42:16 CET 2007


Hi,

I'm getting this error at times using lxml:

*** glibc detected *** free(): invalid pointer: 0x086449e7 ***

Unfortunately the smallest test fixture I have that does this involves 
running all of TurboGears - when I do this without TurboGears I don't 
get the error.  However, I've got a backtrace from gdb that points it's 
finger at libxml2.  I'm trying here first in case this is really an lxml 
problem.

(gdb) bt
#0  0xb7fcd410 in ?? ()
#1  0xb4a9ac4c in ?? ()
#2  0x00000006 in ?? ()
#3  0x00007da7 in ?? ()
#4  0xb7e7c811 in raise () from /lib/tls/i686/cmov/libc.so.6
#5  0xb7e7dfb9 in abort () from /lib/tls/i686/cmov/libc.so.6
#6  0xb7eb1d3a in __fsetlocking () from /lib/tls/i686/cmov/libc.so.6
#7  0xb7eb95cf in mallopt () from /lib/tls/i686/cmov/libc.so.6
#8  0xb7eb9672 in free () from /lib/tls/i686/cmov/libc.so.6
#9  0xb729055d in xmlFreeNodeList () from /usr/lib/libxml2.so.2
#10 0xb72906a2 in xmlFreeProp () from /usr/lib/libxml2.so.2
#11 0xb729091b in xmlFreePropList () from /usr/lib/libxml2.so.2
#12 0xb72904fa in xmlFreeNodeList () from /usr/lib/libxml2.so.2
#13 0xb72902fe in xmlFreeDoc () from /usr/lib/libxml2.so.2
#14 0xb73f3cc6 in initTagMatch ()
    from 
/var/local/sites/mma.dev7.isotoma.com/lib/python2.4/site-packages/lxml/etree.so
#15 0xb73f3aec in initTagMatch ()
    from 
/var/local/sites/mma.dev7.isotoma.com/lib/python2.4/site-packages/lxml/etree.so
#16 0xb73b9826 in iteratorStoreNext ()
    from 
/var/local/sites/mma.dev7.isotoma.com/lib/python2.4/site-packages/lxml/etree.so
#17 0xb73b968c in iteratorStoreNext ()
    from 
/var/local/sites/mma.dev7.isotoma.com/lib/python2.4/site-packages/lxml/etree.so
#18 0xb73beb06 in iteratorStoreNext ()
    from 
/var/local/sites/mma.dev7.isotoma.com/lib/python2.4/site-packages/lxml/etree.so

The code that causes this is calling the html method of an instance of 
the following class (I've provided the whole thing for context):

class Weather(Entity):
     has_field('id', Integer, primary_key=True)
     has_field('url', String)
     has_field('latitude', Numeric(10, 7), nullable=False)
     has_field('longitude', Numeric(10, 7), nullable=False)
     has_field('document', Unicode)
     using_options(tablename='weather')

     xsl = etree.XSLT(etree.parse(open(os.path.join(util.datadir(), 
'xsl', 'weather.xsl'))))

     @classmethod
     def near(klass, latitude, longitude):
         return 
klass.select(order_by=func.sqrt(func.pow(klass.c.latitude-latitude, 2) +
 
func.pow(klass.c.longitude-longitude,2)),
                             limit=1)[0]

     def html(self):
         doc = etree.fromstring(self.document)
         html = self.xsl(doc)
         return unicode(html)

Can anyone point me in the right direction to help debug or fix this?

Cheers,

Doug.

-- 
Isotoma, Open Source Software Consulting - http://www.isotoma.com
Tel: 01904 567349, Mobile: 07879 423002, Fax: 020 79006980
Postal Address: Tower House, Fishergate, York, YO10 4UA, UK

Registered in England.  Company No 5171172.  VAT GB843570325.
Registered Office: 19a Goodge Street, London, W1T 2PH


More information about the lxml-dev mailing list