From 9de0e2094ccc0530fd2ba6dc23001b136c6e27be Mon Sep 17 00:00:00 2001 From: Alan Wu Date: Fri, 30 Nov 2018 11:50:59 -0500 Subject: [PATCH] Add a test for Bug #14561 Since it takes 5 seconds to run, I split this into a separate commit that maybe we don't merge into trunk. I also question the value of this as a regression test since the problem needs a specific build configuration and also relies on libpthread's implementation (particularly what it does with the stack of a native thread that has exited). --- test/ruby/test_fiber.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/ruby/test_fiber.rb b/test/ruby/test_fiber.rb index 1729147d5e..84d668c988 100644 --- a/test/ruby/test_fiber.rb +++ b/test/ruby/test_fiber.rb @@ -398,4 +398,14 @@ def test_create_fiber_in_new_thread }.value assert_equal :ok, ret, '[Bug #14642]' end + + def test_machine_stack_gc + assert_normal_exit <<-RUBY, '[Bug #14561]', timeout: 10 + enum = Enumerator.new { |y| y << 1 } + thread = Thread.new { enum.peek } + thread.join + sleep 5 # pause until thread cache wait time runs out. Native thread exits. + GC.start + RUBY + end end -- 2.19.1