[libxml-devel] [ libxml-Bugs-8337 ] Opening many files causes segfault on fbsd-amd64

Charlie Savage cfis at savagexi.com
Thu Jul 10 23:30:29 EDT 2008


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://rubyforge.org/pipermail/libxml-devel/attachments/20080710/66c92283/attachment.bin>


More information about the libxml-devel mailing list