Shopify / deprecation_toolkit

⚒Eliminate deprecations from your codebase ⚒
MIT License
469 stars 40 forks source link

SystemStackError with RubyGems v3 and Ruby 2.5+ #33

Closed brendo closed 5 years ago

brendo commented 5 years ago

Attempting to boot a rails server results in a crash after upgrading to RubyGems v3:

Traceback (most recent call last):
    9739: from /Users/brendanabbott/src/github.com/Shopify/brochure2/bin/rails:4:in `<main>'
    9738: from /Users/brendanabbott/.gem/ruby/2.5.3/gems/activesupport-5.2.1.1/lib/active_support/dependencies.rb:287:in `require'
    9737: from /Users/brendanabbott/.gem/ruby/2.5.3/gems/activesupport-5.2.1.1/lib/active_support/dependencies.rb:253:in `load_dependency'
    9736: from /Users/brendanabbott/.gem/ruby/2.5.3/gems/activesupport-5.2.1.1/lib/active_support/dependencies.rb:287:in `block in require'
    9735: from /Users/brendanabbott/.gem/ruby/2.5.3/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
    9734: from /Users/brendanabbott/.gem/ruby/2.5.3/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
    9733: from /Users/brendanabbott/.gem/ruby/2.5.3/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
    9732: from /Users/brendanabbott/.gem/ruby/2.5.3/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
     ... 9727 levels...
       4: from /opt/rubies/2.5.3-alans-special-1/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_warn.rb:17:in `warn'
       3: from /Users/brendanabbott/.gem/ruby/2.5.3/gems/deprecation_toolkit-1.2.0/lib/deprecation_toolkit/warning.rb:19:in `warn'
       2: from /opt/rubies/2.5.3-alans-special-1/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_warn.rb:17:in `block in <module:Kernel>'
       1: from /opt/rubies/2.5.3-alans-special-1/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_warn.rb:17:in `call'
/opt/rubies/2.5.3-alans-special-1/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_warn.rb:17:in `warn': stack level too deep (SystemStackError)

After doing some digging it looks like the monkey patch in warning.rb plays with some changes made in this rubygems commit (thanks @rafaelfranca!) and causes the error.

ruby 2.5.3
rails 5.2.1.1
deprecation-toolkit 1.2.0
rubygems 3.0.2

MacOS 10.14.2
Edouard-chin commented 5 years ago

This seems to be an issue in Rubygems, I opened an issue https://github.com/rubygems/rubygems/issues/2588

I don't think there is much we can do in the deprecation_toolkit to workaround it 🤔