ruby-changes:54562
From: nagachika <ko1@a...>
Date: Thu, 10 Jan 2019 23:18:18 +0900 (JST)
Subject: [ruby-changes:54562] nagachika:r66777 (ruby_2_5): merge revision(s) 66111: [Backport #14561]
nagachika 2019-01-10 23:18:09 +0900 (Thu, 10 Jan 2019) New Revision: 66777 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=66777 Log: merge revision(s) 66111: [Backport #14561] 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>. Modified directories: branches/ruby_2_5/ Modified files: branches/ruby_2_5/cont.c branches/ruby_2_5/test/ruby/test_fiber.rb branches/ruby_2_5/version.h Index: ruby_2_5/version.h =================================================================== --- ruby_2_5/version.h (revision 66776) +++ ruby_2_5/version.h (revision 66777) @@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_5/version.h#L1 #define RUBY_VERSION "2.5.4" -#define RUBY_RELEASE_DATE "2019-01-07" -#define RUBY_PATCHLEVEL 125 +#define RUBY_RELEASE_DATE "2019-01-10" +#define RUBY_PATCHLEVEL 126 #define RUBY_RELEASE_YEAR 2019 #define RUBY_RELEASE_MONTH 1 -#define RUBY_RELEASE_DAY 7 +#define RUBY_RELEASE_DAY 10 #include "ruby/version.h" Index: ruby_2_5/test/ruby/test_fiber.rb =================================================================== --- ruby_2_5/test/ruby/test_fiber.rb (revision 66776) +++ ruby_2_5/test/ruby/test_fiber.rb (revision 66777) @@ -378,4 +378,14 @@ class TestFiber < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/ruby/test_fiber.rb#L378 assert_match(/terminated/, f.to_s) assert_match(/resumed/, Fiber.current.to_s) 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 Index: ruby_2_5/cont.c =================================================================== --- ruby_2_5/cont.c (revision 66776) +++ ruby_2_5/cont.c (revision 66777) @@ -1616,6 +1616,7 @@ fiber_store(rb_fiber_t *next_fib, rb_thr https://github.com/ruby/ruby/blob/trunk/ruby_2_5/cont.c#L1616 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; Index: ruby_2_5 =================================================================== --- ruby_2_5 (revision 66776) +++ ruby_2_5 (revision 66777) Property changes on: ruby_2_5 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r66111 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/