cookie overflow

I am collecting information to be sent to a print routine that ultimately uses prawn to generate a PDF.

It writes an error to the logs...

Completed in 4304ms (View: 1, DB: 102) | 200 OK [https://myserver/payables/print_the_checks\] /!\ FAILSAFE /!\ Wed Sep 30 18:41:52 -0700 2009   Status: 500 Internal Server Error   ActionController::Session::CookieStore::CookieOverflow     /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/session/cookie_store.rb:102:in `call'

though my session variables themselves are not very large, the 'POST' is fairly large.

Do I need to discard some of the data that I've already accrued in instance variables and re-acquire the data in my controller to shrink the amount I 'POST' ? Would that help with the CookieOverflow ? Is it possible to increase the size permitted ?

Craig

Craig White wrote:

Do I need to discard some of the data that I've already accrued in instance variables and re-acquire the data in my controller to shrink the amount I 'POST' ? Would that help with the CookieOverflow ? Is it possible to increase the size permitted ?

Cookies have a maximum size of 4K. That's how they were implemented and it has nothing to do with Rails. I suspect some object might be getting stored in your session. I would start by trying to track down exactly what is getting stored in the session cookie. If you must store more than 4K in your session then you'll need to change from the default session storage to one of the other options. But, you should first try to figure out why your session is larger than 4K and see if you can work around that.

A common problem is storing ActiveRecord objects in the session rather than just storing the id and looking up the ActiveRecord object on each request. Don't worry Rails should cache the SQL so it shouldn't be too much of a performance hit.

Craig White wrote: > Do I need to discard some of the data that I've already accrued in > instance variables and re-acquire the data in my controller to shrink > the amount I 'POST' ? Would that help with the CookieOverflow ? Is it > possible to increase the size permitted ?

Cookies have a maximum size of 4K. That's how they were implemented and it has nothing to do with Rails. I suspect some object might be getting stored in your session. I would start by trying to track down exactly what is getting stored in the session cookie. If you must store more than 4K in your session then you'll need to change from the default session storage to one of the other options. But, you should first try to figure out why your session is larger than 4K and see if you can work around that.

A common problem is storing ActiveRecord objects in the session rather than just storing the id and looking up the ActiveRecord object on each request. Don't worry Rails should cache the SQL so it shouldn't be too much of a performance hit.