Skip to content

Commit

Permalink
merge revision(s) 63711,64398: [Backport #14841]
Browse files Browse the repository at this point in the history
	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 501069b (r63711)
	("thread_sync.c (rb_mutex_lock): fix deadlock") for
	[Bug #14841]

	[ruby-core:88503] [Bug #14999] [Bug #14841]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@65115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
unak committed Oct 17, 2018
1 parent b01022c commit f5b0b98
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion thread_sync.c
Expand Up @@ -299,7 +299,11 @@ rb_mutex_lock(VALUE self)
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);
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion version.h
@@ -1,6 +1,6 @@
#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
Expand Down

0 comments on commit f5b0b98

Please sign in to comment.