# CookieOverflow - 4k Session?

**URL:** <https://www.ruby-forum.com/t/cookieoverflow-4k-session/142593>\
**Category:** Rails\
**Created:** [July 9, 2008, 3:39pm UTC](https://www.ruby-forum.com/t/cookieoverflow-4k-session/142593 "2008-07-09T15:39:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [July 9, 2008, 3:39pm UTC](https://www.ruby-forum.com/t/cookieoverflow-4k-session/142593/1 "2008-07-09T15:39:32Z")

</div>

Hello all,

I get the following error when I stuff my seesion with more than 4k of  
data.

CGI::Session::CookieStore::CookieOverflow

My problem is that I obviously need a fatter session.  
How do other users by-pass the 4k restriction on session variables?

Regards,

John

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [July 9, 2008, 3:42pm UTC](https://www.ruby-forum.com/t/cookieoverflow-4k-session/142593/2 "2008-07-09T15:42:36Z")

</div>

On 9 Jul 2008, at 14:37, removed\_email\_address@domain.invalid wrote:

> 

Don’t use the cookie store (which is limited by the fact that cookies  
should not be \> 4k)

Fred

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [July 9, 2008, 3:46pm UTC](https://www.ruby-forum.com/t/cookieoverflow-4k-session/142593/3 "2008-07-09T15:46:58Z")

</div>

On 9 Jul 2008, at 14:39, Frederick C. wrote:

> > CGI::Session::CookieStore::CookieOverflow
> > 
> > My problem is that I obviously need a fatter session.  
> > How do other users by-pass the 4k restriction on session variables?
> 
> Don’t use the cookie store (which is limited by the fact that  
> cookies should not be \> 4k)

And I should add that sticking lots of data in the session isn’t  
usually a great idea.

Fred

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [July 9, 2008, 3:51pm UTC](https://www.ruby-forum.com/t/cookieoverflow-4k-session/142593/4 "2008-07-09T15:51:24Z")

</div>

Frederick C. a Ã©crit, le 07/09/2008 03:44 PM :

> > Don’t use the cookie store (which is limited by the fact that  
> > cookies should not be \> 4k)
> 
> And I should add that sticking lots of data in the session isn’t  
> usually a great idea.

Indeed, in most cases replacing AR objects with their ids is enough.  
There are cases where that isn’t enough though (like storing a long  
temporary list of ids in session) in this case you have the choice of  
storing whatever is too big locally (on disk or in DB) with a reference  
to it in the session but it may not be better than simply using the  
activerecord/memcache/… sessions. It depends on your actual use case.

Lionel
