aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-15 12:41:40 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-15 12:41:40 +0000
commit980155686aa373e015f51e3e279403d2aa66d4b9 (patch)
treecaae9748324f2dc478b7133a0c453748d4678b30
parentf41dcd486e2004c042941b9d41400986d36f65dc (diff)
downloadruby-980155686aa373e015f51e3e279403d2aa66d4b9.tar.gz
* 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
-rw-r--r--ChangeLog7
-rw-r--r--cont.c1
-rw-r--r--test/ruby/test_fiber.rb11
3 files changed, 19 insertions, 0 deletions
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 <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>
* 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