deftest_fork_in_ractorr2=Ractor.newdopid=forkdoexitRactor.countendpidendpid=r2.takeputs"Process #{Process.pid} waiting for #{pid}"_pid,status=Process.waitpid2(pid)# stuck foreverifstatus.exitstatus!=1raise"status is #{status.exitstatus}"endendtest_fork_in_ractor()
The issue is that when there's multiple ractors and you call fork, the other ractor(s) that are in the child process that aren't the new main ractor need to be GC'd, and their mutexes could be in a weird state, so either skip destruction of them or reinitialize them in the child process. Re-init works on my machine but I don't know if it works across platforms.