森脇です。

Debianでrubyをパッケージ化しております。ユーザからエラー報告がありましたので、お
尋ねします。

LibXml[1]を次のように使うと、
  [BUG] object allocation during garbage collection phase
というエラーでクラッシュします。LibXmlの問題なのかもしれませんが、メッセージから
するとRubyの問題のように見えるのですが、いかがでしょうか。Ruby 1.8.6では問題な
かったのですが、1.8.7にアップグレードするとエラーとなります。

環境:
ruby 1.8.7 (2008-05-31 patchlevel 0) [i486-linux]
LibXml 0.5.2.0

[1] http://libxml.rubyforge.org/


===== reproducible =====

require 'xml/libxml'

i = 0
while true
      XML::Document.new
      i += 1
      puts "***************** #{i} *********" if i%100 == 0
end

===========================

stack trace

(snip)
***************** 206300 *********
***************** 206400 *********
***************** 206500 *********
***************** 206600 *********
./libxml-ruby-bug.rb:7: [BUG] object allocation during garbage collection phase
ruby 1.8.7 (2008-05-31 patchlevel 0) [i486-linux]


Program received signal SIGABRT, Aborted.
[Switching to Thread 0xb7d1ab60 (LWP 29312)]
0xffffe410 in __kernel_vsyscall ()
(gdb) bt
#0  0xffffe410 in __kernel_vsyscall ()
#1  0xb7d45ef5 in raise () from /lib/i686/cmov/libc.so.6
#2  0xb7d47871 in abort () from /lib/i686/cmov/libc.so.6
#3  0xb7f0671b in rb_bug (
    fmt=0xb7f9409c "object allocation during garbage collection phase")at
error.c:213
#4  0xb7f2a2f5 in rb_newobj () at gc.c:422
#5  0xb7f2a322 in rb_data_object_alloc (klass=3083878900, datap=0x807eb70,
    dmark=0xb7ce2a60 <ruby_xml_state_mark>, dfree=0xb7ce2d40 <ruby_xml_state_free>)
    at gc.c:443
#6  0xb7ce2cba in ruby_xml_state_object ()
   from /usr/lib/ruby/1.8/i486-linux/xml/libxml_so.so
#7  0xb7ce2d27 in ruby_xml_state_marker ()
   from /usr/lib/ruby/1.8/i486-linux/xml/libxml_so.so
#8  0xb7cd6d47 in ruby_xml_document_mark ()
   from /usr/lib/ruby/1.8/i486-linux/xml/libxml_so.so
#9  0xb7f29342 in gc_mark_children (ptr=3083763108, lev=1) at gc.c:988
#10 0xb7f29011 in mark_locations_array (x=0xbfcf7960, n=1584) at gc.c:672
#11 0xb7f2982e in garbage_collect () at gc.c:1408
#12 0xb7f2a2e5 in rb_newobj () at gc.c:424
#13 0xb7f7c877 in str_alloc (klass=3083953160) at string.c:67
#14 0xb7f7c8fc in str_new (klass=0, ptr=0xbfcf70c5 "206700", len=6)at string.c:89
#15 0xb7f7d552 in rb_str_new2 (ptr=0xbfcf70c5 "206700") at string.c:115#16 0xb7f3ebcd in rb_fix2str (x=413401, base=10) at numeric.c:2029
#17 0xb7f41097 in fix_to_s (argc=0, argv=0x0, x=413401) at numeric.c:2060
#18 0xb7f09c90 in call_cfunc (func=0xb7f41040 <fix_to_s>, recv=413401, len=6,
argc=0,
    argv=0x7280) at eval.c:5743
#19 0xb7f14ffc in rb_call0 (klass=3083942520, recv=413401, id=3137,oid=3137,
argc=0,
    argv=0x0, body=0xb7d13a00, flags=0) at eval.c:5899
#20 0xb7f15190 in rb_call (klass=3083942520, recv=413401, mid=3137,argc=0,
argv=0x0,
    scope=1, self=6) at eval.c:6146
#21 0xb7f15f34 in vafuncall (recv=413401, mid=3137, n=0, ar=0xbfcf7464) at
eval.c:6223
#22 0xb7f160a4 in rb_funcall (recv=413401, mid=3137, n=0) at eval.c:6240
#23 0xb7f812da in rb_obj_as_string (obj=413401) at string.c:309
#24 0xb7f111cd in rb_eval (self=3083958620, n=<value optimized out>) at eval.c:3858
#25 0xb7f1134b in rb_eval (self=3083958620, n=<value optimized out>) at eval.c:3878
#26 0xb7f120c6 in rb_eval (self=3083958620, n=<value optimized out>) at eval.c:3502
#27 0xb7f12263 in rb_eval (self=3083958620, n=<value optimized out>) at eval.c:3146
#28 0xb7f21577 in ruby_exec_internal () at eval.c:1642
#29 0xb7f215c2 in ruby_exec () at eval.c:1662
#30 0xb7f215ff in ruby_run () at eval.c:1672
#31 0x080486ed in main (argc=Cannot access memory at address 0x7280
) at main.c:48


では。

-- 
Daigo Moriwaki
beatles at sgtpepper dot net