This project is archived and is in readonly mode.
reset_session causes rack exception if session blank
Reported by Wincent Colaiuta | March 1st, 2009 @ 07:59 PM
I had a controller action in 2.2.2 which contained "reset_session":
def destroy
reset_session
end
Now in 2.3.0 RC1 that line bails with a lengthy stack trace:
/!\ FAILSAFE /!\ Sun Mar 01 20:35:31 +0100 2009
Status: 500 Internal Server Error
You have a nil object when you didn't expect it!
The error occurred while evaluating nil.data=
/Users/wincent/trabajo/unversioned/wincent.com/src/vendor/rails/activerecord/lib/active_record/session_store.rb:300:in `set_session'
/Users/wincent/trabajo/unversioned/wincent.com/src/vendor/rails/activerecord/lib/active_record/base.rb:1454:in `silence'
/Users/wincent/trabajo/unversioned/wincent.com/src/vendor/rails/activerecord/lib/active_record/session_store.rb:298:in `set_session'
/Users/wincent/trabajo/unversioned/wincent.com/src/vendor/rails/actionpack/lib/action_controller/session/abstract_store.rb:116:in `call'
/Users/wincent/trabajo/unversioned/wincent.com/src/vendor/rails/actionpack/lib/action_controller/failsafe.rb:11:in `call'
/Users/wincent/trabajo/unversioned/wincent.com/src/vendor/rails/actionpack/lib/action_controller/rack_ext/lock.rb:15:in `call'
/Users/wincent/trabajo/unversioned/wincent.com/src/vendor/rails/actionpack/lib/action_controller/rack_ext/lock.rb:15:in `synchronize'
/Users/wincent/trabajo/unversioned/wincent.com/src/vendor/rails/actionpack/lib/action_controller/rack_ext/lock.rb:15:in `call'
/Users/wincent/trabajo/unversioned/wincent.com/src/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:83:in `call'
/Users/wincent/trabajo/unversioned/wincent.com/src/vendor/rails/railties/lib/rails/rack/static.rb:27:in `call'
/Users/wincent/trabajo/unversioned/wincent.com/src/vendor/rails/railties/lib/rails/rack/log_tailer.rb:17:in `call'
/Library/Ruby/Gems/1.8/gems/rack-0.9.1/lib/rack/handler/mongrel.rb:59:in `process'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:159:in `process_client'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:158:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:158:in `process_client'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:285:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:285:in `initialize'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:285:in `new'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:285:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:268:in `initialize'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:268:in `new'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:268:in `run'
/Library/Ruby/Gems/1.8/gems/rack-0.9.1/lib/rack/handler/mongrel.rb:32:in `run'
/Users/wincent/trabajo/unversioned/wincent.com/src/vendor/rails/railties/lib/commands/server.rb:100
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
script/server:3
Workaround is:
def destroy
reset_session unless session.blank?
end
Currently trying to come up with a minimal test case to reproduce.
Comments and changes to this ticket
-
Wincent Colaiuta March 1st, 2009 @ 08:09 PM
Ok, here are the repro instructions:
Create a new app:
rails ticket2108 cd ticket2108
Create a demo scaffold:
script/generate scaffold Yadda
Turn on ActiveRecord session store by uncommenting this line in config/initializers/session_store.rb:
# ActionController::Base.session_store = :active_record_store
Insert "reset_session" in a controller action; for example, in app/controllers/yaddas_controller.rb:
def index reset_session # ... etc
Fire up the server:
script/server
Now visit http://localhost:3000/yaddas and watch things go boom.
-
josh March 2nd, 2009 @ 01:39 AM
- Assigned user set to josh
-
josh March 3rd, 2009 @ 06:35 PM
- Milestone cleared.
-
Repository March 3rd, 2009 @ 07:07 PM
- State changed from new to resolved
(from [9b1b88f09cf1498f04e1cd469d0d5ffccf2b93cc]) Fixed reset_session for ActiveRecord session store [#2108 state:resolved] http://github.com/rails/rails/co...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Referenced by
- 2108 reset_session causes rack exception if session blank (from [9b1b88f09cf1498f04e1cd469d0d5ffccf2b93cc]) Fixed r...