mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
process.c: do not try to pause MJIT
while child handler is disabled. trying to fix [Bug #15320] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65817 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
95e09343a4
commit
3405411cc4
2 changed files with 8 additions and 21 deletions
27
process.c
27
process.c
|
@ -1502,26 +1502,12 @@ after_exec(void)
|
|||
}
|
||||
|
||||
#if defined HAVE_WORKING_FORK || defined HAVE_DAEMON
|
||||
#define before_fork_ruby() before_exec()
|
||||
static void
|
||||
before_fork_ruby(void)
|
||||
{
|
||||
if (mjit_enabled) {
|
||||
/* avoid leaving locked mutex and units being modified for child process. */
|
||||
mjit_pause(FALSE);
|
||||
}
|
||||
|
||||
before_exec();
|
||||
}
|
||||
|
||||
static void
|
||||
after_fork_ruby(int parent_p)
|
||||
after_fork_ruby(void)
|
||||
{
|
||||
rb_threadptr_pending_interrupt_clear(GET_THREAD());
|
||||
after_exec();
|
||||
|
||||
if (mjit_enabled && parent_p) { /* child is cared by `rb_thread_atfork` */
|
||||
mjit_resume();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -4007,12 +3993,14 @@ rb_fork_ruby(int *status)
|
|||
|
||||
while (1) {
|
||||
prefork();
|
||||
if (mjit_enabled) mjit_pause(FALSE); /* Don't leave locked mutex to child. Note: child_handler must be enabled to pause MJIT. */
|
||||
disable_child_handler_before_fork(&old);
|
||||
before_fork_ruby();
|
||||
pid = fork();
|
||||
err = errno;
|
||||
after_fork_ruby(pid > 0);
|
||||
after_fork_ruby();
|
||||
disable_child_handler_fork_parent(&old); /* yes, bad name */
|
||||
if (mjit_enabled && pid > 0) mjit_resume(); /* child (pid == 0) is cared by rb_thread_atfork */
|
||||
if (pid >= 0) /* fork succeed */
|
||||
return pid;
|
||||
/* fork failed */
|
||||
|
@ -6434,10 +6422,11 @@ rb_daemon(int nochdir, int noclose)
|
|||
{
|
||||
int err = 0;
|
||||
#ifdef HAVE_DAEMON
|
||||
if (mjit_enabled) mjit_pause(FALSE); /* Don't leave locked mutex to child. */
|
||||
before_fork_ruby();
|
||||
err = daemon(nochdir, noclose);
|
||||
after_fork_ruby(TRUE);
|
||||
rb_thread_atfork();
|
||||
after_fork_ruby();
|
||||
rb_thread_atfork(); /* calls mjit_resume() */
|
||||
#else
|
||||
int n;
|
||||
|
||||
|
|
|
@ -1724,7 +1724,6 @@ class TestProcess < Test::Unit::TestCase
|
|||
|
||||
if Process.respond_to?(:daemon)
|
||||
def test_daemon_default
|
||||
skip 'IO.popen deadlocks with MJIT [Bug #15320]' if RubyVM::MJIT.enabled?
|
||||
data = IO.popen("-", "r+") do |f|
|
||||
break f.read if f
|
||||
Process.daemon
|
||||
|
@ -1774,7 +1773,6 @@ class TestProcess < Test::Unit::TestCase
|
|||
|
||||
if File.directory?("/proc/self/task") && /netbsd[a-z]*[1-6]/ !~ RUBY_PLATFORM
|
||||
def test_daemon_no_threads
|
||||
skip 'IO.popen 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)
|
||||
|
|
Loading…
Add table
Reference in a new issue