Simultaneous exceptions dump core

e$B1sF#$H?=$7$^$9!#e(B

1.9 e$B$G0J2<$N$h$&$K$9$k$HMn$A$^$9!#e(B

$ ./ruby -ve ’
loop do
begin
Thread.start(Thread.current) {|u| u.raise }
raise
rescue
ensure
end
end

ruby 1.9.0 (2007-08-09 patchlevel 0) [i686-linux]
-e: warning: instance variable #ThrowState not initialized
-e:2: – control frame ----------
c:0003 p:0008 s:0004 b:0005 l:0012ac d:0012ac TOP -e:2
c:0002 p:---- s:0003 b:0003 l:000002 d:000002 FINISH :inherited
c:0001 p:---- s:0001 b:-001 l:000000 d:000000 ------

– backtrace of native function call (Use addr2line) –
0x80dac65
0x80f4033
0x80f40fb
0x80d8ca5
0x80d9564
0x80d989b
0x8059229
0x805d79d
0x8056df2
0xb7dacea8
0x8056d21

[BUG] Stack consistency error (sp: 4, bp: 5)
ruby 1.9.0 (2007-08-09) [i686-linux]

e$B%"%!<%H$7$^$7$?e(B (core dumped)

e$BF1$8%9%l%C%I$K$[$\F1;~$KJ#?t$NNc30$,H/@8$9$k$H$-Mn$A$k$h$&$G$9!#e(B
timeout e$B$r;H$&%3!<%I$re(B Ctrl+C
e$B$G;_$a$k$H$?$^$KH/@8$9$k$N$G5$$,IU$-$^$7$?!#e(B

e$B>/$7DI$C$F$_$^$7$?$,!">u67$,$d$d$3$7$/$F$I$3$+$i$I$3$^$G$,A[Dj30$N5sF0$J$N$+e(B
e$B$o$+$j$^$;$s$G$7$?!#0J2<$N$h$&$J$3$H$,5/$-$F$$$k$h$&$G$9!#e(B

  • 1 e$BH/L$Ne(B raise e$B$Ge(B rb_longjmp e$B$,8F$P$l$ke(B
  • rb_longjmp e$BCf$Ne(B rb_exc_new (eval.c:660 e$B$"$?$je(B)
    e$B$G%3%s%F%-%9%H%9%$%C%A$9$ke(B
  • e$BJL%9%l%C%I$+$ie(B 2 e$BH/L$Ne(B raise e$B$Ge(B rb_longjmp
    e$B$K:FF~$9$ke(B
  • JUMP_TAG(TAG_FATAL); e$B$,<B9T$5$l$ke(B (eval.c:654 e$B$"$?$je(B)
  • rb_ivar_get(err, idThrowState) e$B$,<B9T$5$l$ke(B (insnhelper.ci:1303
    e$B$"$?$je(B)
  • #ThrowState e$B$O=i4|2=$5$l$F$*$i$:!"7Y9p$H$H$b$Ke(B Qnil
    e$B$,JV$ke(B
  • th->state = FIX2INT(Qnil) e$B$,<B9T$5$l$ke(B (insnhelper.ci:1303
    e$B$"$?$je(B)
  • Stack consistency error e$B$K$J$ke(B

[email protected]$G$9!#e(B

Yusuke ENDOH wrote:

  • JUMP_TAG(TAG_FATAL); e$B$,<B9T$5$l$ke(B (eval.c:654 e$B$"$?$je(B)
  • rb_ivar_get(err, idThrowState) e$B$,<B9T$5$l$ke(B (insnhelper.ci:1303 e$B$"$?$je(B)
  • #ThrowState e$B$O=i4|2=$5$l$F$*$i$:!"7Y9p$H$H$b$Ke(B Qnil e$B$,JV$ke(B
  • th->state = FIX2INT(Qnil) e$B$,<B9T$5$l$ke(B (insnhelper.ci:1303 e$B$"$?$je(B)
  • Stack consistency error e$B$K$J$ke(B

e$B!!>:[email protected]$$$F$"$j$,$H$&$4$6$$$^$7$?!#!Ve(BThread#raise
e$B$Ke(B
e$B$h$C$FJ#?t$N%9%l%C%I$+$iNc30$rEj$2$?;~$N5sF0!W$O!“e(B1.8
e$B0JA0$G$O$J$+$Ce(B
e$B$?$b$N$J$s$G$9$h$M!#$^$:!”$3$N;EMM$r$I$&[email protected]$,I,MW$+$H;We(B
e$B$$$^$9!#e(B

e$B!!$$$/$D$+$N0F$r>e$2$F$_$^$9!#e(B

(1) e$B$9$G$KBP>]%9%l%C%I$KNc30$,Ej$2$i$l$F$$$?>l9g!"%V%m%C%/e(B
(2) e$B$9$G$KBP>]%9%l%C%I$KNc30$,Ej$2$i$l$F$$$?>l9g!"%-%e!<%$%s%0e(B
(3) e$B$9$G$KBP>]%9%l%C%I$KNc30$,Ej$2$i$l$F$$$?>l9g!"Nc30e(B

e$B!!e(B(3) e$B$O$"$s$^$j!“e(B(2)
e$B$O!“7k6IEj$2$?Nc30$,[email protected]$,$”$k!”$He(B
e$B$$$&$3$H$G!"e(B1.8 e$B$HF1$85sF0$H$J$ke(B (1)
e$B$,$$$$$N$G$O$J$$$+$H;W$C$F$$$^$9!#e(B

e$B!!0J2<$Oe(B (1)
e$B$N%Q%C%A$G$9!#>e5-%W%m%0%i%`$O!"0l1~LdBj$,$J$/$J$j$^$7e(B
e$B$?!#$7$+$7!"e(BCtrl+C
e$B$NLdBj$O2r7h$7$J$5$=$&$J5$$,$9$ke(B…e$B!#e(B

Index: thread.c

— thread.c (e$B%j%S%8%g%se(B 12920)
+++ thread.c (e$B:n6H%3%T!<e(B)
@@ -758,12 +758,16 @@
{
VALUE exc;

  • again:
    if (rb_thread_dead(th)) {
    return Qnil;
    }

  • if (th->thrown_errinfo != Qnil) {

  • rb_thread_schedule();

  • goto again;

  • }
    exc = rb_make_exception(argc, argv);

  • /* TODO: need synchronization if run threads in parallel */
    th->thrown_errinfo = exc;
    rb_thread_ready(th);
    return Qnil;

[email protected]$G$9!#e(B

At Mon, 13 Aug 2007 11:22:18 +0900,
Yusuke ENDOH wrote in [ruby-dev:31394]:

e$B%=!<%9%3!<%I$,$I$&$$$&A0Ds$G=q$+$l$F$$$k$N$+$h$/$o$+$i$J$$$N$Ge(B
3 e$B$D$[$I$*J9$-$7$?$$$G$9!#e(B

  • rb_longjmp e$B$,e(B JUMP_TAG(TAG_FATAL) e$B$r0z$-5/$3$97o$O!“e(B
    e$B!Ve(Brb_longjmp e$B$O:FF~$7$F$O$$$1$J$$4X?t$J$N$K!”:#2s$O:FF~$,5/$-$F$$$k!W$N$+!“e(B
    e$B!Ve(Brb_longjmp e$B$O:[email protected]$1$I!”:FF~$r$&$^$/07$($F$$$J$$!W$N$+!"e(B
    e$B$I$C$A$G$7$g$&$+!#e(B

e$B!Ve(Brb_longjmp
e$B$O:[email protected]$1$I!":[email protected])8B$7$J$1$l$P$J$i$J$$>u67e(B
e$B$,$"$k!W$G$9!#$G$J$$$He(B[ruby-core:01122]e$B$K$"$k$h$&$JL58B:F5"$r;_e(B
e$B$a$i$l$^$;$s!#e(B

def Execption.new(*) raise; end; raise
  • JUMP_TAG(TAG_FATAL) e$B$,e(B FIX2INT(Qnil) e$B$r0z$-5/$3$97o$O!"e(B
    e$B!Ve(BFATAL e$B$,5/$-$F$$$$$N$O7h$a$i$l$?%?%$%%s%[email protected]$1$J$N$Ke(B
    e$B:#2s$Oe(B FATAL e$B$,5/$-$F$O$$$1$J$$%?%$%
    %s%0$G5/$-$F$$$k!W$N$+!"e(B
    e$B!Ve(BFATAL e$B$O$$$D5/$-$F$b$$$$$1$l$I!"e(BFATAL e$B$r$&$^$/07$($F$$$J$$!W$N$+!"e(B
    e$B$I$C$A$G$7$g$&$+!#e(B

FATALe$B$O$$$D5/$-$k$+$o$+$i$J$$$+$ie(BFATALe$B$J$o$1$G!#e(B

  • e$B:#2s$N7o$O%^%k%A%9%l%C%I2=$K4X$9$k1F6A$G$7$g$&$+!#e(B

e$B1F6A$O$"$k$H;W$$$^$9!#e(B

[email protected][email protected]$&$H!"$I$3$N%P%0$J$s$G$7$g$&$+!#e(B

e$B$J$+$J$+Fq$7$$$G$9$M$’!#e(B

e$B1sF#$G$9!#e(B

e$BJVEz$"$j$,$H$&$4$6$$$^$7$?!#:#8e%=!<%9$rFI$`$H$-$N;29M$K$J$j$^$9!#e(B

e$B!Ve(Brb_longjmp e$B$O:[email protected]$1$I!":[email protected])8B$7$J$1$l$P$J$i$J$$>u67e(B
e$B$,$"$k!W$G$9!#$G$J$$$He(B[ruby-core:01122]e$B$K$"$k$h$&$JL58B:F5"$r;_e(B
e$B$a$i$l$^$;$s!#e(B

def Execption.new(*) raise; end; raise

e$B$J$k$[$I!<!#e(B1.9 e$B$G$bMn$A$^$9$M!#e(B

e$B$3$l$b$I$3$KK<AE*$JLdBj$,$"$k$N$+$h$/$o$+$j$^$;$s$,!"$H$j$"$($:e(B
SysStackError [email protected]@.$9$k$H$-$Oe(B Exception.new
e$B$r8F$Se(B
e$B=P$5$J$$J}$,$$$$$h$&$J5$$,$7$^$9!#$=$l$H$b!V%9%?%C%/$"$U$l$O8!CNe(B
e$B$G$-$J$$$3$H$,$"$k!W$C$F$$$&;EMM$GMn$A$F$k$N$+$J!#e(B

FATALe$B$O$$$D5/$-$k$+$o$+$i$J$$$+$ie(BFATALe$B$J$o$1$G!#e(B

e$B3N$+$K!#$H$$$&$3$H$O!“e(BFIX2INT(Qnil)
e$B$,<B9T$5$l$F$7$^$C$F$$$k$N$Oe(B
(rb_longjmp e$B$d%9%l%C%I$NLdBj$H$OFHN)$7$Fe(B) FATAL
e$B$N%O%s%I%j%s%0$Ke(B
e$BLdBj$,$”$k$H$$$&$3$H$G$9$+$M!#e(B

[email protected]$G$9!#e(B

Yusuke ENDOH wrote:

e$B3N$+$K!#$H$$$&$3$H$O!“e(BFIX2INT(Qnil) e$B$,<B9T$5$l$F$7$^$C$F$$$k$N$Oe(B
(rb_longjmp e$B$d%9%l%C%I$NLdBj$H$OFHN)$7$Fe(B) FATAL e$B$N%O%s%I%j%s%0$Ke(B
e$BLdBj$,$”$k$H$$$&$3$H$G$9$+$M!#e(B

e$B!!$O$$!#$"$j$^$7$?!#e(B[ruby-dev:31407] e$B$HF1$8LdBj$G$7$?!#e(B

e$B1sF#$G$9!#e(B

e$B%=!<%9%3!<%I$,$I$&$$$&A0Ds$G=q$+$l$F$$$k$N$+$h$/$o$+$i$J$$$N$Ge(B
3 e$B$D$[$I$*J9$-$7$?$$$G$9!#e(B

  • rb_longjmp e$B$,e(B JUMP_TAG(TAG_FATAL) e$B$r0z$-5/$3$97o$O!“e(B
    e$B!Ve(Brb_longjmp
    e$B$O:FF~$7$F$O$$$1$J$$4X?t$J$N$K!”:#2s$O:FF~$,5/$-$F$$$k!W$N$+!“e(B
    e$B!Ve(Brb_longjmp
    e$B$O:[email protected]$1$I!”:FF~$r$&$^$/07$($F$$$J$$!W$N$+!"e(B
    e$B$I$C$A$G$7$g$&$+!#e(B

  • JUMP_TAG(TAG_FATAL) e$B$,e(B FIX2INT(Qnil) e$B$r0z$-5/$3$97o$O!"e(B
    e$B!Ve(BFATAL e$B$,5/$-$F$$$$$N$O7h$a$i$l$?%?%$%%s%[email protected]$1$J$N$Ke(B
    e$B:#2s$Oe(B FATAL
    e$B$,5/$-$F$O$$$1$J$$%?%$%
    %s%0$G5/$-$F$$$k!W$N$+!"e(B
    e$B!Ve(BFATAL e$B$O$$$D5/$-$F$b$$$$$1$l$I!"e(BFATAL
    e$B$r$&$^$/07$($F$$$J$$!W$N$+!"e(B
    e$B$I$C$A$G$7$g$&$+!#e(B

  • e$B:#2s$N7o$O%^%k%A%9%l%C%I2=$K4X$9$k1F6A$G$7$g$&$+!#e(B

[email protected][email protected]$&$H!"$I$3$N%P%0$J$s$G$7$g$&$+!#e(B

rb_longjmp e$B$O:FF~IT2De(B +
e$B%^%k%A%9%l%C%I2=$N1F6A$"$j!"[email protected]$H$7$?$i!“e(B
rb_longjmp e$B$r8F$VA42U=j$G:FF~$7$J$$$3$H$r8!F$$9$kI,MW$,e(B
e$B$”$k$N$+$J!<!"$H$+!#e(B

e$B>e5-$NA0Ds$,@5$7$1$l$P$G$9$,!"e(Brb_longjmp
e$BCf$N%3%s%F%-%9%H%9%$%C%A$re(B
e$B6X;_$G$-$k$J$i$=$l$,4JC1$=$&$J5$$O$7$^$9!#B?J,!#e(B

(1) e$B$9$G$KBP>]%9%l%C%I$KNc30$,Ej$2$i$l$F$$$?>l9g!"%V%m%C%/e(B
(2) e$B$9$G$KBP>]%9%l%C%I$KNc30$,Ej$2$i$l$F$$$?>l9g!"%-%e!<%$%s%0e(B
(3) e$B$9$G$KBP>]%9%l%C%I$KNc30$,Ej$2$i$l$F$$$?>l9g!"Nc30e(B

e$B!VEj$2$i$l$F$$$?!W$H$$$&$N$O!"$$$D$+$i$$$D$^$G$N$3$H$G$7$g$&$+!#e(B
e$BEj$2$i$l$?=V4V$+$i!"e(Brescue e$B$+e(B ensure e$B$5$l$?=V4V$^$G!)e(B

(4) e$B$9$G$KBP>]%9%l%C%I$KNc30$,Ej$2$i$l$F$$$?>l9g!"L5;ke(B (false
e$B$G$bJV$9!)e(B)

e$B$H$$$&A*Br;h$b$"$j$G$7$g$&$+!#e(B
raise e$B$GDL?.$7$?$$$H$+9M$($J$1$l$PE,Ev$G$$$$5$$b$7$^$9!#e(B

e$B$7$+$7!"e(BCtrl+C e$B$NLdBj$O2r7h$7$J$5$=$&$J5$$,$9$ke(B…e$B!#e(B

e$B3N$+$K:G=i$N%3!<%I$be(B Ctrl+C e$B$9$k$H$7$P$7$PMn$A$^$9$7!“e(B
e$B0J2<$G$b$7$P$7$PMn$A$^$9e(B (e$BMn$A$J$$$H$-$b$”$j$^$9$,e(B) e$B!#e(B

$ ./ruby -ve ’
Thread.abort_on_exception = true
loop do
begin
Thread.start(Thread.current) { raise }
raise
rescue
ensure
end
end

ruby 1.9.0 (2007-08-13 patchlevel 0) [i686-linux]
– control frame ----------
c:0001 p:---- s:0001 b:-001 l:000000 d:000000 ------

– backtrace of native function call (Use addr2line) –
0x80dac65
0x80f4103
0x80f41cb
0x80b2250
0xffffe420
0x80575f4
0x8057643
0x805771c
0x8059eb2
0x8059f7e
0x805d410
0x80dd8db
0x80ddb53
0x80ddc71
0xb7ef1240
0xb7e2e3de

[BUG] Segmentation fault
ruby 1.9.0 (2007-08-13) [i686-linux]

e$B%"%!<%H$7$^$7$?e(B (core dumped)

[email protected]$G$9!#e(B

Yusuke ENDOH wrote:

  • e$B:#2s$N7o$O%^%k%A%9%l%C%I2=$K4X$9$k1F6A$G$7$g$&$+!#e(B

e$B!!e(B1.8
e$B0JA0$b%^%k%A%9%l%C%I!J%f!<%6%l%Y%k!K$G$9$h!#%M%$%F%#%V%9%l%C%Ie(B
[email protected]$H$9$k$H!“e(BGVLe$B!Je(BGiant VM Locke$B!K$rMxMQ$7$F$$$ke(B YARV
e$B$G$OJBNs$K$OF0e(B
e$B$+$J$$$N$G!”[email protected]$NF14|%_%9$J5$$,$7$^$9!#e(B

(1) e$B$9$G$KBP>]%9%l%C%I$KNc30$,Ej$2$i$l$F$$$?>l9g!"%V%m%C%/e(B
(2) e$B$9$G$KBP>]%9%l%C%I$KNc30$,Ej$2$i$l$F$$$?>l9g!"%-%e!<%$%s%0e(B
(3) e$B$9$G$KBP>]%9%l%C%I$KNc30$,Ej$2$i$l$F$$$?>l9g!"Nc30e(B

e$B!VEj$2$i$l$F$$$?!W$H$$$&$N$O!"$$$D$+$i$$$D$^$G$N$3$H$G$7$g$&$+!#e(B
e$BEj$2$i$l$?=V4V$+$i!"e(Brescue e$B$+e(B ensure e$B$5$l$?=V4V$^$G!)e(B

e$B!!e(Brb_longjmp()
e$B$,=*$o$k$^$G!"$r9M$($F$$$^$7$?!#$J$N$G!"BP>]%9%l%C%Ie(B
e$B$Ne(B raised_flag e$B$r%A%’%C%/$9$k$h$&$K$7$F$$$^$9!#e(B

(4) e$B$9$G$KBP>]%9%l%C%I$KNc30$,Ej$2$i$l$F$$$?>l9g!"L5;ke(B (false e$B$G$bJV$9!)e(B)

e$B$H$$$&A*Br;h$b$"$j$G$7$g$&$+!#e(B
raise e$B$GDL?.$7$?$$$H$+9M$($J$1$l$PE,Ev$G$$$$5$$b$7$^$9!#e(B

e$B!!$&!<$s!"$3$l!"$$$$$N$+$J!#$?$H$($Pe(B timeout.rb
e$B$r9M$($F$_$k$H!"$^$5e(B
e$B$KDL?.$7$?$$!"$H$$$&$3$H$J$N$G$^$:$$$h$&$J5$$,$7$^$9!#e(B

    raise
rescue
ensure
end

end

e$B!!4JC1$K:F8=$G$-$^$7$?!#$I$&$b$"$j$,$H$&$4$6$$$^$9!#e(B

e$B!!%9%l%C%I$N=*N;=hM}$,4E$$$N$+$J$"!#e(B

[email protected]$G$9!#e(B

Yusuke ENDOH wrote:

e$B$7$+$7!"e(BCtrl+C e$B$NLdBj$O2r7h$7$J$5$=$&$J5$$,$9$ke(B…e$B!#e(B

e$B3N$+$K:G=i$N%3!<%I$be(B Ctrl+C e$B$9$k$H$7$P$7$PMn$A$^$9$7!“e(B
e$B0J2<$G$b$7$P$7$PMn$A$^$9e(B (e$BMn$A$J$$$H$-$b$”$j$^$9$,e(B) e$B!#e(B

e$B!!Mn$A$J$$$h$&[email protected]$7$?$D$b$j$G$9!#3NG’$7$F$b$i$($J$$$G$7$ge(B
e$B$&$+!#e(B

[email protected]$G$9!#e(B

Yusuke ENDOH wrote:

[email protected]$r$A$c$s$H8+$F$J$$$N$G$9$,!"MW$9$k$KKh2se(B GET_THREAD() e$B$7$F$?$N$,e(B

[email protected]$C$?$H$$$&$3$H$G$7$g$&$+!#e(B

e$B!!=*N;;~$N=hM}$,$$$m$$$m$H4E$+$C$?$+$i$N$h$&$G$9!#e(B


e$B!!$&[email protected]$He(B SEGV
e$B$7$J$+$C$?$s$G$9$,!"%9%l%C%I:n$j2a$.$FJQ$J$3$H$,$*$-e(B
e$B$F$k$s$G$7$g$&$M$’!#$I$&%G%P%C%0$7$?$b$N$+!#e(B

e$B$^$?!"$3$l$b4XO"$9$k$N$+$I$&$+$b$o$+$j$^$;$s$,!“0J2<$N5sF0$O;EMM$G$7$g$&$+!#e(B
e$BMn$A$k$^$Ge(B 10 e$BIC$/$i$$$+$+$j!”:[email protected]$b$"$^$j$J$$$G$9e(B (e$B?t2s$Ke(B 1 e$B2s$/$i$$!)e(B) e$B!#e(B

$ ./ruby -ve ’
loop do
begin
Thread.start(Thread.current) {|t| t.raise }
rescue Exception
end
end’

e$B!!%M%$%F%#%V%9%l%C%I$,:n$l$J$$e(B ==
e$B%a%b%j$,==J,$K$J$$!"$H$$$&$3$H$J$Ne(B
e$B$G!"$I$C$A$,Aa$$$+!"$H$$$&$3$H$G$O$J$$$+$H;W$$$^$7$?!#e(B

e$B1sF#$G$9!#e(B

e$B!!Mn$A$J$$$h$&[email protected]$7$?$D$b$j$G$9!#3NG’$7$F$b$i$($J$$$G$7$ge(B
e$B$&$+!#e(B

e$B$A$g$C$H$$$8$C$?$/$i$$$G$OMn$A$J$/$J$j$^$7$?!#e(B
e$B$"$j$,$H$&$4$6$$$^$9!#e(B

[email protected]$r$A$c$s$H8+$F$J$$$N$G$9$,!"MW$9$k$KKh2se(B GET_THREAD()

e$B$7$F$?$N$,e(B

[email protected]$C$?$H$$$&$3$H$G$7$g$&$+!#e(B

[email protected]!";n$7$F$$$k$&$A$KJL$N2x$7$$5sF0$r8+$D$1$^$7$?!#e(B
e$B4X78$9$k$N$+$o$+$j$^$;$s$,!"$D$$$G$KJs9p$7$^$9!#0J2<$GMn$A$^$9!#e(B

$ ./ruby -ve ’
loop do
begin
Thread.start { sleep 100 }
rescue Exception
end
end

ruby 1.9.0 (2007-08-19 patchlevel 0) [i686-linux]
-e:1: – control frame ----------
c:0007 p:---- s:0014 b:0014 l:000013 d:000013 CFUNC :start
c:0006 p:0013 s:0011 b:0011 l:001fc4 d:000010 BLOCK -e:1
c:0005 p:---- s:0010 b:0010 l:000009 d:000009 FINISH
c:0004 p:---- s:0008 b:0008 l:000007 d:000007 CFUNC :loop
c:0003 p:0007 s:0005 b:0005 l:001fc4 d:001fc4 TOP -e:1
c:0002 p:---- s:0003 b:0003 l:000002 d:000002 FINISH :inherited
c:0001 p:---- s:0001 b:-001 l:000000 d:000000 ------

DBG> : “-e:1:in block in <main>'" DBG> : "-e:1:inloop’”
DBG> : “-e:1:in `’”
– backtrace of native function call (Use addr2line) –
0x80dac65
0x80f4223
0x80f42eb
0x80b2160
0xffffe420
0x8062607
0x8062b7c
0x80cfeac
0x80cffb4
0x80d003b
0x80dcbb5
0x80d3104
0x80d5de3
0x80d9534
0x80d26f5
0x80596c9
0x80d3104
0x80d5de3
0x80d9534
0x80d986b
0x80592a9
0x805c8ad
0x8056ee2
0xb7dd7ea8
0x8056e11

[BUG] Segmentation fault
ruby 1.9.0 (2007-08-19) [i686-linux]

e$B%"%!<%H$7$^$7$?e(B (core dumped)

e$B$^$?!"$3$l$b4XO"$9$k$N$+$I$&$+$b$o$+$j$^$;$s$,!“0J2<$N5sF0$O;EMM$G$7$g$&$+!#e(B
e$BMn$A$k$^$Ge(B 10 e$BIC$/$i$$$+$+$j!”:[email protected]$b$"$^$j$J$$$G$9e(B
(e$B?t2s$Ke(B 1 e$B2s$/$i$$!)e(B) e$B!#e(B

$ ./ruby -ve ’
loop do
begin
Thread.start(Thread.current) {|t| t.raise }
rescue Exception
end
end’
ruby 1.9.0 (2007-08-19 patchlevel 0) [i686-linux]
-e:1: – control frame ----------
c:0007 p:---- s:0015 b:0015 l:000014 d:000014 CFUNC :start
c:0006 p:0026 s:0011 b:0011 l:001244 d:000010 BLOCK -e:1
c:0005 p:---- s:0010 b:0010 l:000009 d:000009 FINISH
c:0004 p:---- s:0008 b:0008 l:000007 d:000007 CFUNC :loop
c:0003 p:0007 s:0005 b:0005 l:001244 d:001244 TOP -e:1
c:0002 p:---- s:0003 b:0003 l:000002 d:000002 FINISH :inherited
c:0001 p:---- s:0001 b:-001 l:000000 d:000000 ------

[FATAL] failed to allocate memory

e$BC1$K%9%l%C%I$r:[email protected]$1$J$iIaDL$KNc30$K$J$k$N$G5$$K$J$j$^$7$?!#e(B

$ ./ruby -ve ‘loop { Thread.start { sleep 100 } }’
ruby 1.9.0 (2007-08-19 patchlevel 0) [i686-linux]
-e:1:in start': can't create Thread (12) (ThreadError) from -e:1:inblock in ’
from -e:1:in loop' from -e:1:in

[email protected]$G$9!#e(B

At Mon, 20 Aug 2007 22:16:57 +0900,
Yusuke ENDOH wrote in [ruby-dev:31533]:

VALUE self = thread_alloc(klass);
e$B$re(B VALUE volatile self = … e$B$K$7$F$_$^$7$?$,!">I>u$O$+$o$j$^$;$s$G$7$?!#e(B

e$BKvHx8F=P$N:GE,2=$Ge(Bselfe$B<+BN$,>C$($F$7$^$C$F$$$k$N$+$b$7$l$^$;$s!#e(B
e$B$3$l$G$I$&$G$7$g$&$+!#e(B

Index: vm.c

— vm.c (revision 13116)
+++ vm.c (working copy)
@@ -1611,8 +1611,9 @@ thread_alloc(VALUE klass)

static void
-th_init2(rb_thread_t *th)
+th_init2(rb_thread_t *th, VALUE self)
{
MEMZERO(th, rb_thread_t, 1);

  • th->self = self;
    /* allocate thread stack */
    th->stack_size = RUBY_VM_THREAD_STACK_SIZE;
    @@ -1643,7 +1644,7 @@ th_init2(rb_thread_t *th)

static void
-th_init(rb_thread_t *th)
+th_init(rb_thread_t *th, VALUE self)
{

  • th_init2(th);
  • th_init2(th, self);
    }

@@ -1655,6 +1656,5 @@ ruby_thread_init(VALUE self)
GetThreadPtr(self, th);

  • th_init(th);
  • th->self = self;
  • th_init(th, self);
    th->vm = vm;

@@ -1804,5 +1804,5 @@ Init_BareVM(void)
ruby_current_vm = vm;

  • th_init2(th);
  • th_init2(th, 0);
    th->vm = vm;
    th->machine_stack_start = rb_gc_stack_start;

e$B1sF#$G$9!#e(B

e$BKvHx8F=P$N:GE,2=$Ge(Bselfe$B<+BN$,>C$($F$7$^$C$F$$$k$N$+$b$7$l$^$;$s!#e(B
e$B$3$l$G$I$&$G$7$g$&$+!#e(B

e$B;DG0$J$,$i>I>u$O$+$o$j$^$;$s$G$7$?!#e(B

./configure CFLAGS=-fno-optimize-sibling-calls
e$B$G%S%k%I$7$F$b>I>u$O$+$o$i$J$$$N$G!"JL$N860x$J$N$+$b$7$l$^$;$s!#e(B

[email protected](B -fno-optimize-sibling-calls e$B$r$D$1$k$H!"0JA0$O<B9T8ee(B

1 e$BIC$/$i$$$Ge(B

100% e$BMn$A$F$$$?$N$,!"e(B50%

e$B$/$i$$$N3NN($GIaDL$K<B9T$7B3$1$k$h$&$K$J$C$?e(B

e$B5$$,$7$^$9!#$h$/$o$+$j$^$;$s!#e(B

e$B;d$N4D6-0J30$G$OC/$b:F8=$G$-$F$$$J$$$N$G$7$g$&$+!#e(B
e$B<B$O$&$A$N4D6-$K2?$+LdBj$,$"$k$H$+!#e(B

$ uname -a
Linux pole 2.6.17-co-0.8.0 #1 PREEMPT Sun Jul 8 14:00:12 CEST 2007
i686 GNU/Linux
$ cat /etc/debian_version
4.0
$ gcc --version
gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)

e$B1sF#$G$9!#e(B

e$B$F$k$s$G$7$g$&$M$’!#$I$&%G%P%C%0$7$?$b$N$+!#e(B
e$B$A$J$$K$&$A$N<B834D6-$Oe(B Debian/etch on coLinux (x86) e$B$G$9!#e(B
e$B>/[email protected]$1DI$C$F$
$^$7$?!#e(B

#0 0xffffe402 in __kernel_vsyscall ()
#1 0xb7dec811 in raise () from /lib/tls/i686/cmov/libc.so.6
#2 0xb7dedfb9 in abort () from /lib/tls/i686/cmov/libc.so.6
#3 0x080f42f0 in rb_bug (fmt=0x812376d “Segmentation fault”) at
error.c:228
#4 0x080b2160 in sigsegv (sig=11) at signal.c:535
#5
#6 0x080d077d in thread_free (ptr=0x83d9530) at vm.c:1538
#7 0x08062607 in garbage_collect () at gc.c:1288
#8 0x08062b7c in ruby_xmalloc (size=524288) at gc.c:256
#9 0x080cfeac in th_init2 (th=0x83d9a00) at vm.c:1620
#10 0x080cffb4 in ruby_thread_init (self=3069950400) at vm.c:1648
#11 0x080d003b in rb_thread_alloc (klass=3084005240) at vm.c:1671
#12 0x080dcbb5 in thread_create_core (klass=0, args=138253616, fn=0x12,
arg=0x0) at thread.c:374

e$B$H$$$&%P%C%/%H%l!<%9e(B (e$B$He(B printf e$B%G%P%C%0$N7k2Le(B)
e$B$+$i8+$F!"0J2<$N$h$&$Je(B
e$B46$8$KMn$A$k$_$?$$$G$9!#e(B

  1. #10 ruby_thread_init e$BCf$Ge(B #9 th_init2 e$B$,8F$P$l$ke(B (th->vm
    e$BL$=i4|2=e(B)
  2. #9 th_init2 e$BCf$Ne(B ALLOC_N e$B$Ge(B GC e$B$,5/$-$ke(B
  3. e$B$J$<$+e(B ruby_thread_init
    e$B$G=i4|2=$7$h$&$H$7$F$$$k%9%l%C%I$,e(B free e$B$5$l$ke(B
  4. #6 thread_free e$BCf$Ne(B th->vm->main_thread e$B$N;2>H$GMn$A$ke(B

e$B$A$c$s$HDI$($F$J$$$N$G$9$,!">e5-$N$I$3$+$G%3%s%F%-%9%H%9%$%C%A$be(B

e$B:.$6$C$F$k$h$&$J5$$,$7$^$9!#e(B

e$B;n$7$Ke(B #11 rb_thread_alloc e$B$Ne(B
VALUE self = thread_alloc(klass);
e$B$re(B VALUE volatile self = …
e$B$K$7$F$_$^$7$?$,!">I>u$O$+$o$j$^$;$s$G$7$?!#e(B

e$B0J>e$N>pJs$G2?$+$o$+$j$^$9$G$7$g$&$+!#e(B

e$B!!%M%$%F%#%V%9%l%C%I$,:n$l$J$$e(B == e$B%a%b%j$,==J,$K$J$$!"$H$$$&$3$H$J$Ne(B
e$B$G!"$I$C$A$,Aa$$$+!"$H$$$&$3$H$G$O$J$$$+$H;W$$$^$7$?!#e(B

e$B$"$"!"?2$$1$F$^$7$?!#$A$c$s$He(B ThreadError e$B$de(B NoMemoryError
e$B$OEj$2$i$l$Fe(B
rescue Exception [email protected]$1$G$9$M!#e(B

$ ./ruby -ve ’
loop do
begin
Thread.start(Thread.current) {|t| t.raise }
rescue Exception
p $! unless $!.is_a? RuntimeError
end
end

ruby 1.9.0 (2007-08-19 patchlevel 0) [i686-linux]
#<ThreadError: can’t create Thread (12)>
#<NoMemoryError: failed to allocate memory>
[FATAL] failed to allocate memory

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