CookieOverflow errors while using DB cookie store

Hello all,

Using Edge Rails, SQLite development database on OSX. I'm receiving CookieOverflow errors in my application while using the AR cookie store. Tested in both Safari and Firefox, same error, although sporadically (I can't reliably reproduce the error in the same part of my application, seems to occur all over). The thing is, this is after clearing the browser cache in both Safari and FF, and Web Development addon for FF confirms that there isn't even a session cookie being stored, just a 500 Failsafe error from Rails. Also, the obvious: tried stopping/starting the server multiple times, even wiped out the database and ran migrations from scratch.

The trace is below, but not very helpful. Has anyone else ran into a problem like this using the DB cookie store, and/or know how to fix it?

Thanks for your time, Brady brady@lunardawn.ca

Rails Trace: ------------- Processing VoteController#index (for 127.0.0.1 at 2008-12-12 00:41:24) [GET]   Parameters: {"action"=>"index", "controller"=>"vote", "key"=>"2342"}

CGI::Session::CookieStore::CookieOverflow (CGI::Session::CookieStore::CookieOverflow):   /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ 1.8/cgi/session.rb:324:in `close'

Rendered rescues/_trace (93.7ms) Rendered rescues/_request_and_response (6.3ms) Rendering rescues/layout.erb (internal_server_error) /!\ FAILSAFE /!\ December 12, 2008 12:41 AM   Status: 500 Internal Server Error   CGI::Session::CookieStore::CookieOverflow     /Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ session/cookie_store.rb:111:in `close'     /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ ruby/1.8/cgi/session.rb:324:in `close'     /Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ base.rb:1300:in `close_session'     /Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ base.rb:1328:in `process_cleanup_without_session_management_support'     /Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ session_management.rb:137:in `process_cleanup'     /Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ base.rb:523:in `process_without_filters'     /Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ filters.rb:606:in `process_without_session_management_support'     /Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ session_management.rb:127:in `process'     /Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ rescue.rb:63:in `process_with_exception'     /Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ dispatcher.rb:131:in `failsafe_rescue'     /Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ dispatcher.rb:65:in `dispatch_unlocked'     /Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ dispatcher.rb:76:in `dispatch'     /Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ dispatcher.rb:75:in `synchronize'     /Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ dispatcher.rb:75:in `dispatch'     /Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ dispatcher.rb:93:in `_call'     /Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ dispatcher.rb:57:in `initialize'     /Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ failsafe.rb:11:in `call'     /Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ failsafe.rb:11:in `call'     /Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ dispatcher.rb:87:in `call'     /Users/Crash/website/vendor/rails/railties/lib/rails/rack/ static.rb:27:in `call'     /Users/Crash/website/vendor/rails/railties/lib/rails/rack/ logger.rb:14:in `call'     /Library/Ruby/Gems/1.8/gems/rack-0.4.0/lib/rack/handler/mongrel.rb: 59:in `process'     /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client'     /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each'     /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process_client'     /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'     /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize'     /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new'     /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'     /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize'     /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new'     /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run'     /Library/Ruby/Gems/1.8/gems/rack-0.4.0/lib/rack/handler/mongrel.rb: 32:in `run'     /Users/Crash/website/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

Hello all,

Using Edge Rails, SQLite development database on OSX.

Are you trying to store lots of stuff in the session ?

Fred

I am storing two small model instances in the session, but that shouldn't be a problem since (as far as I know) there isn't a data limit when storing sessions in the database.

Also, the problem happens even when the browser session is cleared, so no session exists yet, and (obviously) no data is stored in the session.

-Brady

I am storing two small model instances in the session, but that shouldn't be a problem since (as far as I know) there isn't a data limit when storing sessions in the database.

They're not being stored in the database. You're using the cookie
store which stores data in a cookie, which is limited to 4k (and since
that data is base64 encoded that gives you roughly 3k tops)

Also, the problem happens even when the browser session is cleared, so no session exists yet, and (obviously) no data is stored in the session.

The implication would be that on that first request you're putting
enough in the session to breach the limit

Fred

Thanks for the reply Fred!

Any idea then why it would switch to using the cookie store? Session data in general for the app is being stored/accessed from the database using AR.

From environment.rb:   config.action_controller.session = {     :session_key => '_myapp_session',     :secret => '<some long secret key>'   } config.action_controller.session_store = :active_record_store

From production.rb: config.action_controller.session = { :session_secure => true } config.action_controller.session_store = :active_record_store

The only session related code I have in this particular controller that seems to be giving me grief is this line: session :session_secure => false, :if => Proc.new { |request| ! request.ssl? }

This is so that cookies are marked as secure only if SSL is being used in the production environment, and I'm assuming this line would have no affect in development, which is where I'm running into this issue.

Any ideas?

-Brady