Project

General

Profile

Bug #17622

Updated by peterzhu2118 (Peter Zhu) over 3 years ago

[Pull request on GitHub](https://github.com/ruby/ruby/pull/4175). 

 There is a segfault in Ruby master and Ruby 3.0.0, but not present in Ruby 2.7.2. A bisect shows that it's present since commit [a53e2850c572135ed657144bc14e47b29c64fa94](https://github.com/ruby/ruby/commit/a53e2850c572135ed657144bc14e47b29c64fa94). 

 # Reproduction 

 1. Use Ruby 3.0.0 or Ruby master. 
 2. Create a new Rails app (`rails new repro`). 
 3. Add the following `script.rb`: 

     ```ruby 
     def load_rails 
       tp = TracePoint.new(:c_return) do 
       end 

       require './config/application' 
       rails = Object.const_get(:Rails) 
       rails.application.require_environment! 
       rails.application.eager_load! 
     end 

     def foo 
       -> do 
         load_rails 
       end 
     end 

     foo.call 
     puts "ok" 
     ``` 

 4. Run the script with `DISABLE_BOOTSNAP=1 ruby script.rb` 

 # Expected output 

 The script should print `ok`. 

 # Actual output 

 Crashes with a segfault (check file `crash.log` for full crash log). 

Back