Acquire VM lock around fork

Otherwise it might be held by another Ractor, causing a deadlock in the
new process.
This commit is contained in:
John Hawthorn 2025-05-06 19:08:02 -07:00
parent c750856367
commit d7ad53f249
Notes: git 2025-05-08 17:53:42 +00:00

View File

@ -4132,8 +4132,12 @@ rb_fork_ruby(int *status)
rb_thread_acquire_fork_lock();
disable_child_handler_before_fork(&old);
child.pid = pid = rb_fork();
child.error = err = errno;
RB_VM_LOCK_ENTER();
{
child.pid = pid = rb_fork();
child.error = err = errno;
}
RB_VM_LOCK_LEAVE();
disable_child_handler_fork_parent(&old); /* yes, bad name */
if (