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

ruby-changes:52902

From: usa <ko1@a...>
Date: Wed, 17 Oct 2018 17:40:42 +0900 (JST)
Subject: [ruby-changes:52902] usa:r65115 (ruby_2_4): merge revision(s) 63711, 64398: [Backport #14841]

usa	2018-10-17 17:40:36 +0900 (Wed, 17 Oct 2018)

  New Revision: 65115

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

  Log:
    merge revision(s) 63711,64398: [Backport #14841]
    
    thread_sync.c (rb_mutex_lock): fix deadlock
    
    * thread_sync.c (rb_mutex_lock): fix deadlock
      [ruby-core:87467] [Bug #14841]
    
    thread_sync.c (rb_mutex_lock): acquire lock before being killed
    
    We (the thread acquiring the mutex) need to acquire the mutex
    before being killed to work with ConditionVariable#wait.
    
    Thus we reinstate the acquire-immediately-after-sleeping logic
    from pre-r63711 while still retaining the
    acquire-after-checking-for-interrupts logic from r63711.
    
    This regression was introduced in
    commit 501069b8a4013f2e3fdde35c50e9527ef0061963 (r63711)
    ("thread_sync.c (rb_mutex_lock): fix deadlock") for
    [Bug #14841]
    
    [ruby-core:88503] [Bug #14999] [Bug #14841]

  Modified directories:
    branches/ruby_2_4/
  Modified files:
    branches/ruby_2_4/thread_sync.c
    branches/ruby_2_4/version.h
Index: ruby_2_4/thread_sync.c
===================================================================
--- ruby_2_4/thread_sync.c	(revision 65114)
+++ ruby_2_4/thread_sync.c	(revision 65115)
@@ -299,7 +299,11 @@ rb_mutex_lock(VALUE self) https://github.com/ruby/ruby/blob/trunk/ruby_2_4/thread_sync.c#L299
 	    if (mutex->th == th) mutex_locked(th, self);
 
 	    if (interrupted) {
-		RUBY_VM_CHECK_INTS_BLOCKING(th);
+		RUBY_VM_CHECK_INTS_BLOCKING(th); /* may release mutex */
+		if (!mutex->th) {
+		    mutex->th = th;
+		    mutex_locked(th, self);
+		}
 	    }
 	}
     }
Index: ruby_2_4/version.h
===================================================================
--- ruby_2_4/version.h	(revision 65114)
+++ ruby_2_4/version.h	(revision 65115)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_4/version.h#L1
 #define RUBY_VERSION "2.4.5"
 #define RUBY_RELEASE_DATE "2018-10-17"
-#define RUBY_PATCHLEVEL 329
+#define RUBY_PATCHLEVEL 330
 
 #define RUBY_RELEASE_YEAR 2018
 #define RUBY_RELEASE_MONTH 10
Index: ruby_2_4
===================================================================
--- ruby_2_4	(revision 65114)
+++ ruby_2_4	(revision 65115)

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

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

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