[ruby-cvs:70300] normal:r63210 (trunk): variable.c: fix thread + fork errors in autoload

normal at ruby-lang.org normal at ruby-lang.org
Fri Apr 20 12:22:26 JST 2018


normal	2018-04-20 12:22:26 +0900 (Fri, 20 Apr 2018)

  New Revision: 63210

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63210

  Log:
    variable.c: fix thread + fork errors in autoload
    
    This is fairly non-intrusive bugfix to prevent children
    from trying to reach into thread stacks of the parent.
    I will probably reuse this idea and redo r62934, too
    (same bug).
    
    * vm_core.h (typedef struct rb_vm_struct): add fork_gen counter
    * thread.c (rb_thread_atfork_internal): increment fork_gen
    * variable.c (struct autoload_data_i): store fork_gen
    * variable.c (check_autoload_data): remove (replaced with get_...)
    * variable.c (get_autoload_data): check fork_gen when retrieving
    * variable.c (check_autoload_required): use get_autoload_data
    * variable.c (rb_autoloading_value): ditto
    * variable.c (rb_autoload_p): ditto
    * variable.c (current_autoload_data): ditto
    * variable.c (autoload_reset): reset fork_gen, adjust indent
    * variable.c (rb_autoload_load): set fork_gen when setting state
    * test/ruby/test_autoload.rb (test_autoload_fork): new test
      [ruby-core:86410] [Bug #14634]

  Modified files:
    trunk/test/ruby/test_autoload.rb
    trunk/thread.c
    trunk/variable.c
    trunk/vm_core.h


More information about the ruby-cvs mailing list