summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKazuhiro NISHIYAMA <zn@mbf.nifty.com>2019-12-10 12:41:09 +0900
committerKazuhiro NISHIYAMA <zn@mbf.nifty.com>2019-12-10 12:43:49 +0900
commit7be550d046c726c2a3aa625ceb260d9b2268fb5a (patch)
treeb5c9bb72c5c6ca25cb878a8f87783427187f9154
parent129c3216d966fc25209a7e50418413ffecd25281 (diff)
Stop Thread.new in `DRb::TimerIdConv::TimerHolder2#on_gc`
and add more stop_pool after stop_service
-rw-r--r--lib/drb/drb.rb1
-rw-r--r--test/drb/drbtest.rb1
-rw-r--r--test/drb/test_drb.rb2
-rw-r--r--test/drb/test_drbobject.rb15
4 files changed, 18 insertions, 1 deletions
diff --git a/lib/drb/drb.rb b/lib/drb/drb.rb
index 4c0f396d444..e2aaf701ce4 100644
--- a/lib/drb/drb.rb
+++ b/lib/drb/drb.rb
@@ -1215,6 +1215,7 @@ module DRb
def kill
@thread.kill
+ @thread.join
end
def method_missing(msg, *arg, &blk)
diff --git a/test/drb/drbtest.rb b/test/drb/drbtest.rb
index e292cbfb0d5..a8363b0c430 100644
--- a/test/drb/drbtest.rb
+++ b/test/drb/drbtest.rb
@@ -42,6 +42,7 @@ class DRbService
server.stop_service
manager.instance_variable_get(:@queue)&.push(nil)
manager.instance_variable_get(:@thread)&.join
+ DRb::DRbConn.stop_pool
end
end
diff --git a/test/drb/test_drb.rb b/test/drb/test_drb.rb
index 9242a22543a..b792349f28f 100644
--- a/test/drb/test_drb.rb
+++ b/test/drb/test_drb.rb
@@ -329,6 +329,7 @@ class TestDRbAnyToS < Test::Unit::TestCase
assert_match(/\A#<DRbTests::TestDRbAnyToS::BO:0x[0-9a-f]+>\z/, server.any_to_s(BO.new))
server.stop_service
server.thread.join
+ DRb::DRbConn.stop_pool
end
end
@@ -344,6 +345,7 @@ class TestDRbTCP < Test::Unit::TestCase
client.close
server.stop_service
server.thread.join
+ DRb::DRbConn.stop_pool
end
end
diff --git a/test/drb/test_drbobject.rb b/test/drb/test_drbobject.rb
index 16b252d3cee..2b0e2061ee4 100644
--- a/test/drb/test_drbobject.rb
+++ b/test/drb/test_drbobject.rb
@@ -12,6 +12,7 @@ module DRbObjectTest
def teardown
DRb.stop_service
+ DRb::DRbConn.stop_pool
end
def drb_eq(obj)
@@ -43,7 +44,19 @@ class TestDRbObjectTimerIdConv < Test::Unit::TestCase
include DRbObjectTest
def setup
- DRb.start_service(nil, nil, {:idconv => DRb::TimerIdConv.new})
+ @idconv = DRb::TimerIdConv.new
+ DRb.start_service(nil, nil, {:idconv => @idconv})
+ end
+
+ def teardown
+ super
+ # stop DRb::TimerIdConv::TimerHolder2#on_gc
+ @idconv.instance_eval do
+ @holder.instance_eval do
+ @expires = nil
+ end
+ end
+ GC.start
end
end