Skip to content

Instantly share code, notes, and snippets.

@yuemori
Last active July 31, 2019 13:35
Show Gist options
  • Save yuemori/a864ff121bea751d35a7d31119ab3cb1 to your computer and use it in GitHub Desktop.
Save yuemori/a864ff121bea751d35a7d31119ab3cb1 to your computer and use it in GitHub Desktop.
ruby + rails SystemStackError
class Foo
class << self
def foo
Foo
end
def method_missing(name)
foo.respond_to?(name) ? foo.send(name) : super
end
def respond_to_missing?(name, include_private)
foo.respond_to?(name, include_private) || super
end
end
end
# rails 4.2.5.2
[yuemori] ~/work/rails4.2.5.2
(*'-') < DISABLE_SPRING=true bundle exec rails console (git)-[master]
Loading development environment (Rails 4.2.5.2)
irb(main):001:0> Foo.first
SystemStackError: stack level too deep
[yuemori] ~/work/rails4.2.5.2
(*'-') < bundle exec spring rails console (git)-[master]
Running via Spring preloader in process 37061
Loading development environment (Rails 4.2.5.2)
irb(main):001:0> Foo.first
SystemStackError: stack level too deep
# rails 4.2.8
[yuemori] ~/work/rails4.2.8
(*'-') < DISABLE_SPRING=true bundle exec rails console
Loading development environment (Rails 4.2.8)
irb(main):001:0> Foo.first
SystemStackError: stack level too deep
[yuemori] ~/work/rails4.2.8
(*'-') < bundle exec spring rails console
Running via Spring preloader in process 37025
Loading development environment (Rails 4.2.8)
irb(main):001:0> Foo.first
SystemStackError: stack level too deep
# rails 5.0.2
[yuemori] ~/work/rails5.0.2
(*'-') < DISABLE_SPRING=true bundle exec rails console (git)-[master]
Loading development environment (Rails 5.0.2)
irb(main):001:0> Foo.first
bin/rails: exception reentered (fatal)
[yuemori] ~/work/rails5.0.2
(*'-') < bundle exec spring rails console (git)-[master]
Running via Spring preloader in process 36943
Loading development environment (Rails 5.0.2)
irb(main):001:0> Foo.first
/Users/yuemori/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:301:in `blame_file!': can't modify frozen fatal (RuntimeError)
from /Users/yuemori/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:262:in `rescue in load_dependency'
from /Users/yuemori/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:256:in `load_dependency'
from /Users/yuemori/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:in `require'
from /Users/yuemori/Work/rails5.0.2/bin/rails:4:in `<top (required)>'
from /Users/yuemori/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:287:in `load'
from /Users/yuemori/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:287:in `block in load'
from /Users/yuemori/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:259:in `load_dependency'
from /Users/yuemori/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:287:in `load'
from /Users/yuemori/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/yuemori/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
# rails 4.2.5.2
[yuemori] ~/work/rails4.2.5.2
(*'-') < ruby -v (git)-[master]
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin16]
[yuemori] ~/work/rails4.2.5.2
(*'-') < DISABLE_SPRING=true bundle exec rails console (git)-[master]
Loading development environment (Rails 4.2.5.2)
irb(main):001:0> Foo.first
SystemStackError: stack level too deep
[yuemori] ~/work/rails4.2.5.2
(*'-') < bundle exec spring rails console (git)-[master]
Running via Spring preloader in process 37061
Loading development environment (Rails 4.2.5.2)
irb(main):001:0> Foo.first
SystemStackError: stack level too deep
# rails 4.2.8
[yuemori] ~/work/rails4.2.8
(*'-') < DISABLE_SPRING=true bundle exec rails console
Loading development environment (Rails 4.2.8)
irb(main):001:0> Foo.first
SystemStackError: stack level too deep
[yuemori] ~/work/rails4.2.8
(*'-') < bundle exec spring rails console
Running via Spring preloader in process 37372
Loading development environment (Rails 4.2.8)
irb(main):001:0> Foo.first
SystemStackError: stack level too deep
# rails 5.0.2
[yuemori] ~/work/rails5.0.2
(*'-') < DISABLE_SPRING=true bundle exec rails console (git)-[master]
Loading development environment (Rails 5.0.2)
irb(main):001:0> Foo.first
bin/rails:4:in `require': exception reentered (fatal)
from bin/rails:4:in `<main>'
[yuemori] ~/work/rails5.0.2
(*'-') < bundle exec spring rails console (git)-[master]
Running via Spring preloader in process 36864
Loading development environment (Rails 5.0.2)
irb(main):001:0> Foo.first
/Users/yuemori/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:in `require': exception reentered (fatal)
from /Users/yuemori/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:in `block in require'
from /Users/yuemori/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:259:in `load_dependency'
from /Users/yuemori/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:in `require'
from /Users/yuemori/Work/rails5.0.2/bin/rails:4:in `<top (required)>'
from /Users/yuemori/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:287:in `load'
from /Users/yuemori/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:287:in `block in load'
from /Users/yuemori/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:259:in `load_dependency'
from /Users/yuemori/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:287:in `load'
from /Users/yuemori/.rbenv/versions/2.3.3/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/yuemori/.rbenv/versions/2.3.3/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
# rails4.2.5.2 ... ruby2.4.0 not supported
[yuemori] ~/work/rails4.2.5.2
(*'-') < DISABLE_SPRING=true bundle exec rails console (git)-[master]
/Users/yuemori/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.5.2/lib/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Fixnum is deprecated
/Users/yuemori/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.5.2/lib/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Bignum is deprecated
/Users/yuemori/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.5.2/lib/active_support/core_ext/numeric/conversions.rb:124:in `block (2 levels) in <class:Numeric>': stack level too deep (SystemStackError)
from /Users/yuemori/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.5.2/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
# rails4.2.8
[yuemori] ~/work/rails4.2.8
(*'-') < DISABLE_SPRING=true bundle exec rails console
Loading development environment (Rails 4.2.8)
irb(main):001:0> Foo.first
SystemStackError: stack level too deep
[yuemori] ~/work/rails4.2.8
(*'-') < bundle exec spring rails console
Running via Spring preloader in process 37687
Loading development environment (Rails 4.2.8)
irb(main):001:0> Foo.first # 落ちる
# rails5.0.2
[yuemori] ~/work/rails5.0.2
(*'-') < DISABLE_SPRING=true bundle exec rails console (git)-[master]
Loading development environment (Rails 5.0.2)
irb(main):001:0> Foo.first # ハングアップ
[yuemori] ~/work/rails5.0.2
(*'-') < bundle exec spring rails console (git)-[master]
Running via Spring preloader in process 38484
Loading development environment (Rails 5.0.2)
irb(main):001:0> Foo.first # 落ちる
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment