diff --git a/ChangeLog b/ChangeLog index 34ce1956d3..543c13db83 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Sun May 15 21:22:35 2011 CHIKANAGA Tomoyuki + + * cont.c (cont_init): clear macihne_stack_start/end of saved thread to + prevent mark machine stack of GC'ed Thread. root Fiber is not initialized by + fiber_init(). based on a patch by Serge Balyuk [ruby-core:35891] fixes #4612 + * test/ruby/test_fiber.rb (test_gc_root_fiber): add test for it. + Sun May 15 21:04:29 2011 Nobuyoshi Nakada * transcode.c (econv_init): revert r31353. [ruby-dev:43512] diff --git a/cont.c b/cont.c index ad277bda1d..9a0593c21e 100644 --- a/cont.c +++ b/cont.c @@ -383,6 +383,7 @@ cont_init(rb_context_t *cont, rb_thread_t *th) /* save thread context */ cont->saved_thread = *th; cont->saved_thread.local_storage = 0; + cont->saved_thread.machine_stack_start = cont->saved_thread.machine_stack_end = 0; } static rb_context_t * diff --git a/test/ruby/test_fiber.rb b/test/ruby/test_fiber.rb index ec64f98229..e3e40566f8 100644 --- a/test/ruby/test_fiber.rb +++ b/test/ruby/test_fiber.rb @@ -197,5 +197,16 @@ class TestFiber < Test::Unit::TestCase end.join end end + + def test_gc_root_fiber + bug4612 = '[ruby-core:35891]' + + assert_normal_exit %q{ + require 'fiber' + GC.stress = true + Thread.start{ Fiber.current; nil }.join + GC.start + }, bug4612 + end end