3

I only get this error in Development Environtment after editing some code (any code) and press Refresh to see the changes.

Everytime this happens it raises an error says "Stack Level Too Deep" then when I refresh the page it agains raise "Routing Error". Then I cannot browse any page until I restart the server.

I will have to stop Rails server then start it again, then it works until I make changes to the code again.

I tried several methods including increase ulimit "ulimit -s" command, but it didn't solve the problem. I searched that this is related to infinite loops but in my case it has nothing to do with the code because the error disappears after I restart the server.

Any clues or solutions would be highly appreciated. Thanks.

Edited: add routes.rb and stack trace

Routes: http://pastebin.com/YzXyUH35

Stack Trace:

SystemStackError (stack level too deep):
  actionpack (3.2.8) lib/action_dispatch/middleware/reloader.rb:70


  Rendered /Users/duy/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.5ms)
  Rendered /Users/duy/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.3ms)
  Rendered /Users/duy/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (19.9ms)
duy
  • 1,890
  • 4
  • 16
  • 20
  • May be the problem with your routes. can you list down here pls. – maximus ツ Dec 02 '12 at 07:27
  • I added the routes file and stack trace. Thanks – duy Dec 02 '12 at 07:56
  • Which route is causing the issues? – simonmorley Dec 02 '12 at 10:01
  • can you please paste the full application log, so that it is possible to figure out which controller is causing the trouble. May be some where you are unknowingly applying the infinite filter. – maximus ツ Dec 02 '12 at 13:26
  • Hi @simonmorley, it can be any routes, because it happen when I change any code and press Refresh on the browser. So as said, it is not code related – duy Dec 03 '12 at 08:24
  • Hi Sush, the trace is different because it is not code related, it happens whenever I change code and press Refresh to see the changes. it is a weird issue. Sorry. – duy Dec 03 '12 at 08:25
  • Are you running rails s with webrick? If you're sure it's not you're application code, have you tried using thin instead. Also, could you paste any changes to your initialisers or development configs. – simonmorley Dec 03 '12 at 08:45
  • Hi @simonmorly, I tried both Webrick & Thin and same errors generated. – duy Dec 03 '12 at 10:38

2 Answers2

1

Please change your session store to active record store or config.cache_store = :dalli_store (dalli gem), instead of cookie store.

Dorian
  • 22,759
  • 8
  • 120
  • 116
G SubbaRao
  • 456
  • 2
  • 16
  • I'm using Mongoid & Memcached with Dalli Gem. Thanks. – duy Dec 03 '12 at 10:39
  • 1
    have you seen this post http://stackoverflow.com/questions/10464793/what-is-the-right-way-to-override-a-setter-method-in-ruby-on-rails. It may be because of model method loop, so intially while loading model files itself they are giving (stack level too deep) error. – G SubbaRao Dec 03 '12 at 11:17
0

There was a bug in devise_inviable gem that caused the problem I got. I found the answer here helps solve my problem rails 3 routes stack level too deep devise

Community
  • 1
  • 1
duy
  • 1,890
  • 4
  • 16
  • 20