Hi All,

I'm debugging a rails app that's using libxml-ruby to parse Amazon AWS
xml documents.

I'm getting a SegFault on calling GC.start after calling
XML::Parser#parse on document, but this only occurs at some random
time in the future, say after 350 or more iterations of the code.

The juicy part of the gdb stack trace:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 46912503504000 (LWP 12822)]

0x00002aaaaebb9b72 in xmlXPathFreeNodeSet () from /usr/lib/libxml2.so.2

#0  0x00002aaaaebb9b72 in xmlXPathFreeNodeSet () from /usr/lib/libxml2.so.2
#1  0x00002aaaaebbae18 in xmlXPathFreeObject () from /usr/lib/libxml2.so.2
#2  0x000000000042c9b8 in garbage_collect () at gc.c:1209
--- snip ---

And the offending code:

            xmlparser = XML::Parser.string(str)
            @doc = xmlparser.parse
            GC.start

The reason for the GC.start right after the parse is that I found that
Ruby was not cleaning up memory properly after XML::Parser had done
its thing, leading mongrel to climb to glorious heights of memory
usage.  Adding this GC.start stopped cold the memory growth, but,
after parsing about 350-360 documents over time, Ruby decides to take
a vacation to SegFault land and never return.

Am I asleep at the wheel here with that GC.start call?

In order to reproduce this segfault, I'm using apache's ab to hammer
my site, which is parsing the same Amazon XML document.

I'm using libxml-ruby 0.5.3 with XML::Parser version 0.5.2.2 on an
x86_64 build of ubuntu on 2.6.15-51-amd64-server kernel.

Thanks,

Ben Lam

--
_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Reply via email to