summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authork0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-18 13:32:49 +0000
committerk0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-18 13:32:49 +0000
commit524e4cc9824b9c8ff09950fdd9b35c92fb57a8df (patch)
tree227fd86c5deedbc6cad45b1600275d1a5fcfd6dc
parent9edbcbcba17733775dc760f5af55aed160413983 (diff)
mjit.c: fix deadlock introduced by r65785
in mjit_pause() fired by before_fork_ruby(). When calling RUBY_VM_CHECK_INTS() in mjit_pause()'s loop, other threads may call start_worker() which sets `stop_worker_p = FALSE` and it could wait for MJIT worker stop forever even while `stop_worker_p` is FALSE. http://ci.rvm.jp/results/trunk-mjit@silicon-docker/1466333 https://gist.github.com/ko1/a57ef1a03e1c7cfd22f1495e0864b63d http://ci.rvm.jp/results/trunk-mjit-wait@silicon-docker/1466335 https://gist.github.com/ko1/96e867e36e6b75559b3d926f8c0bdaeb https://app.wercker.com/ruby/ruby/runs/mjit-test1/5bf1221c183106002855989c?step=5bf1225987436a0006192c31 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65790 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--mjit.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mjit.c b/mjit.c
index 25b2bd9322..1578c961ae 100644
--- a/mjit.c
+++ b/mjit.c
@@ -681,10 +681,10 @@ stop_worker(void)
{
rb_execution_context_t *ec = GET_EC();
- stop_worker_p = TRUE;
while (!worker_stopped) {
verbose(3, "Sending cancel signal to worker");
CRITICAL_SECTION_START(3, "in stop_worker");
+ stop_worker_p = TRUE; /* Setting this inside loop because RUBY_VM_CHECK_INTS may make this FALSE. */
rb_native_cond_broadcast(&mjit_worker_wakeup);
CRITICAL_SECTION_FINISH(3, "in stop_worker");
RUBY_VM_CHECK_INTS(ec);