tmm1/amqp

Stack level too deep for in lib/amqp/spec.rb:101

ajsharp opened this issue · 2 comments

This occurs when running rspec on a rails project with bundler 0.9.9. We are not actually requiring amqp directly -- it is a gem dependency of minion.

/Users/ajsharp/.bundle/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/module/introspection.rb:9:in `parent_name': stack level too deep (SystemStackError)
        from /Users/ajsharp/.bundle/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/module/introspection.rb:31:in `parent'
        from /Users/ajsharp/.bundle/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:91:in `const_missing'
        from /Users/ajsharp/.bundle/ruby/1.8/gems/amqp-0.6.7/lib/amqp/spec.rb:101:in `name'
        from /Users/ajsharp/.bundle/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/module/introspection.rb:9:in `parent_name'
        from /Users/ajsharp/.bundle/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/module/introspection.rb:31:in `parent'
        from /Users/ajsharp/.bundle/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:91:in `const_missing'
        from /Users/ajsharp/.bundle/ruby/1.8/gems/amqp-0.6.7/lib/amqp/spec.rb:101:in `name'
        from /Users/ajsharp/.bundle/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/module/introspection.rb:9:in `parent_name'
         ... 7343 levels...
        from /Users/ajsharp/.bundle/ruby/1.8/gems/rspec-1.3.0/lib/spec/runner/example_group_runner.rb:14:in `load_files'
        from /Users/ajsharp/.bundle/ruby/1.8/gems/rspec-1.3.0/lib/spec/runner/options.rb:133:in `run_examples'
        from /Users/ajsharp/.bundle/ruby/1.8/gems/rspec-1.3.0/lib/spec/runner/command_line.rb:9:in `run'
        from /Users/ajsharp/.bundle/ruby/1.8/gems/rspec-1.3.0/bin/spec:5

I had this same problem running a Rails app with amqp 0.6.7 via autotest (part of ZenTest).

I was able to resolve it by NOT loading the ZenTest gem in the Rails app being tested. Only the autotest parent process needs that; the Rails app being tested doesn't need ZenTest.

If this doesn't describe your exact situation, then you can still do what I did to try and track it down: just try commenting out gem dependencies in config/environment.rb or Gemfile (or however you're expressing your app's gem requirements) until the amqp gem works, to find out what the conflicting gem is.

It doesn't sound like an actual AMQP bug.