summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cont.c1
-rw-r--r--test/ruby/test_fiber.rb10
2 files changed, 11 insertions, 0 deletions
diff --git a/cont.c b/cont.c
index 142713ad84..da469b6cd5 100644
--- a/cont.c
+++ b/cont.c
@@ -1747,6 +1747,7 @@ fiber_store(rb_fiber_t *next_fib, rb_thread_t *th)
return fib->cont.value;
#else /* FIBER_USE_NATIVE */
+ fib->cont.saved_ec.machine.stack_end = NULL;
if (ruby_setjmp(fib->cont.jmpbuf)) {
/* restored */
fib = th->ec->fiber_ptr;
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 @@ class TestFiber < Test::Unit::TestCase
}.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