From aa8a3b2358fbdc176c6bcfbcfd3ed1646d287d62 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Sun, 11 Sep 2022 08:59:27 +0900 Subject: MJIT: Do not hang after forking with threads First, rb_mjit_fork should call rb_thread_atfork to stop threads after fork in the child process. Unfortunately, we cannot use rb_fork_ruby to prevent this kind of mistakes because MJIT needs special handling of waiting_pid and mjit_pause/resume. Second, mjit_waitpid_finished should be checked regardless of trap_interrupt. It doesn't seem like the flag is not set when SIGCHLD is handled for an MJIT child process. --- process.c | 1 + 1 file changed, 1 insertion(+) (limited to 'process.c') diff --git a/process.c b/process.c index 405c7edcb3..4465b36c51 100644 --- a/process.c +++ b/process.c @@ -4222,6 +4222,7 @@ rb_mjit_fork(void) after_fork_ruby(); disable_child_handler_fork_parent(&old); + if (pid == 0) rb_thread_atfork(); return pid; } -- cgit v1.2.1