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

ruby-changes:50740

From: nagachika <ko1@a...>
Date: Sun, 25 Mar 2018 14:54:45 +0900 (JST)
Subject: [ruby-changes:50740] nagachika:r62917 (ruby_2_4): merge revision(s) 62673: [Backport #14577]

nagachika	2018-03-25 14:54:39 +0900 (Sun, 25 Mar 2018)

  New Revision: 62917

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

  Log:
    merge revision(s) 62673: [Backport #14577]
    
    thread.c: deadlock in backtrace
    
    * thread.c (unblock_function_set): check interrupts just once
      during raising exceptions, as they are deferred since r16651.
      [ruby-core:85939] [Bug #14577]

  Modified directories:
    branches/ruby_2_4/
  Modified files:
    branches/ruby_2_4/test/ruby/test_exception.rb
    branches/ruby_2_4/thread.c
    branches/ruby_2_4/version.h
Index: ruby_2_4/version.h
===================================================================
--- ruby_2_4/version.h	(revision 62916)
+++ ruby_2_4/version.h	(revision 62917)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_4/version.h#L1
 #define RUBY_VERSION "2.4.4"
 #define RUBY_RELEASE_DATE "2018-03-25"
-#define RUBY_PATCHLEVEL 286
+#define RUBY_PATCHLEVEL 287
 
 #define RUBY_RELEASE_YEAR 2018
 #define RUBY_RELEASE_MONTH 3
Index: ruby_2_4/test/ruby/test_exception.rb
===================================================================
--- ruby_2_4/test/ruby/test_exception.rb	(revision 62916)
+++ ruby_2_4/test/ruby/test_exception.rb	(revision 62917)
@@ -1031,6 +1031,28 @@ $stderr = $stdout; raise "\x82\xa0"') do https://github.com/ruby/ruby/blob/trunk/ruby_2_4/test/ruby/test_exception.rb#L1031
     end;
   end
 
+  def test_blocking_backtrace
+    assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}")
+    begin;
+      class Bug < RuntimeError
+        def backtrace
+          IO.readlines(IO::NULL)
+        end
+      end
+      bug = Bug.new '[ruby-core:85939] [Bug #14577]'
+      n = 10000
+      i = 0
+      n.times do
+        begin
+          raise bug
+        rescue Bug
+          i += 1
+        end
+      end
+      assert_equal(n, i)
+    end;
+  end
+
   def test_wrong_backtrace
     assert_separately([], "#{<<-"begin;"}\n#{<<-"end;"}")
     begin;
Index: ruby_2_4/thread.c
===================================================================
--- ruby_2_4/thread.c	(revision 62916)
+++ ruby_2_4/thread.c	(revision 62917)
@@ -385,7 +385,7 @@ set_unblock_function(rb_thread_t *th, rb https://github.com/ruby/ruby/blob/trunk/ruby_2_4/thread.c#L385
 	}
 
 	native_mutex_lock(&th->interrupt_lock);
-    } while (RUBY_VM_INTERRUPTED_ANY(th) &&
+    } while (!th->raised_flag && RUBY_VM_INTERRUPTED_ANY(th) &&
 	     (native_mutex_unlock(&th->interrupt_lock), TRUE));
 
     if (old) *old = th->unblock;
Index: ruby_2_4
===================================================================
--- ruby_2_4	(revision 62916)
+++ ruby_2_4	(revision 62917)

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

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

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