# Too many SESSIONS?

**URL:** <https://www.ruby-forum.com/t/too-many-sessions/65190>\
**Category:** Rails\
**Created:** [August 16, 2006, 7:02pm UTC](https://www.ruby-forum.com/t/too-many-sessions/65190 "2006-08-16T19:02:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![masonkessinger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/4da419/32.png) [@masonkessinger](https://www.ruby-forum.com/u/masonkessinger)\
**Post date:** [August 16, 2006, 7:02pm UTC](https://www.ruby-forum.com/t/too-many-sessions/65190/1 "2006-08-16T19:02:32Z")

</div>

I just notices my app was down, and in the log file were lots of these:

No space left on device -  
…/config/…/tmp/sessions//ruby\_sess.898b1cf95e14f8e3

So i figured that i had too many sessions. I went through and deleted  
the sessions and then in a few minutes, the site was back up again.

Can anyone explain this?

Did I do the right thing?

Is there a way I can tell my app to accept more sessions? clean up after  
Xmb?

thanks!

mk

---

<div class="post-metadata">

**Author:** ![masonkessinger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/4da419/32.png) [@masonkessinger](https://www.ruby-forum.com/u/masonkessinger)\
**Post date:** [August 16, 2006, 7:36pm UTC](https://www.ruby-forum.com/t/too-many-sessions/65190/2 "2006-08-16T19:36:36Z")

</div>

A simple cron job to keep the tmp/sessions in order should do the trick.

Chris

---

<div class="post-metadata">

**Author:** ![masonkessinger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/4da419/32.png) [@masonkessinger](https://www.ruby-forum.com/u/masonkessinger)\
**Post date:** [August 16, 2006, 7:42pm UTC](https://www.ruby-forum.com/t/too-many-sessions/65190/3 "2006-08-16T19:42:37Z")

</div>

On 8/16/06, Chris R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > Is there a way I can tell my app to accept more sessions? clean up after  
> > Xmb?

[http://www.realityforge.org/articles/2006/03/01/removing-stale-rails-sessions](http://www.realityforge.org/articles/2006/03/01/removing-stale-rails-sessions)

I followed what this person did, but changed the time to 1 day instead  
of twenty minutes.

---

<div class="post-metadata">

**Author:** ![masonkessinger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/4da419/32.png) [@masonkessinger](https://www.ruby-forum.com/u/masonkessinger)\
**Post date:** [August 16, 2006, 8:48pm UTC](https://www.ruby-forum.com/t/too-many-sessions/65190/4 "2006-08-16T20:48:43Z")

</div>

Mason K. wrote:

> Is there a way I can tell my app to accept more sessions? clean up after  
> Xmb?

Here’s a script I wrote that you can hook right into your code:

[http://alevans.com/dl/session\_cleanup-0.3.0.tgz](http://alevans.com/dl/session_cleanup-0.3.0.tgz)

You just put it into the lib directory, find a place in your code to  
call it where a second or two extra won’t matter, set the calling  
frequency and maximum session age, and it will clean up stale sessions  
every X hours. Optionally, it will even call back with the data from  
each session, in case you need to do anything with it (other cleanup,  
etc.).

–Al Evans

---

<div class="post-metadata">

**Author:** ![masonkessinger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/4da419/32.png) [@masonkessinger](https://www.ruby-forum.com/u/masonkessinger)\
**Post date:** [August 17, 2006, 1:28am UTC](https://www.ruby-forum.com/t/too-many-sessions/65190/5 "2006-08-17T01:28:18Z")

</div>

Switch to ActiveRecord sessions, and eliminate this problem  
and get a speed boost as well.

---

<div class="post-metadata">

**Author:** ![masonkessinger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/4da419/32.png) [@masonkessinger](https://www.ruby-forum.com/u/masonkessinger)\
**Post date:** [August 18, 2006, 3:11pm UTC](https://www.ruby-forum.com/t/too-many-sessions/65190/6 "2006-08-18T15:11:29Z")

</div>

Tom M. wrote:

> Switch to ActiveRecord sessions, and eliminate this problem  
> and get a speed boost as well.

Yes! Details on changing to the ActiveRecord Store are here:  
[http://wiki.rubyonrails.com/rails/pages/HowtoChangeSessionStore](http://wiki.rubyonrails.com/rails/pages/HowtoChangeSessionStore)

But make sure you intermittently remove THOSE stale sessions out of the  
database - they aren’t cleaned automatically:  
[http://www.realityforge.org/articles/2006/03/01/removing-stale-rails-sessions](http://www.realityforge.org/articles/2006/03/01/removing-stale-rails-sessions)
