diff options
-rw-r--r-- | internal.h | 2 | ||||
-rw-r--r-- | mjit.c | 15 | ||||
-rw-r--r-- | process.c | 5 | ||||
-rw-r--r-- | test/ruby/test_process.rb | 2 |
4 files changed, 8 insertions, 16 deletions
diff --git a/internal.h b/internal.h index ca9e16cde5..d36723b273 100644 --- a/internal.h +++ b/internal.h @@ -1633,12 +1633,10 @@ VALUE rb_math_sqrt(VALUE); #if USE_MJIT extern int mjit_enabled; VALUE mjit_pause(int wait_p); -void mjit_pause_without_ints(void); VALUE mjit_resume(void); #else #define mjit_enabled 0 static inline VALUE mjit_pause(int wait_p){ return Qnil; } /* unreachable */ -static inline void mjit_pause_without_ints(void){} /* unreachable */ static inline VALUE mjit_resume(void){ return Qnil; } /* unreachable */ #endif @@ -677,7 +677,7 @@ mjit_init(struct mjit_options *opts) } static void -stop_worker(int check_ints_p) +stop_worker(void) { rb_execution_context_t *ec = GET_EC(); @@ -687,17 +687,10 @@ stop_worker(int check_ints_p) 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"); - if (check_ints_p) RUBY_VM_CHECK_INTS(ec); + RUBY_VM_CHECK_INTS(ec); } } -/* A function to stop MJIT worker when it's not safe to allow interrupts. */ -void -mjit_pause_without_ints(void) -{ - stop_worker(FALSE); -} - /* Stop JIT-compiling methods but compiled code is kept available. */ VALUE mjit_pause(int wait_p) @@ -723,7 +716,7 @@ mjit_pause(int wait_p) } } - stop_worker(TRUE); + stop_worker(); return Qtrue; } @@ -816,7 +809,7 @@ mjit_finish(void) CRITICAL_SECTION_FINISH(3, "in mjit_finish to wakeup from pch"); /* Stop worker */ - stop_worker(TRUE); + stop_worker(); rb_native_mutex_destroy(&mjit_engine_mutex); rb_native_cond_destroy(&mjit_pch_wakeup); @@ -1506,9 +1506,8 @@ static void before_fork_ruby(void) { if (mjit_enabled) { - /* Avoid leaving locked mutex and units being modified for child process. Here may not be - safe for proceeding SIGCHLD handler, so this does not allow RUBY_VM_CHECK_INTS. */ - mjit_pause_without_ints(); + /* avoid leaving locked mutex and units being modified for child process. */ + mjit_pause(FALSE); } before_exec(); diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index 4e4a65778d..6198ffcb89 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -1724,6 +1724,7 @@ class TestProcess < Test::Unit::TestCase if Process.respond_to?(:daemon) def test_daemon_default + skip 'Process.daemon in IO.popen block deadlocks with MJIT [Bug #15320]' if RubyVM::MJIT.enabled? data = IO.popen("-", "r+") do |f| break f.read if f Process.daemon @@ -1773,6 +1774,7 @@ class TestProcess < Test::Unit::TestCase if File.directory?("/proc/self/task") && /netbsd[a-z]*[1-6]/ !~ RUBY_PLATFORM def test_daemon_no_threads + skip 'Process.daemon in IO.popen block deadlocks with MJIT [Bug #15320]' if RubyVM::MJIT.enabled? pid, data = IO.popen("-", "r+") do |f| break f.pid, f.readlines if f Process.daemon(true, true) |