Project

General

Profile

Bug #21717

Updated by noteflakes (Sharon Rosner) about 1 month ago

When using a fiber scheduler and forking a process, the child process "inherits" the fiber scheduler. For the fiber scheduler to be usable in the forked process, its internal state should in most cases be reset. 

 I propose two alternatives for the introduction of a solution: 

 1. Introduce a `Fiber::Scheduler#process_fork` hook, called by the Ruby runtime immediately after a fork. 

 The associated PR: https://github.com/ruby/ruby/pull/15342 

 2. Remove the fiber scheduler after a fork. 

 The associated PR: https://github.com/ruby/ruby/pull/15385 

 This PR also sets the main fiber in the forked process to blocking mode, in order to prevent unexpected behavior if forked from a non-blocking fiber. 

Back