Stack overflow by GC in a thread

e$B0J2<$N$h$&$K$9$k$He(B SEGV e$B$7$^$9!#e(B

% ./ruby -v -rstringio -e ‘s = “a”
10000.times {
s = “a”.instance_eval { @a = StringIO.new(s); self }
}
Thread.new { GC.start }.join’
ruby 1.9.0 (2007-12-15 patchlevel 0) [i686-linux]
zsh: segmentation fault (core dumped) ./ruby -v -rstringio -e

e$B$I$&$be(B GC e$B$Ne(B mark e$B;~$N:F5"$Ge(B stack overflow
e$B$7$F$$$k$h$&$G$9!#e(B

StringIO e$B$Oe(B T_DATA e$B$J$N$Ge(B lev
e$B$O8z$+$J$/$F!"%9%l%C%I$N%9%?%Ce(B
e$B%/%5%$%:$O8!::$5$l$F$$$J$$$h$&$G!#e(B

e$B$J$*!":G=i$KH/8+$7$?$N$Oe(B StringIO e$B$8$c$J$/$Fe(B ISeq e$B$Ne(B
mark_ary e$B$de(B cref_stack e$B$K$h$k:F5"$G$7$?!#$=$l$N$?$a$Ke(B IA64
e$B$Ge(B test-all e$B$,:G8e$^$G$$$+$J$+$C$?$N$GG$KA}$d$7$?$N$G$9$,!"e(B
e$B$3$l$r$I$&$K$+$9$l$PA}$d$5$J$/$F$b$$$$$N$+$b!#e(B

Program terminated with signal 11, Segmentation fault.
#0 0x080629a5 in gc_mark_children (ptr=3082942460, lev=1) at gc.c:873
873 register RVALUE *obj = RANY(ptr);
(gdb) bt
#0 0x080629a5 in gc_mark_children (ptr=3082942460, lev=1) at gc.c:873
#1 0x08062950 in gc_mark (ptr=3082942460, lev=0) at gc.c:861
#2 0x0806299a in rb_gc_mark (ptr=3082942460) at gc.c:867
#3 0xb7cad47c in strio_mark (ptr=0x8408ec8) at stringio.c:54
#4 0x08062d8c in gc_mark_children (ptr=3082942320, lev=1) at gc.c:1069
#5 0x08062950 in gc_mark (ptr=3082942320, lev=0) at gc.c:861
#6 0x0806274a in mark_entry (key=9449, value=3082942320, lev=0) at
gc.c:770
#7 0x080d1665 in st_foreach (table=0x8408ee0, func=0x8062732
<mark_entry>, arg=0) at st.c:593
#8 0x08062777 in mark_tbl (tbl=0x8408ee0, lev=0) at gc.c:778
#9 0x08062792 in rb_mark_tbl (tbl=0x8408ee0) at gc.c:784
#10 0x080f1be8 in rb_mark_generic_ivar (obj=3082942380) at
variable.c:864
#11 0x08062a27 in gc_mark_children (ptr=3082942380, lev=1) at gc.c:886
#12 0x08062950 in gc_mark (ptr=3082942380, lev=0) at gc.c:861
#13 0x0806299a in rb_gc_mark (ptr=3082942380) at gc.c:867
#14 0xb7cad47c in strio_mark (ptr=0x8408fe8) at stringio.c:54
#15 0x08062d8c in gc_mark_children (ptr=3082942240, lev=1) at gc.c:1069
#16 0x08062950 in gc_mark (ptr=3082942240, lev=0) at gc.c:861
#17 0x0806274a in mark_entry (key=9449, value=3082942240, lev=0) at
gc.c:770
#18 0x080d1665 in st_foreach (table=0x8409000, func=0x8062732
<mark_entry>, arg=0) at st.c:593
#19 0x08062777 in mark_tbl (tbl=0x8409000, lev=0) at gc.c:778
#20 0x08062792 in rb_mark_tbl (tbl=0x8409000) at gc.c:784
#21 0x080f1be8 in rb_mark_generic_ivar (obj=3082942300) at
variable.c:864
#22 0x08062a27 in gc_mark_children (ptr=3082942300, lev=1) at gc.c:886
#23 0x08062950 in gc_mark (ptr=3082942300, lev=0) at gc.c:861
#24 0x0806299a in rb_gc_mark (ptr=3082942300) at gc.c:867
#25 0xb7cad47c in strio_mark (ptr=0x8409108) at stringio.c:54
#26 0x08062d8c in gc_mark_children (ptr=3082942160, lev=1) at gc.c:1069
#27 0x08062950 in gc_mark (ptr=3082942160, lev=0) at gc.c:861
#28 0x0806274a in mark_entry (key=9449, value=3082942160, lev=0) at
gc.c:770
#29 0x080d1665 in st_foreach (table=0x8409120, func=0x8062732
<mark_entry>, arg=0) at st.c:593
#30 0x08062777 in mark_tbl (tbl=0x8409120, lev=0) at gc.c:778
#31 0x08062792 in rb_mark_tbl (tbl=0x8409120) at gc.c:784
#32 0x080f1be8 in rb_mark_generic_ivar (obj=3082942220) at
variable.c:864
#33 0x08062a27 in gc_mark_children (ptr=3082942220, lev=1) at gc.c:886
#34 0x08062950 in gc_mark (ptr=3082942220, lev=0) at gc.c:861
#35 0x0806299a in rb_gc_mark (ptr=3082942220) at gc.c:867
#36 0xb7cad47c in strio_mark (ptr=0x8409228) at stringio.c:54
#37 0x08062d8c in gc_mark_children (ptr=3082942080, lev=1) at gc.c:1069
#38 0x08062950 in gc_mark (ptr=3082942080, lev=0) at gc.c:861
#39 0x0806274a in mark_entry (key=9449, value=3082942080, lev=0) at
gc.c:770

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs