aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorsamuel <samuel@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-01 03:49:52 +0000
committersamuel <samuel@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-01 03:49:52 +0000
commit4b99725de99f7dd6d6e6ef79bdc1b46372faafca (patch)
tree14f1f6765b95886e045ecf7c11ab4bfd1fdffc0d /test
parent57005046a13c62896e8d420e99d14535aec6aa67 (diff)
downloadruby-4b99725de99f7dd6d6e6ef79bdc1b46372faafca.tar.gz
Avoid GCing dead stack after switching away from a fiber
Fixes <https://bugs.ruby-lang.org/issues/14561> and discussed <https://bugs.ruby-lang.org/issues/15362>. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_fiber.rb10
1 files changed, 10 insertions, 0 deletions
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