diff --git a/cont.c b/cont.c index f0b8a8a0a8613b..558d35c4bd68be 100644 --- a/cont.c +++ b/cont.c @@ -1616,6 +1616,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 7b513a11fab3d8..4ad0767ccf50b2 100644 --- a/test/ruby/test_fiber.rb +++ b/test/ruby/test_fiber.rb @@ -378,4 +378,14 @@ def test_to_s 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 diff --git a/version.h b/version.h index 0b6e38b248fb0a..ebc3f21d3292bc 100644 --- a/version.h +++ b/version.h @@ -1,10 +1,10 @@ #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"