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

ruby-changes:50687

From: naruse <ko1@a...>
Date: Tue, 20 Mar 2018 11:09:27 +0900 (JST)
Subject: [ruby-changes:50687] naruse:r62854 (ruby_2_5): merge revision(s) 62673: [Backport #14577]

naruse	2018-03-20 11:09:21 +0900 (Tue, 20 Mar 2018)

  New Revision: 62854

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

  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_5/
  Modified files:
    branches/ruby_2_5/test/ruby/test_exception.rb
    branches/ruby_2_5/thread.c
    branches/ruby_2_5/version.h
Index: ruby_2_5/test/ruby/test_exception.rb
===================================================================
--- ruby_2_5/test/ruby/test_exception.rb	(revision 62853)
+++ ruby_2_5/test/ruby/test_exception.rb	(revision 62854)
@@ -1086,6 +1086,28 @@ $stderr = $stdout; raise "\x82\xa0"') do https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/ruby/test_exception.rb#L1086
     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_5/thread.c
===================================================================
--- ruby_2_5/thread.c	(revision 62853)
+++ ruby_2_5/thread.c	(revision 62854)
@@ -392,7 +392,7 @@ unblock_function_set(rb_thread_t *th, rb https://github.com/ruby/ruby/blob/trunk/ruby_2_5/thread.c#L392
 	}
 
 	native_mutex_lock(&th->interrupt_lock);
-    } while (RUBY_VM_INTERRUPTED_ANY(th->ec) &&
+    } while (!th->ec->raised_flag && RUBY_VM_INTERRUPTED_ANY(th->ec) &&
 	     (native_mutex_unlock(&th->interrupt_lock), TRUE));
 
     VM_ASSERT(th->unblock.func == NULL);
Index: ruby_2_5/version.h
===================================================================
--- ruby_2_5/version.h	(revision 62853)
+++ ruby_2_5/version.h	(revision 62854)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_5/version.h#L1
 #define RUBY_VERSION "2.5.0"
 #define RUBY_RELEASE_DATE "2018-03-20"
-#define RUBY_PATCHLEVEL 43
+#define RUBY_PATCHLEVEL 44
 
 #define RUBY_RELEASE_YEAR 2018
 #define RUBY_RELEASE_MONTH 3
Index: ruby_2_5
===================================================================
--- ruby_2_5	(revision 62853)
+++ ruby_2_5	(revision 62854)

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

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

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