* 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.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2011-05-15 12:41:40 +00:00
Родитель f41dcd486e
Коммит 980155686a
3 изменённых файлов: 19 добавлений и 0 удалений

Просмотреть файл

@ -1,3 +1,10 @@
Sun May 15 21:22:35 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
* 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 <nobu@ruby-lang.org> Sun May 15 21:04:29 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
* transcode.c (econv_init): revert r31353. [ruby-dev:43512] * transcode.c (econv_init): revert r31353. [ruby-dev:43512]

1
cont.c
Просмотреть файл

@ -383,6 +383,7 @@ cont_init(rb_context_t *cont, rb_thread_t *th)
/* save thread context */ /* save thread context */
cont->saved_thread = *th; cont->saved_thread = *th;
cont->saved_thread.local_storage = 0; cont->saved_thread.local_storage = 0;
cont->saved_thread.machine_stack_start = cont->saved_thread.machine_stack_end = 0;
} }
static rb_context_t * static rb_context_t *

Просмотреть файл

@ -197,5 +197,16 @@ class TestFiber < Test::Unit::TestCase
end.join end.join
end end
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 end