Hey Sean,

(1..10000).each{|time|
XML::Document.file('test.xml')
p time if time % 100 == 0
}
It won't segfault anymore, but now I get the following error:
Too many open filesI/O warning : failed to load external entity "test.xml"
libxml-test.rb:7:in `file': test.xml (IOError)
    from libxml-test.rb:7
    from libxml-test.rb:6:in `each'
    from libxml-test.rb:6
However, the error disappears if "GC.start" is inserted just above
XML::Document.file(...).

Right. This is another Ruby GC issue. If you don't call GC.start, then all the documents that you have created remain open. I assume this causes the OS to eventually run out of file handles, thus resulting in the error (which is being raised by libxml not Ruby).

By calling GC.start, the documents are freed and the file handles are released.

So I don't see this as a bug in the libxml bindings.


Hrm.... while it's not technically a libxml error, one could easily argue that libxml should call rb_gc_start() if the open fails and retry.

Ah, good idea.  It just retries once after doing a GC?

Have time to turn this into a test case?

Charlie

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

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

Reply via email to