From 3ec44a99954a3c4c131f374020b7addcba9bc5f2 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Mon, 17 Nov 2025 21:53:30 -0500 Subject: [PATCH] Add a Ractor test case that causes MMTk to deadlock This was a test case for Ractors discovered that causes MMTk to deadlock. There is a fix for it in https://github.com/ruby/mmtk/pull/49. --- bootstraptest/test_ractor.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/bootstraptest/test_ractor.rb b/bootstraptest/test_ractor.rb index 834eb627ef..ed80dd0862 100644 --- a/bootstraptest/test_ractor.rb +++ b/bootstraptest/test_ractor.rb @@ -2350,3 +2350,23 @@ assert_equal 'ok', <<~'RUBY' end :ok RUBY + +assert_equal 'ok', <<~'RUBY' + begin + 100.times do |i| + Ractor.new(i) do |j| + 1000.times do |i| + "#{j}-#{i}" + end + Ractor.receive + end + pid = fork { } + _, status = Process.waitpid2 pid + raise unless status.success? + end + + :ok + rescue NotImplementedError + :ok + end +RUBY