salsify/goldiloader

Stack level too deep, incomplete response

Closed this issue · 14 comments

Hi, after latest update I am getting errors from the title.
Is this something that points to my code problem or goldieloader bug?
I mean, when i disable goldie it works just fine.

Thx

What other gems are you using? It's possible that the switch from alias_method_chain to Module#prepend is causing issues with monkey patching done by another gem. Does the latest 1.0.x goldiloader work for you?

@Svashta - Can you make the stack trace and your Gemfile.lock available?

I'm also having stack level too deep error. I came up with this when I upgraded ruby version to 2.4.0 (I also did bundle update so).

This is what I get from tests.

SystemStackError:
stack level too deep
# /home/rof/cache/bundler/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/associations/through_association.rb:6:in `through_reflection'
# /home/rof/cache/bundler/ruby/2.4.0/gems/goldiloader-2.0.1/lib/goldiloader/active_record_patches.rb:160:in `auto_include?'
# /home/rof/cache/bundler/ruby/2.4.0/gems/goldiloader-2.0.1/lib/goldiloader/active_record_patches.rb:112:in `load_with_auto_include'
# /home/rof/cache/bundler/ruby/2.4.0/gems/goldiloader-2.0.1/lib/goldiloader/active_record_patches.rb:146:in `load_target'
# /home/rof/cache/bundler/ruby/2.4.0/gems/bullet-5.5.1/lib/bullet/active_record5.rb:162:in `load_target'
# /home/rof/cache/bundler/ruby/2.4.0/gems/goldiloader-2.0.1/lib/goldiloader/active_record_patches.rb:146:in `block in load_target'
# /home/rof/cache/bundler/ruby/2.4.0/gems/goldiloader-2.0.1/lib/goldiloader/active_record_patches.rb:116:in `load_with_auto_include'
# /home/rof/cache/bundler/ruby/2.4.0/gems/goldiloader-2.0.1/lib/goldiloader/active_record_patches.rb:146:in `load_target'

These lines repeated endlessly.

I also removed auto_include from 2 models because there was an error. (I don't exactly remember but I can reproduce the error if will help.

@mrwilhelm - It looks like the switch by Goldiloader 2.0 to use Module#prepend instead of alias_method is conflicting with the monkey patching done by the bullet gem. Fortunately bullet seems to have also switched over to use Module#prepend in flyerhzm/bullet@57c3335 which hasn't been released yet. Two questions:

  1. Does the problem go away if you remove bullet gem?
  2. If the answer to 1 is yes, does the problem go away if you use the latest commit of bullet from bullet's master branch?

@jturkel the problem goes away if I use bullet's latest commit on their master branch

had same issue - same fix worked. bullet still hasn't cut a new gem yet.

I'm also having this problem. Removing bullet gem fixes the problem, but using the latest commit doesn't

gem 'bullet', :github => 'flyerhzm/bullet', :ref => '4b9bff567e1c0bcfeb507fce1290a907b46c22b8'

@echan00 - that's the same revision we're on

yes it does

The githhub reference does not work for me:

goldiloader (2.0.1)
bullet (5.6.1)
rails (4.2.8)

bullet initializer:

if Rails.env.development?
  Rails.application.config.after_initialize do
    Bullet.enable = true
    Bullet.alert = false
    Bullet.bullet_logger = true
    Bullet.console = true
    Bullet.rails_logger = true
  end
end

@spodlecki - Can you paste your Gemfile.lock?

On a somewhat related note, what's the motivation for using Bullet since Goldiloader should be handling eager loading for you?

Maybe we can close that due to the lack of activity?

Closing due to inactivity. Please reopen this if this still reproduces with the latest version of bullet.