From: Eric Wong <e@80x24.org>
To: spew@80x24.org
Subject: [PATCH] process.c (rb_f_exec): pause MJIT before replacing self
Date: Sat, 7 Jul 2018 22:43:14 +0000 [thread overview]
Message-ID: <20180707224314.28350-1-e@80x24.org> (raw)
Non-parallel "make test-spec" was caused
spec/ruby/core/process/wait2_spec.rb failures because mspec
uses "exec" in single-process mode, so there's no chance
the post-exec state could know about the mjit child from its
pre-exec state.
---
process.c | 5 +++++
spec/ruby/core/process/wait2_spec.rb | 3 +--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/process.c b/process.c
index 12cceba934d..67883e0af2d 100644
--- a/process.c
+++ b/process.c
@@ -148,6 +148,10 @@ static void check_uid_switch(void);
static void check_gid_switch(void);
static int exec_async_signal_safe(const struct rb_execarg *, char *, size_t);
+/* mjit.c */
+extern int mjit_enabled;
+VALUE mjit_pause(void);
+
#if 1
#define p_uid_from_name p_uid_from_name
#define p_gid_from_name p_gid_from_name
@@ -2849,6 +2853,7 @@ rb_f_exec(int argc, const VALUE *argv)
execarg_obj = rb_execarg_new(argc, argv, TRUE, FALSE);
eargp = rb_execarg_get(execarg_obj);
+ if (mjit_enabled) mjit_pause(); /* do not leak children */
before_exec(); /* stop timer thread before redirects */
rb_execarg_parent_start(execarg_obj);
fail_str = eargp->use_shell ? eargp->invoke.sh.shell_script : eargp->invoke.cmd.command_name;
diff --git a/spec/ruby/core/process/wait2_spec.rb b/spec/ruby/core/process/wait2_spec.rb
index 45dbf8e25a3..d0163f80afa 100644
--- a/spec/ruby/core/process/wait2_spec.rb
+++ b/spec/ruby/core/process/wait2_spec.rb
@@ -15,8 +15,7 @@
$stderr.puts "leaked before wait2 specs: #{leaked}" unless leaked.empty?
with_feature :mjit do
# Ruby-space should not see PIDs used by mjit
- # TODO: Enable this once it succeeds with -DMJIT_FORCE_ENABLE
- # leaked.should be_empty
+ leaked.should be_empty
end
rescue Errno::ECHILD # No child processes
rescue NotImplementedError
--
EW
reply other threads:[~2018-07-07 22:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180707224314.28350-1-e@80x24.org \
--to=e@80x24.org \
--cc=spew@80x24.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).