invalid pointer in libxml xmlFreeNodeList

Hi,

Not sure if there is a better place to post this. The libxml-ruby mailing list doesn't have much activity.
We are getting occasional errors on our production box, that I can't duplicate in testing. It's not even reproducible on the production box with the same inputs, but I've managed to track down (via a lot of print statements into the Apache logs) that it is dying during the save of one of our models, and it appears to be during the native memory cleanup of libxml-ruby.

The following is appearing in the Apache error.log (we are running Passenger)

*** glibc detected *** Rails: /var/www/Liftronic: free(): invalid pointer: 0x0000000008884499 ***
======= Backtrace: =========
/lib/libc.so.6[0x2b5e6e225cb8]
/lib/libc.so.6(cfree+0x76)[0x2b5e6e228276]
/usr/lib/libxml2.so.2(xmlFreeNodeList+0x221)[0x2b5e72f8d411]
/usr/lib/libxml2.so.2(xmlFreeNodeList+0x6d)[0x2b5e72f8d25d]
/usr/lib/libxml2.so.2(xmlFreeDoc+0xb8)[0x2b5e72f8d0a8]
/usr/lib/libruby1.8.so.1.8[0x2b5e6d61ddd2]
/usr/lib/libruby1.8.so.1.8(ruby_xmalloc+0x87)[0x2b5e6d61e2b7]
/usr/lib/libruby1.8.so.1.8[0x2b5e6d5fae72]
/usr/lib/libruby1.8.so.1.8[0x2b5e6d5fdd22]
/usr/lib/libruby1.8.so.1.8[0x2b5e6d605f7d]
/usr/lib/libruby1.8.so.1.8[0x2b5e6d608b43]
/usr/lib/libruby1.8.so.1.8[0x2b5e6d608dfa]
/usr/lib/libruby1.8.so.1.8[0x2b5e6d602cf0]

The model that is being saved has a one-many relationship with another model which has XML attached to it, which is being processed using libxml, but I can't see anything wrong in any of that code.

We are running libxml-ruby 1.1.3 and 2.6.32.dfsg-5ubuntu4.2 of libxml2, running on Ubuntu 9.04.

Does anyone have any suggestions on how to proceed with fixing the issue?

Cheers
Simon

We are running libxml-ruby 1.1.3 and 2.6.32.dfsg-5ubuntu4.2 of libxml2,
running on Ubuntu 9.04.

Does anyone have any suggestions on how to proceed with fixing the issue?

Test with another xml-lib? REXML or Nokogiri, there are probably more
that you can try.

We moved away from REXML 12 months ago because of the speed. No way we can go back. I might try to switch to Nokogiri, but there is a lot of XML parsing in our app, so changing libs is going to be a big deal.

Thanks
Simon

Quoting Simon Macneall <macneall@gmail.com>: