[BUG: trunk] called on terminated object

e$B!!$5$5$@$G$9!%e(B

e$B!!e(BObjectSpace.each_object e$B$Ge(B inspect
e$B$7$F$^$o$C$F$$$k$H!$e(B"called on
terminated object"
e$B$H8@$o$l$F$7$^$&$N$G$9$,!$$H$/$KLdBj$J$$$s$G$7$?$C$1!)e(B

$ ./ruby -ve ‘ObjectSpace.each_object{|o| o.inspect}’
ruby 1.9.2dev (2009-06-14 trunk 23685) [i686-linux]
-e:1:in inspect': methodinspect’ called on terminated object
(0x9789c14) (NotImplementedError)
from -e:1:in block in <main>' from -e:1:ineach_object’
from -e:1:in `’

e$B!!e(BObjectSpace.each_object e$B$Oe(B klass
e$B$NCM$r%A%’%C%/$7$F$k$h$&$K;W$&$s$G$9e(B
e$B$,!$$J$s$G$3$s$J$3$H$K$J$k$s$@$m$&!%e(B

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:38613] [BUG: trunk] called on terminated
object”
on Mon, 15 Jun 2009 06:18:27 +0900, SASADA Koichi [email protected]
writes:

|e$B!!e(BObjectSpace.each_object e$B$Ge(B inspect e$B$7$F$^$o$C$F$$$k$H!$e(B"called on
|terminated object" e$B$H8@$o$l$F$7$^$&$N$G$9$,!$$H$/$KLdBj$J$$$s$G$7$?$C$1!)e(B

e$BLdBj$J$$$3$H$O$J$$$G$9$M!#e(B

|e$B!!e(BObjectSpace.each_object e$B$Oe(B klass e$B$NCM$r%A%'%C%/$7$F$k$h$&$K;W$&$s$G$9e(B
|e$B$,!$$J$s$G$3$s$J$3$H$K$J$k$s$@$m$&!%e(B

e$BD4$Y$F$_$?$s$G$9$,!"$9$G$K;2>H$5$l$F$$$J$$G[Ns$,@8$-$F$$$J$$e(B
e$B%*%V%8%'%/%H$r;X$7$F$$$k$h$&$G$9!#e(Beach_objecte$B$ND>A0$Ke(BGCe$B$r8Fe(B
e$B$V$HH/@8$7$^$;$s!#e(B

e$B$3$l$KBP$9$k9M$(J}$O$?$V$sFs$D$"$C$Fe(B

  • each_objecte$B$O$=$&$$$&$b$N$G$"$ke(B
  • each_objecte$B$N%k!<%WA0$KFbIt$Ge(BGCe$B$r8F$Ve(B

e$B$N$$$:$l$+$K$J$k$H;W$$$^$9!#5$J,E*$K$O8e<T$+$J$"!#e(B

e$B%A%1%C%He(B #1634 e$B$,99?7$5$l$^$7$?!#e(B (by Yukihiro M.)

e$B%9%F!<%?%9e(B Opene$B$+$ie(BClosede$B$KJQ99e(B
e$B?JD=e(B % 0e$B$+$ie(B100e$B$KJQ99e(B

Applied in changeset r23693.

http://redmine.ruby-lang.org/issues/show/1634

In article [email protected],
Yukihiro M. [email protected] writes:

|e$B!!e(BObjectSpace.each_object e$B$Oe(B klass e$B$NCM$r%A%'%C%/$7$F$k$h$&$K;W$&$s$G$9e(B
|e$B$,!$$J$s$G$3$s$J$3$H$K$J$k$s$@$m$&!%e(B

e$BD4$Y$F$_$?$s$G$9$,!"$9$G$K;2>H$5$l$F$$$J$$G[Ns$,@8$-$F$$$J$$e(B
e$B%*%V%8%'%/%H$r;X$7$F$$$k$h$&$G$9!#e(B

e$B2s<}$5$l$F$$$J$$G[Ns$,2s<}$5$l$?%*%V%8%'%/%H$r;X$7$F$k$s$G$9e(B
e$B$+e(B?

e$B$H$$$&$3$H$O!“e(BGC e$B$O8e<T$r2s<}$7$?$N$KA0<T$r2s<}$7$J$+$C$?$Ce(B
e$B$F$3$H$G!”$=$l$OJQ$8$c$J$$$G$9$+e(B?

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:38625] Re: [BUG: trunk] called on terminated
object”
on Mon, 15 Jun 2009 18:10:51 +0900, Tanaka A. [email protected]
writes:

|e$B2s<}$5$l$F$$$J$$G[Ns$,2s<}$5$l$?%*%V%8%'%/%H$r;X$7$F$k$s$G$9e(B
|e$B$+e(B?

e$B$=$&$G$9!#e(B

|e$B$H$$$&$3$H$O!“e(BGC e$B$O8e<T$r2s<}$7$?$N$KA0<T$r2s<}$7$J$+$C$?$Ce(B
|e$B$F$3$H$G!”$=$l$OJQ$8$c$J$$$G$9$+e(B?

e$BJQ$J$N$O3N$+$G$9!#$,!"$@$l$,%*%V%8%'%/%H$r2u$7$F$$$k$N$+8+IUe(B
e$B$1$i$l$^$;$s$G$7$?!#e(B

In article [email protected],
Yukihiro M. [email protected] writes:

|e$B2s<}$5$l$F$$$J$$G[Ns$,2s<}$5$l$?%*%V%8%'%/%H$r;X$7$F$k$s$G$9e(B
|e$B$+e(B?

e$B$=$&$G$9!#e(B

e$B2s<}$5$l$?$b$N$G$O$J$/!"1#$5$l$F$$$k$b$N$N$h$&$G$9$M!#e(B

e$BJQ$J$N$O3N$+$G$9!#$,!"$@$l$,%*%V%8%'%/%H$r2u$7$F$$$k$N$+8+IUe(B
e$B$1$i$l$^$;$s$G$7$?!#e(B

e$BD4$Y$?$H$3$m!"2u$7$F$$$k$H$$$&$+!"1#$7$F$$$k$H$3$m$Oe(B 20e$BJ,$Ge(B
e$B8+$D$+$j$^$7$?!#e(B

compile.c:4408 e$B$Ne(B

        hide_obj(node->nd_lit);

e$B$H$$$&$N$,e(B klass e$B$re(B 0
e$B$K$7$F$$$^$9$M!#%%V%8%'%/%H$r1#$9$H$-e(B
e$B$O1#$5$l$F$$$J$$%
%V%8%'%/%H$+$i;2>H$7$F$O$$$1$J$$$s$G$9$,!"e(B
e$B$=$l$,$=$&$J$C$F$$$J$$$h$&$G$9!#e(B

e$B$J$*!"%3%D$O!"e(B

  • echo 0 > /proc/sys/kernel/randomize_va_space
  • watchpoint
    e$B$G$7$g$&$+!#e(B

(gdb) c
Continuing.
Hardware watchpoint 4: (*(struct RBasic *) 136308180).klass

Old value = 136379420
New value = 0
iseq_compile_each (iseq=0x82c1888, ret=0xbfffaa98, node=0x81fe5c0,
poped=0) at compile.c:4409
4409 ADD_INSN1(ret, nd_line(node), putstring,
node->nd_lit);
(gdb) bt
#0 iseq_compile_each (iseq=0x82c1888, ret=0xbfffaa98, node=0x81fe5c0,
poped=0) at compile.c:4409
#1 0x081254d1 in when_vals (iseq=0x82c1888, cond_seq=0xbfffaa98,
vals=0x81fe5e8, l1=0x82c388c, special_literals=136292680)
at compile.c:2331
#2 0x08127c1d in iseq_compile_each (iseq=0x82c1888, ret=0xbfffaf98,
node=0x81fe200, poped=1) at compile.c:3052
#3 0x0812774e in iseq_compile_each (iseq=0x82c1888, ret=0xbfffb908,
node=0x81fe1c4, poped=1) at compile.c:2993
#4 0x0812758b in iseq_compile_each (iseq=0x82c1888, ret=0xbfffb908,
node=0x81fe19c, poped=0) at compile.c:2969
#5 0x08127774 in iseq_compile_each (iseq=0x82c1888, ret=0xbfffbbe4,
node=0x81fe098, poped=0) at compile.c:2994
#6 0x0812278e in rb_iseq_compile_node (self=136292760, node=0x81fe070)
at compile.c:458
#7 0x08132dd8 in rb_iseq_new_with_bopt_and_opt (node=0x81fe070,
name=136292780, filename=136330040, parent=0, type=5,
bopt=0, option=0xbfffe5ac) at iseq.c:351
#8 0x08132e24 in rb_iseq_new_with_opt (node=0x81fe070, name=136292780,
filename=136330040, parent=0, type=5,
option=0xbfffe5ac) at iseq.c:362
#9 0x0812301e in new_child_iseq (iseq=0x82be6d8, node=0x81fe070,
name=136292780, parent=0, type=5) at compile.c:919
#10 0x0812e1e7 in iseq_compile_each (iseq=0x82be6d8, ret=0xbfffc664,
node=0x81fe05c, poped=1) at compile.c:4503
#11 0x0812758b in iseq_compile_each (iseq=0x82be6d8, ret=0xbfffc664,
node=0x81fe034, poped=0) at compile.c:2969
#12 0x081226bf in rb_iseq_compile_node (self=136293400, node=0x81fbf00)
at compile.c:452
#13 0x08132dd8 in rb_iseq_new_with_bopt_and_opt (node=0x81fbf00,
name=136293420, filename=136330040, parent=136295900,
type=9, bopt=0, option=0xbfffe5ac) at iseq.c:351
#14 0x08132e24 in rb_iseq_new_with_opt (node=0x81fbf00, name=136293420,
filename=136330040, parent=136295900, type=9,
option=0xbfffe5ac) at iseq.c:362
#15 0x0812301e in new_child_iseq (iseq=0x82b92e0, node=0x81fbf00,
name=136293420, parent=136295900, type=9) at compile.c:919
#16 0x0812eaa0 in iseq_compile_each (iseq=0x82b92e0, ret=0xbfffd0e4,
node=0x81fbeec, poped=1) at compile.c:4591
#17 0x0812758b in iseq_compile_each (iseq=0x82b92e0, ret=0xbfffd0e4,
node=0x81fbec4, poped=0) at compile.c:2969
#18 0x081226bf in rb_iseq_compile_node (self=136295900, node=0x81fbe24)
at compile.c:452
#19 0x08132dd8 in rb_iseq_new_with_bopt_and_opt (node=0x81fbe24,
name=136295920, filename=136330040, parent=136296360,
type=9, bopt=0, option=0xbfffe5ac) at iseq.c:351
#20 0x08132e24 in rb_iseq_new_with_opt (node=0x81fbe24, name=136295920,
filename=136330040, parent=136296360, type=9,
option=0xbfffe5ac) at iseq.c:362
#21 0x0812301e in new_child_iseq (iseq=0x82b85a0, node=0x81fbe24,
name=136295920, parent=136296360, type=9) at compile.c:919
#22 0x0812eaa0 in iseq_compile_each (iseq=0x82b85a0, ret=0xbfffdd58,
node=0x81fbe10, poped=1) at compile.c:4591
#23 0x0812758b in iseq_compile_each (iseq=0x82b85a0, ret=0xbfffdd58,
node=0x81fbdd4, poped=1) at compile.c:2969
#24 0x0812774e in iseq_compile_each (iseq=0x82b85a0, ret=0xbfffe4e4,
node=0x81fb8e8, poped=1) at compile.c:2993
#25 0x0812758b in iseq_compile_each (iseq=0x82b85a0, ret=0xbfffe4e4,
node=0x81fb8ac, poped=0) at compile.c:2969
#26 0x0812280c in rb_iseq_compile_node (self=136296360, node=0x81fb7d0)
at compile.c:463
#27 0x08132dd8 in rb_iseq_new_with_bopt_and_opt (node=0x81fb7d0,
name=136296380, filename=136330040, parent=0, type=3,
bopt=0, option=0xbfffe5ac) at iseq.c:351
#28 0x08132e24 in rb_iseq_new_with_opt (node=0x81fb7d0, name=136296380,
filename=136330040, parent=0, type=3,
option=0xbfffe5ac) at iseq.c:362
#29 0x081336a2 in rb_iseq_compile_with_option (src=136330020,
file=136330040, line=1, opt=4) at iseq.c:502
#30 0x081336d5 in rb_iseq_compile (src=136330020, file=136330040,
line=1) at iseq.c:510