[Bug:trunk] race condition of /#{ foo }/o

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

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

$ cat race.rb
f = proc {|s| /#{ sleep 1; s }/o }
[ Thread.new { f.call(“foo”); nil },
Thread.new { sleep 0.5; f.call(“bar”); nil },
].each {|t| t.join }
GC.start
p f.call

$ ./ruby race.rb
race.rb:6: [BUG] Segmentation fault
ruby 1.9.2dev (2009-11-24 trunk 25908) [i686-linux]

– control frame ----------
c:0004 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC :stuck_out_tongue:
c:0003 p:0083 s:0007 b:0007 l:001d8c d:0022e8 EVAL race.rb:6
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:001d8c d:001d8c TOP

race.rb:6:in <main>' race.rb:6:inp’

e$B%;%0%a%s%F!<%7%g%s0cH?$G$9e(B

onceinlinecache e$B$rDL$C$F$+$ie(B setinlinecache e$B$KCe$/A0$^$G$N4Ve(B
(= /#{ sleep 1; s }/o e$B$NI>2A$,;O$^$C$F$+$i=*$o$k$^$G$N4Ve(B) e$B$Ke(B
e$BJ#?t$N%9%l%C%I$,FMF~$9$k$H!"%$%s%i%$%s%-%c%C%7%e$N%"%/%;%9$,e(B
race condition e$B$K$J$C$F$$$FE,@Z$K%^!<%/$5$l$J$/$J$k$h$&$G$9!#e(B

e$B2r7hJ}K!$H$7$F$O!“Ev3:HO0O$,%/%j%F%#%+%k%;%/%7%g%s$K$J$k$h$&e(B
e$BF14|$r9T$&$+!”$^$?$O2?$+$r$9$kI,MW$,$"$k$H;W$$$^$9!#e(B

once e$B%U%i%0$N$"[email protected],I=8=$rJ#?t%9%l%C%I$GF1;~$KI>2A$7$?>l9g$Ne(B
e$B0UL#$O$I$&$J$k$G$7$g$&$+!#e(B

e$B%A%1%C%He(B #2398 e$B$,99?7$5$l$^$7$?!#e(B (by Yusuke E.)

e$BC4Ev<Te(B Nobuyoshi N.e$B$+$ie(BYusuke E.e$B$KJQ99e(B
Target version 1.9.2e$B$K%;%C%He(B
ruby -v -e$B$K%;%C%He(B

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

e$B$H$j$"$($:!":G=i$Ke(B once e$B6h4V$KFMF~$7$?e(B (onceinlinecache
e$B$r<B9T$7$?e(B)
e$B%9%l%C%I$,e(B once e$B6h4V$rC&=P$9$ke(B (setinlinecache
e$B$r<B9T$9$ke(B) e$B$^$G!"e(B
2 e$BHVL\0J9_$KF1$86h4V$KFMF~$9$k%9%l%C%I$r%V%m%C%/$9$k%Q%C%A$r=q$-$^e(B
e$B$7$?!#e(B

e$B:G=i$N%9%l%C%I$,@5>o$K=P8}$KE~C#$7$J$+$C$?>l9g!"e(B2
e$BHVL\0J9_$KFMF~$7$?e(B
e$B%9%l%C%I$?$A$O1J5W$K%V%m%C%/$7$F$7$^$$$^$9$,!“e(BSEGV
e$B$h$j$^$7$G$9$7!“e(B
Ctrl+C e$B$G;_$a$k$3$H$b$G$-$k$N$G!”$$$$$+$J$H;W$$$^$9!#e(B
e$B$=$b$=$b$=$&$$$&>u67$K$J$k$h$&$J%W%m%0%i%`$KLdBj$,$”[email protected]$($k$+$be(B
e$B$7$l$^$;$s!#e(B

e$B$9$0$K%3%_%C%H$7$F$7$^$$$^$9$,!“H?BP$,$”[email protected]$C$F$/[email protected]$5$$!#e(B

diff --git a/insns.def b/insns.def
index 9541465…ba6f1d6 100644
— a/insns.def
+++ b/insns.def
@@ -1199,10 +1199,17 @@ onceinlinecache
()
(VALUE val)
{

  • retry:
    if (ic->ic_vmstat) {
    val = ic->ic_value.value;
    JUMP(dst);
    }
  • else if (ic->ic_value.value == Qundef)
  • {
  •  RUBY_VM_CHECK_INTS();
    
  •  rb_thread_schedule();
    
  • goto retry;
  • }
    else {
    /* none */
    ic->ic_value.value = Qundef;


Yusuke E. [email protected]

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

e$B%A%1%C%He(B #2398 e$B$,99?7$5$l$^$7$?!#e(B (by Yusuke E.)

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

This issue was solved with changeset r27515.
Yusuke, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


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

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