Repeat of DRb.start_service and DRb.stop_service may result in EADDRINUSE

e$B31$5$se(B
e$B1sF#$G$9!#e(B

1.9 e$B$G!"e(BDRb.start_service e$B$He(B stop_service
e$B$r7+$jJV$9$H!“e(BEADDRINUSE e$B$,e(B
e$BH/@8$9$k$3$H$,$”$j$^$9!#e(B

$ ./ruby -Ilib -rdrb -e ’
loop do
p :start
DRb.start_service(“druby://localhost:9090”, 1)
DRb.stop_service
end

:start
:start
:start
/home/mame/work/ruby19/ruby/lib/drb/drb.rb:861:in initialize': Address already in use - bind(2) (Errno::EADDRINUSE) from /home/mame/work/ruby19/ruby/lib/drb/drb.rb:861:inopen’
from /home/mame/work/ruby19/ruby/lib/drb/drb.rb:861:in
open_server' from /home/mame/work/ruby19/ruby/lib/drb/drb.rb:759:inblock in open_server’
from /home/mame/work/ruby19/ruby/lib/drb/drb.rb:757:in each' from /home/mame/work/ruby19/ruby/lib/drb/drb.rb:757:inopen_server’
from /home/mame/work/ruby19/ruby/lib/drb/drb.rb:1342:in
initialize' from /home/mame/work/ruby19/ruby/lib/drb/drb.rb:1630:innew’
from /home/mame/work/ruby19/ruby/lib/drb/drb.rb:1630:in
start_service' from -e:4:inblock in ’
from -e:2:in loop' from -e:2:in

Thread#kill e$B$G%5!<%S%9$rDd;$7$F$$$k$h$&$G$9$,!"e(Bkill e$B$7$?8ee(B
join e$B$7$J$$e(B
e$B$H3N<B$K;`$s$@$+$I$&$+$o$+$i$J$$$H;W$$$^$9!#e(B1.8
e$B$G$O%?%$%
%s%0$,$?$^$?$^e(B
e$BLdBj$K$J$C$F$$$J$$$@$1$J5$$,$7$^$9!#e(B

rubyspec
e$B$,$?$^$K<:GT$7$F]5F+$7$$$N$G!"$b$7$h$1$l$PD>$7$?$$$G$9!#0J2<$Ne(B
e$B%Q%C%A$GD>$j$^$9!#e(B

diff --git a/lib/drb/drb.rb b/lib/drb/drb.rb
index a2c11f9…4712306 100644
— a/lib/drb/drb.rb
+++ b/lib/drb/drb.rb
@@ -1394,7 +1394,7 @@ module DRb
if Thread.current[‘DRb’] && Thread.current[‘DRb’][‘server’] ==
self
Thread.current[‘DRb’][‘stop_service’] = true
else

  •    @thread.kill
    
  •    @thread.kill.join
     end
    
    end

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

On 2010/02/17, at 22:15, Yusuke ENDOH wrote:

+++ b/lib/drb/drb.rb
@@ -1394,7 +1394,7 @@ module DRb
if Thread.current[‘DRb’] && Thread.current[‘DRb’][‘server’] == self
Thread.current[‘DRb’][‘stop_service’] = true
else

  •    @thread.kill
    
  •    @thread.kill.join
    end
    
    end

Thread#kille$B$O=*N;$rBT$D$o$1$8$c$J$$$N$+!<!#e(B

e$B$"$j$,$H$&$4$6$$$^$9!#e(B
e$B:#F|L@F|$O:n6H$G$-$=$&$K$J$$$N$G!"1sF#$5$se(Bcommite$B$r$*4j$$$G$-$^$9$+!)e(B

e$B40A4$J=*N;!"$H$$$&$N$,$I$NDxEY$G$-$F$k$N$+$"$d$7$$$h$&$J5$$,$9$ke(B
e$B$N$G$9$,!"$=$l$O7o$Ne(BRubySpece$B$G$OLdBj$J$$$G$7$g$&!#e(B

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

2010e$BG/e(B2e$B7ne(B18e$BF|e(B7:41 Masatoshi SEKI
[email protected]:

On 2010/02/17, at 22:15, Yusuke ENDOH wrote:

Thread#kill e$B$G%5!<%S%9$rDd;$7$F$$$k$h$&$G$9$,!"e(Bkill e$B$7$?8ee(B join e$B$7$J$$e(B
e$B$H3N<B$K;`$s$@$+$I$&$+$o$+$i$J$$$H;W$$$^$9!#e(B1.8 e$B$G$O%?%$%
%s%0$,$?$^$?$^e(B
e$BLdBj$K$J$C$F$$$J$$$@$1$J5$$,$7$^$9!#e(B

rubyspec e$B$,$?$^$K<:GT$7$F]5F+$7$$$N$G!"$b$7$h$1$l$PD>$7$?$$$G$9!#0J2<$Ne(B
e$B%Q%C%A$GD>$j$^$9!#e(B

snip

Thread#kille$B$O=*N;$rBT$D$o$1$8$c$J$$$N$+!<!#e(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