[前][次][番号順一覧][スレッド一覧]

ruby-changes:54751

From: usa <ko1@a...>
Date: Thu, 31 Jan 2019 20:02:56 +0900 (JST)
Subject: [ruby-changes:54751] usa:r66968 (ruby_2_4): merge revision(s) 64589, 64593: [Backport #15041]

usa	2019-01-31 20:02:52 +0900 (Thu, 31 Jan 2019)

  New Revision: 66968

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=66968

  Log:
    merge revision(s) 64589,64593: [Backport #15041]
    
    cont.c: set th->root_fiber to current fiber at fork
    
    Otherwise, th->root_fiber can point to an invalid Fiber,
    because Fibers do not live across fork.  So consider
    whatever Fiber is running the root fiber.
    
    [ruby-core:88723] [Bug #15041]
    
    cont.c (rb_fiber_atfork): th->root_fiber may not exist
    
    Otherwise, bootstraptest/test_fork.rb fails with -DVM_CHECK_MODE=2
    
    [Bug #15041]
    
    Fixes: r64589 "cont.c: set th->root_fiber to current fiber at fork"

  Modified directories:
    branches/ruby_2_4/
  Modified files:
    branches/ruby_2_4/cont.c
    branches/ruby_2_4/test/ruby/test_fiber.rb
    branches/ruby_2_4/thread.c
    branches/ruby_2_4/version.h
Index: ruby_2_4/thread.c
===================================================================
--- ruby_2_4/thread.c	(revision 66967)
+++ ruby_2_4/thread.c	(revision 66968)
@@ -4172,12 +4172,14 @@ terminate_atfork_i(rb_thread_t *th, cons https://github.com/ruby/ruby/blob/trunk/ruby_2_4/thread.c#L4172
     }
 }
 
+void rb_fiber_atfork(rb_thread_t *);
 void
 rb_thread_atfork(void)
 {
     rb_thread_t *th = GET_THREAD();
     rb_thread_atfork_internal(th, terminate_atfork_i);
     th->join_list = NULL;
+    rb_fiber_atfork(th);
 
     /* We don't want reproduce CVE-2003-0900. */
     rb_reset_random_seed();
Index: ruby_2_4/cont.c
===================================================================
--- ruby_2_4/cont.c	(revision 66967)
+++ ruby_2_4/cont.c	(revision 66968)
@@ -1660,6 +1660,20 @@ rb_fiber_s_current(VALUE klass) https://github.com/ruby/ruby/blob/trunk/ruby_2_4/cont.c#L1660
 
 
 
+#ifdef HAVE_WORKING_FORK
+void
+rb_fiber_atfork(rb_thread_t *th)
+{
+    if (th->root_fiber) {
+        if (&th->root_fiber->cont.saved_ec != th->ec) {
+            th->root_fiber = th->ec->fiber_ptr;
+            th->root_fiber->cont.type = ROOT_FIBER_CONTEXT;
+        }
+        th->root_fiber->prev = 0;
+    }
+}
+#endif
+
 /*
  *  Document-class: FiberError
  *
Index: ruby_2_4/version.h
===================================================================
--- ruby_2_4/version.h	(revision 66967)
+++ ruby_2_4/version.h	(revision 66968)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_4/version.h#L1
 #define RUBY_VERSION "2.4.6"
 #define RUBY_RELEASE_DATE "2019-01-31"
-#define RUBY_PATCHLEVEL 343
+#define RUBY_PATCHLEVEL 344
 
 #define RUBY_RELEASE_YEAR 2019
 #define RUBY_RELEASE_MONTH 1
Index: ruby_2_4/test/ruby/test_fiber.rb
===================================================================
--- ruby_2_4/test/ruby/test_fiber.rb	(revision 66967)
+++ ruby_2_4/test/ruby/test_fiber.rb	(revision 66968)
@@ -256,7 +256,11 @@ class TestFiber < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_4/test/ruby/test_fiber.rb#L256
     end
     bug5700 = '[ruby-core:41456]'
     assert_nothing_raised(bug5700) do
-      Fiber.new{ pid = fork {} }.resume
+      Fiber.new do
+        pid = fork do
+          Fiber.new {}.transfer
+        end
+      end.resume
     end
     pid, status = Process.waitpid2(pid)
     assert_equal(0, status.exitstatus, bug5700)
Index: ruby_2_4
===================================================================
--- ruby_2_4	(revision 66967)
+++ ruby_2_4	(revision 66968)

Property changes on: ruby_2_4
___________________________________________________________________
Modified: svn:mergeinfo
## -0,0 +0,1 ##
   Merged /trunk:r64589,64593

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]