rails/rails — Issue #4773: stack level too deep (ActionDispatch+ActiveSupport)
Author: dnagir
Created: 2012-01-31 02:41:44+00:00
State: open

The rails app raises:

```
Started GET "/user_session/sign_in" for 127.0.0.1 at 2012-01-31 13:31:08 +1100
Processing by UserSessionsController#new as HTML
Completed 500 Internal Server Error in 33ms

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

Rendered /Users/dnagir/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.2.1/lib/action_dispatch/middleware/templates/rescues/_trace.erb (0.9ms)
Rendered /Users/dnagir/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.2.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.8ms)
Rendered /Users/dnagir/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.2.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (3.3ms)
```

This does *not* happen in `development` or `test` environment, only when running in `production`, `staging` (custom) environments.

The error above happens when the `config/environments/production.rb` and `config/environments/development.rb` are exactly the same.

If I rest the `config/environments/production.rb` to the *default*, the the error is way much worse:

```
Started GET "/user_session/sign_in" for 127.0.0.1 at 2012-01-31 13:40:27 +1100
Processing by UserSessionsController#new as HTML
Completed 500 Internal Server Error in 3ms

SystemStackError (stack level too deep):
activesupport (3.2.1) lib/active_support/callbacks.rb:409
```

I'm not sure where the issue is. I tried to put the gems into the default group but that doesn't help.

Whatever is wrong in the app, it should not throw a stack overflow exception which gives no valuable information whatsoever.

Any thoughts/workarounds/fixes?