[libxml-devel] Crash in ruby_xml_xpath_object_mark
Luc Heinrich
luc at honk-honk.com
Thu Feb 7 07:17:04 EST 2008
Greetings,
I have recently switched from REXML to libxml-ruby (0.5.2) because I
really needed a major speed boost for a web application and libxml-
ruby really delivered. Some parts of the code which were taking more
than 30 seconds are now running under 0.2 seconds, I'll take a 150x
speed boost any day ;)
HOWEVER, I also discovered that this comes at a price: libxml-ruby is
*VERY* unstable and crashes very frequently under high(-ish) memory
pressures. I have seen mentions in past messages about a new memory
model being used, but I still get very frequent crashes.
For example, I was able to track one down in
'ruby_xml_xpath_object_mark' (that's in ext/xml/
ruby_xml_xpath_object.c) where the use of 'xpop->nodesetval->nodeNr'
causes the crash because 'nodesetval' is NULL. The top of the stack
always looks like this:
0 libxml_so.bundle 0x002f2484 ruby_xml_xpath_object_mark + 92
1 libruby.dylib 0x00238dd8 gc_mark_children + 1628
2 libruby.dylib 0x00238744 gc_mark + 196
3 libruby.dylib 0x002383e8 mark_locations_array + 148
4 libruby.dylib 0x00239c24 garbage_collect + 340
5 libruby.dylib 0x00237f80 rb_newobj + 44
...
I don't know the libxml-ruby code well enough yet to propose a clean
fix (I'm not sure that simply testing for NULL on nodesetval would be
enough or appropriate), so if anyone could chime in... :)
Thanks.
--
Luc Heinrich
More information about the libxml-devel
mailing list