Skip to content
  • John Hawthorn's avatar
    f1b7424c
    FREE_AT_EXIT: Don't free main stack post-fork · f1b7424c
    John Hawthorn authored
    When a forked process was started in a thread, this would result in a
    double-free during the child process exit.
    
        RUBY_FREE_AT_EXIT=1 ./miniruby -e 'Thread.new { fork { } }.join; Process.waitpid'
    
    This is because the main thread in the forked process was not the
    initial VM thread, and the new thread's stack was freed as part of
    objectspace iteration.
    
    This change also allows rb_threadptr_root_fiber_release to run without
    EC being available.
    f1b7424c
    FREE_AT_EXIT: Don't free main stack post-fork
    John Hawthorn authored
    When a forked process was started in a thread, this would result in a
    double-free during the child process exit.
    
        RUBY_FREE_AT_EXIT=1 ./miniruby -e 'Thread.new { fork { } }.join; Process.waitpid'
    
    This is because the main thread in the forked process was not the
    initial VM thread, and the new thread's stack was freed as part of
    objectspace iteration.
    
    This change also allows rb_threadptr_root_fiber_release to run without
    EC being available.
Loading