summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-23 18:35:23 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-23 18:35:23 +0000
commit90d9413391ea3f7d05b5cf38e6eef676ec68a529 (patch)
tree9a3392274d6be7af051e55a640dcc88e09c48ed0 /test
parentebca3dd3c3fbc903511122078df910362347b5fa (diff)
Commit miss
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39891 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/rinda/test_rinda.rb40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/rinda/test_rinda.rb b/test/rinda/test_rinda.rb
index 45f49a740c..13f5d6d2bb 100644
--- a/test/rinda/test_rinda.rb
+++ b/test/rinda/test_rinda.rb
@@ -477,6 +477,46 @@ class TupleSpaceProxyTest < Test::Unit::TestCase
@ts.take({'head' => 1, 'tail' => 2}, 0))
end
+ def test_take_bug_8215
+ DRb.stop_service
+ service = DRb.start_service(nil, @ts_base)
+
+ uri = service.uri
+
+ take = fork do
+ DRb.stop_service
+ DRb.start_service
+ ro = DRbObject.new_with_uri(uri)
+ ts = Rinda::TupleSpaceProxy.new(ro)
+ th = Thread.new do
+ ts.take([:test_take, nil])
+ end
+ Kernel.sleep(0.1)
+ th.raise(Interrupt) # causes loss of the taken tuple
+ ts.write([:barrier, :continue])
+ Kernel.sleep
+ end
+
+ @ts_base.take([:barrier, :continue])
+
+ write = fork do
+ DRb.stop_service
+ DRb.start_service
+ ro = DRbObject.new_with_uri(uri)
+ ts = Rinda::TupleSpaceProxy.new(ro)
+ ts.write([:test_take, 42])
+ end
+
+ status = Process.wait(write)
+
+ assert_equal([[:test_take, 42]], @ts_base.read_all([:test_take, nil]),
+ '[bug:8215] tuple lost')
+ ensure
+ Process.kill("TERM", write) if write && status.nil?
+ Process.kill("TERM", take) if take
+ service.stop_service
+ end
+
@server = DRb.primary_server || DRb.start_service
end