[Bug:1.9] Rinda has a race condition

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

e$B8=:_e(B make test-all e$B$Ge(B Rinda
e$B$N%F%9%H$OL58z2=$5$l$F$$$^$9!#e(B

  1. Failure:
    test_message(Rinda::TupleSpaceTest)
    [/home/mame/work/ruby19/ruby/test/rinda/test_rinda.rb:497]:
    YARV doesn’t support Rinda.

e$B!VM-8z2=$9$k$He(B Rinda
e$B$N%F%9%H$G8G$^[email protected]$5$s$KJ9$-$^$7$?!#e(B
e$B$3$NLdBj$Oe(B YARV
e$B$,%^!<%8$5$l$?;~$+$i!"$:$C$HJ|CV$5$l$F$$$^$9!#e(B

e$BD4$Y$F$$$F5$$E$$$?$N$G$9$,!"0J2<$N$h$&$Ke(B Rinda
e$B$KCY1d$rH/@8$5$;$k$He(B

Index: lib/rinda/tuplespace.rb

— lib/rinda/tuplespace.rb (revision 18194)
+++ lib/rinda/tuplespace.rb (working copy)
@@ -570,6 +570,7 @@
keep_clean
sleep(@period)
end

  •    sleep 3
     end
    
    end

e$B0J2<$Ge(B deadlock detected e$B$K$J$j$^$9!#e(B1.8
e$B$G$bF1MM$G$9!#e(B

$ ./ruby -rrinda/tuplespace -e ’
ts = Rinda::TupleSpace.new(1)
ts.take([:foo, :bar], 1) rescue nil
sleep 2
ts.take([:foo, :bar], 1)

/home/mame/work/ruby19/local/lib/ruby/1.9.0/thread.rb:68:in sleep': deadlock detected (fatal) from /home/mame/work/ruby19/local/lib/ruby/1.9.0/thread.rb:68:inwait’
from
/home/mame/work/ruby19/local/lib/ruby/1.9.0/monitor.rb:97:in wait' from /home/mame/work/ruby19/local/lib/ruby/1.9.0/rinda/tuplespace.rb:198:inwait’
from
/home/mame/work/ruby19/local/lib/ruby/1.9.0/rinda/tuplespace.rb:465:in
block in move' from /home/mame/work/ruby19/local/lib/ruby/1.9.0/monitor.rb:190:inmon_synchronize’
from
/home/mame/work/ruby19/local/lib/ruby/1.9.0/rinda/tuplespace.rb:443:in
move' from /home/mame/work/ruby19/local/lib/ruby/1.9.0/rinda/tuplespace.rb:433:intake’
from -e:5:in `’

e$B31$H$$$$$^$9!#e(B

1.8e$B7O$Ne([email protected]$7$?3P$($,$"$k$N$G$9$,!"e(B
[email protected]$a$G$7$g$&$+!)e(B

e$B$I$A$i$K$;$h!"e(B1.8e$B$Ne(Btuplespace.rbe$B$re(B1.9e$B$Xe(B
cie$B$7$h$&$H;W$$$^$9$N$G!“e(B
e$B$h$+$C$?$i$”$H$G$b$&0lEY$?$a$7$F$b$i$($^$9$+!)e(B
#e$B$$$^%S%k%ICf$J$N$G$7$P$i$/BT$C$F$/[email protected]$5$$e(B

On 2008/07/24, at 22:22, Yusuke ENDOH wrote:

@@ -570,6 +570,7 @@
keep_clean
sleep(@period)
end

  •    sleep 3
    end
    
    end

e$B0J2<$Ge(B deadlock detected e$B$K$J$j$^$9!#e(B1.8 e$B$G$bF1e(B
e$BMM$G$9!#e(B

e$B;w$?$h$&$J$H$3$m$GCY1d$5$;$?$s$G$9$,!"$3$s$J46$8$G$9!#e(B

Index: lib/rinda/tuplespace.rb

— lib/rinda/tuplespace.rb (revision 18222)
+++ lib/rinda/tuplespace.rb (working copy)
@@ -622,6 +622,7 @@
break unless need_keeper?
keep_clean
end
+sleep(3)
end
end
end

$ ./ruby -rrinda/tuplespace -e ’
ts = Rinda::TupleSpace.new(1)
ts.take([:foo, :bar], 1) rescue nil
sleep 2
ts.take([:foo, :bar], 1)

/usr/local/lib/ruby/1.8/rinda/tuplespace.rb:503:in move': Rinda::RequestExpiredError (Rinda::RequestExpiredError) from /usr/local/lib/ruby/1.8/monitor.rb:242:insynchronize’
from /usr/local/lib/ruby/1.8/rinda/tuplespace.rb:488:in move' from /usr/local/lib/ruby/1.8/rinda/tuplespace.rb:479:intake’
from -e:5

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

2008/07/26 4:15 Masatoshi SEKI [email protected]:

1.8e$B7O$Ne([email protected]$7$?3P$($,$"$k$N$G$9$,!"e(B
[email protected]$a$G$7$g$&$+!)e(B

e$B$9$_$^$;$s!"e(B1.8.5 e$B$H$+$9$4$/8E$$e(B 1.8 e$B$r8+$F$$$^$7$?!#e(B

e$B$I$A$i$K$;$h!"e(B1.8e$B$Ne(Btuplespace.rbe$B$re(B1.9e$B$Xe(Bcie$B$7$h$&$H;W$$$^$9$N$G!“e(B
e$B$h$+$C$?$i$”$H$G$b$&0lEY$?$a$7$F$b$i$($^$9$+!)e(B
#e$B$$$^%S%k%ICf$J$N$G$7$P$i$/BT$C$F$/[email protected]$5$$e(B

e$B3NG’$7$^$7$?!#e(B
make test-all TESTS=rinda e$B$G$Oe(B 0F0E e$B$G$7$?$,!"e(Bmake test-all
[email protected]$He(B
2 e$B$De(B Failure e$B$,=P$^$7$?!#e(B

  1. Failure:
    test_core_03_notify(Rinda::TupleSpaceProxyTest)
    [/home/mame/work/ruby19/ruby/test/rinda/test_rinda.rb:397]:
    <[0, 3]> expected but was
    <[1, 2]>.

  2. Failure:
    test_has_expires_eh(TestTupleBag)
    [/home/mame/work/ruby19/ruby/test/rinda/test_tuplebag.rb:137]:
    expected but was
    .

e$B$^$?!"$3$Ne(B start_keeper [email protected]$He(B keeper
e$B$,;`$J$J$$$H;W$&$N$G$9$,!"e(B
e$B$=$l$O$A$g$C$H$^$:$/$J$$$G$7$g$&$+!#e(B

$ ./ruby -e ’
at_exit { sleep 5; p Thread.list }
require “test/rinda/test_rinda.rb”

Loaded suite -e
Started

Finished in 1.050015839 seconds.

25 tests, 292 assertions, 0 failures, 0 errors
[#<Thread:0x819f2f0 run>, #<Thread:0x838f1a0 sleep>,
#<Thread:0x8389dcc sleep>, #<Thread:0x83a2db8 sleep>,
#<Thread:0x839d520 sleep>, #<Thread:0x83919a0 sleep>,
#<Thread:0x832dd9c sleep>, #<Thread:0x826e67c sleep>,
#<Thread:0x83888f0 sleep>, #<Thread:0x825ebb4 sleep>,
#<Thread:0x825ccd8 sleep>, #<Thread:0x849d038 sleep>,
#<Thread:0x82f3214 sleep>, #<Thread:0x8311ac0 sleep>,
#<Thread:0x845f328 sleep>, #<Thread:0x84be5bc sleep>,
#<Thread:0x847b938 sleep>, #<Thread:0x84265a0 sleep>,
#<Thread:0x824f7b8 sleep>, #<Thread:0x828cf00 sleep>]

e$B31$H$$$$$^$9!#e(B

On 2008/07/27, at 22:34, Yusuke ENDOH wrote:

e$B$I$A$i$K$;$h!"e(B1.8e$B$Ne(Btuplespace.rbe$B$re(B1.9e$B$Xe(B
cie$B$7$h$&$H;W$$$^$9$N$G!“e(B
e$B$h$+$C$?$i$”$H$G$b$&0lEY$?$a$7$F$b$i$($^$9$+!)e(B
#e$B$$$^%S%k%ICf$J$N$G$7$P$i$/BT$C$F$/[email protected]$5$$e(B

e$B3NG’$7$^$7$?!#e(B
make test-all TESTS=rinda e$B$G$Oe(B 0F0E e$B$G$7$?$,!"e(Bmake test-
all [email protected]$He(B
2 e$B$De(B Failure e$B$,=P$^$7$?!#e(B

failuree$B$O$?$V$s%F%9%H$NLdBj$G$9!#e(B
1.8e$B7O$G$bCY$$%^%7%s$G8=>]$r3NG’$7$^$7$?!#e(B
e$B$J$s$H$+$7$?$$$H;W$$$^$9!#e(B

Loaded suite -e
#<Thread:0x825ccd8 sleep>, #<Thread:0x849d038 sleep>,
#<Thread:0x82f3214 sleep>, #<Thread:0x8311ac0 sleep>,
#<Thread:0x845f328 sleep>, #<Thread:0x84be5bc sleep>,
#<Thread:0x847b938 sleep>, #<Thread:0x84265a0 sleep>,
#<Thread:0x824f7b8 sleep>, #<Thread:0x828cf00 sleep>]

[email protected]$1$I!"$$$^$O$=$&$7$^$7$?!#e(B
e$B<B%"%W%j%1!<%7%g%s$G$Oe(BTupleSpacee$B$r;H$$<N$F$J$$$HA[Dj$7e(B
e$B$?$+$i$G$9!#e(B

keepere$B$r$&$^$/@8@.$G$-$J$+$C$?$N$O;d$N%W%m%0%i%%s%0G=NO$NLde(B
e$BBj$G$9!#e(B
e$B$b$&$A$g$C$H$,$s$P$C$F$
$^$9!#e(B

e$B%?%W%k$4$H$Ke([email protected]@.$7$F$7$^$&$N$,[email protected]$1$I!Ee(B

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

2008/07/29 4:10 Masatoshi SEKI [email protected]:

e$B$^$?!"$3$Ne(B start_keeper [email protected]$He(B keeper e$B$,;`$J$J$$$H;W$&$N$G$9$,!"e(B
e$B$=$l$O$A$g$C$H$^$:$/$J$$$G$7$g$&$+!#e(B
(snip)

[email protected]$1$I!"$$$^$O$=$&$7$^$7$?!#e(B
e$B<B%"%W%j%1!<%7%g%s$G$Oe(BTupleSpacee$B$r;H$$<N$F$J$$$HA[Dj$7$?$+$i$G$9!#e(B

e$B$&!<$s!“L/$K%9%l%C%I$,;D$k$N$OB>$N%F%9%H$X$N1F6A$,$A$g$C$H?4G[$G$9!#e(B
e$B:#$N$H$3$mBg>fIW$_$?$$$G$9$1$I!#$”$H$d$C$Q$j>/$75$;}$A0-$$$G$9!#e(B

e$B$;$a$F!“e(Bkeeper [email protected]<(E*$K=*$o$i$;$ke(B API
e$B$rDs6!$9$k$N$O$I$&$G$7$g$&!#e(B
e$B$b$A$m$se(B keeper
e$B$,$&$^$/4IM}$G$-$l$P!”$=$l$,0lHV$$$$$H;W$$$^$9!#e(B

Index: lib/rinda/tuplespace.rb

— lib/rinda/tuplespace.rb (revision 18257)
+++ lib/rinda/tuplespace.rb (working copy)
@@ -446,6 +446,16 @@
end

 ##
  • Finalize this TupleSpace. After TupleSpace is finalized, it

should not

  • be used.

  • def finalize

  •  if @keeper && @keeper.alive?
    
  •    @keeper.kill
    
  •    @keeper.join
    
  •  end
    
  • end

  • Adds +tuple+

    def write(tuple, sec=nil)
    Index: test/rinda/test_rinda.rb
    ===================================================================
    — test/rinda/test_rinda.rb (revision 18257)
    +++ test/rinda/test_rinda.rb (working copy)
    @@ -518,6 +518,10 @@
    ThreadGroup.new.add(Thread.current)
    @ts = Rinda::TupleSpace.new(1)
    end

  • def teardown

  • @ts.finalize

  • end
    end

class TupleSpaceProxyTest < Test::Unit::TestCase
@@ -529,6 +533,10 @@
@ts = Rinda::TupleSpaceProxy.new(@ts_base)
end

  • def teardown
  • @ts_base.finalize
  • end
  • def test_remote_array_and_hash
    @ts.write(DRbObject.new([1, 2, 3]))
    assert_equal([1, 2, 3], @ts.take([1, 2, 3], 0))

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

e$B%9%F!<%?%9e(B Opene$B$+$ie(BRejectede$B$KJQ99e(B

#376e$B$H=EJ#e(B

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

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