Skip to content
This repository

"SystemStackError: stack level too deep" since 3.0.3 #260

Open
rfc2822 opened this Issue June 05, 2011 · 16 comments
rfc2822

I have a standard authlogic configuration like in the tutorial. From version 3.0.3, I get

SystemStackError: stack level too deep

but only in the production mode. I can reproduce it with:

RAILS_ENV=production rails c
Authlogic::Session::Base.controller = Authlogic::ControllerAdapters::RailsAdapter.new(self)
p = MyModelsSession.find

SystemStackError: stack level too deep
from /my/project/vendor/bundler/ruby/1.8/gems/activesupport-3.0.8.rc4/lib/active_support/core_ext/class/attribute.rb:73:in acts_as_authentic_config'
from /my/project/vendor/bundler/ruby/1.8/gems/authlogic-3.0.3/lib/authlogic/session/foundation.rb:21:in
rw_config'
from /my/project/vendor/bundler/ruby/1.8/gems/authlogic-3.0.3/lib/authlogic/session/foundation.rb:22:in rw_config'
from /my/project/vendor/bundler/ruby/1.8/gems/authlogic-3.0.3/lib/authlogic/session/password.rb:90:in
login_field'
from /my/project/vendor/bundler/ruby/1.8/gems/authlogic-3.0.3/lib/authlogic/session/password.rb:213:in login_field'
from /my/project/vendor/bundler/ruby/1.8/gems/authlogic-3.0.3/lib/authlogic/session/password.rb:118:in
initialize'
from /my/project/vendor/bundler/ruby/1.8/gems/authlogic-3.0.3/lib/authlogic/session/activation.rb:48:in initialize'
from /my/project/vendor/bundler/ruby/1.8/gems/authlogic-3.0.3/lib/authlogic/session/klass.rb:64:in
initialize'
from /my/project/vendor/bundler/ruby/1.8/gems/authlogic-3.0.3/lib/authlogic/session/scopes.rb:79:in initialize'
from /my/project/vendor/bundler/ruby/1.8/gems/authlogic-3.0.3/lib/authlogic/session/persistence.rb:37:in
new'
from /my/project/vendor/bundler/ruby/1.8/gems/authlogic-3.0.3/lib/authlogic/session/persistence.rb:37:in `find'
from (irb):2

Can you please audit /my/project/vendor/bundler/ruby/1.8/gems/authlogic-3.0.3/lib/authlogic/session/foundation.rb:21 ff? Maybe there's a case when it causes an infinite loop? I think so.

Brent Sanders
pdkl95 commented June 05, 2011

I'm getting this issue as well. It took me the last day to even figure out it was a problem in authlogic, as the stack trace would just say "SystemStackError" with no useful data in it.

[I had just moved things to rvm, and thought it was related to that for most of the time]

I've now been able to isolate it specifically to the call to Session.find(), similar to the above. Now i guess it's time to digh through foundation.rb and see what's broken...

EDIT: ok, it seems that reverting lines 20-27 in foundation.rb fixes it, at least as a temporary workaround. I have yet to see if that has any other interactions.

Qichunren

I also got this.

Sasha Gerrand

Encountered this issue using Rails v3.0.8 and Authlogic v3.0.3. Reverting to Authlogic v3.0.2 fixed this issue for the time being.

rdj
rdj commented June 18, 2011

Agree, commit c569334 is the problem.

I have worked around with this in my Gemfile:

gem 'authlogic', :git => 'git://github.com/binarylogic/authlogic.git', :ref => '0297e1c005c626c1e37b'

This refs the commit right before the pull request from AndreasWurm was merged, and now my Rails3.1-rc4 seems to be working correctly.

zachlipton

Yep I just hit this too. Took me entirely too long to debug this to the point where I found this bug, as it came up in the context of other major refactoring. Would be great to get a fix in the next version, though I'm not comfortable enough with Rails 3.1 to dig into it myself.

Jared Haworth

I've just encountered this bug this evening on Rails 3.1.0rc5 and authlogic 3.0.3.

rdj

Just bumping to mention this problem still manifests when using the new 3.1.0 released rails gem with the 3.0.3 authlogic gem. Referencing 0297e1c directly from git is still a good workaround.

angelacode

I have the same problem...I will try referencing, thanks for putting the full code @rdj

Stephen Prater stephenprater referenced this issue from a commit in stephenprater/authlogic December 29, 2011
Stephen Prater fixes issues #260 41eba3d
keynan

Has this issue been fixed in a version that supports Rails 3.1 or 3.2

Tim Harvey tjh referenced this issue from a commit March 12, 2012
Commit has since been removed from the repository and is no longer available.
Yuri Albuquerque

The issue still happens on version 3.1, with Rails 3.2.

Trying to use the commit 0297e1c doesn't solve the problem, it gives a big error (related to the fact that 'inheritable_attributes' doesn't exist anymore).

Alexander Dmitriev

Yes, I have the problem too. To me, the bug is in rspec tests. I don't run on production yet.

Dave Sanders

Ran into this, this morning, trying to get a copy of my app setup on a windows server as a test. I've been running it in production on Heroku for months though without incident... Not sure if Heroku is dealing with it somehow though.

I tried the commit mentioned, but had the same problem as Denommus had.

CyborTronik

I had reproduced this in Authlogic 3.1.0 and Rails 3.2.12

Ahmed El-Daly
aeldaly commented May 02, 2013

Any updates on this?

hayaidrift

After taking matters into my own hands, I've isolated the problem for me. If your crypted_password_field is "password", then you end up in an infinite loop. Please see this method for the details:

def password=(pass)
return if ignore_blank_passwords? && pass.blank?
before_password_set
@password = pass
send("#{password_salt_field}=", Authlogic::Random.friendly_token) if password_salt_field
send("#{crypted_password_field}=", crypto_provider.encrypt(*encrypt_arguments(@password, false, act_like_restful_authentication? ? :restful_authentication : nil)))
@password_changed = true
after_password_set
end

Blane Dabney

Still having this issue with Authlogic 3.1.3 and Rails 3.2.6 to 3.2.16. Oddly, it only happens on one of my controllers, that isn't functionally different from my other controllers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.