# Anyone experience problems with mongrel and sessions?

**URL:** <https://www.ruby-forum.com/t/anyone-experience-problems-with-mongrel-and-sessions/101388>\
**Category:** Rails\
**Created:** [August 4, 2006, 5:24pm UTC](https://www.ruby-forum.com/t/anyone-experience-problems-with-mongrel-and-sessions/101388 "2006-08-04T17:24:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [August 4, 2006, 5:24pm UTC](https://www.ruby-forum.com/t/anyone-experience-problems-with-mongrel-and-sessions/101388/1 "2006-08-04T17:24:34Z")

</div>

I’ve moved an application that was running under apache2/fcgi to  
apache2/mongrel(mod\_proxy).

under the original setup i had no problems with sessions.

now under mongrel, the users are experiencing application errors.  
after looking at the logs, I am seeing that a piece of code that  
relies on a session variable is what is causing the error. It seems  
that the session variable no longer exists. If they log back in,  
thereby creating a new session, the problem goes away.

Just wondering if anyone has experienced this problem.

Chris

---

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [August 4, 2006, 6:57pm UTC](https://www.ruby-forum.com/t/anyone-experience-problems-with-mongrel-and-sessions/101388/2 "2006-08-04T18:57:44Z")

</div>

On Fri, 2006-08-04 at 11:24 -0400, Chris H. wrote:

> Just wondering if anyone has experienced this problem.

You most likely changed your code to use this in your sessions, and upon  
restart the users were missing it since they had older sessions.

Typically you have to store next to nothing in the rails sessions for  
this reason. Rails is really bad at how it manages its session state,  
so you have to store less and less in it. Any time you change your  
session usage you have to pretty much obliterate the whole session store  
(you should probably do this anyway).

If you used to work in Java (where the session store was a cheap  
database you put 2M bytes of data in) then you’ll have to adjust and  
store objects in the database and only small ruby native (Integer,  
String, etc.) objects in the session. Otherwise you’ll get bit by this  
and by object versioning problems.

–  
Zed A. Shaw

> **[Zed A. shaw](https://zedshaw.com/)**
>
> Personal essays and writings by Zed A. Shaw.

[http://mongrel.rubyforge.org/](http://mongrel.rubyforge.org/)  
[http://www.railsmachine.com/](http://www.railsmachine.com/) – Need Mongrel support?

---

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [August 7, 2006, 12:48pm UTC](https://www.ruby-forum.com/t/anyone-experience-problems-with-mongrel-and-sessions/101388/3 "2006-08-07T12:48:20Z")

</div>

Zed,

Thanks for the reply.

I don’t think this is the case, as the app was deployed on a  
completely different server, basically a fresh install. I’m using  
ActiverecordStore as the session mechanism and the sessions table was  
empty.

Either way, I didn’t see it happen again, so I’ll just put it on the  
back burner unless it comes up again.

On another note, I’m not seeing that mongrel is writing the pid file,  
even though I have specified it to in the config file.

:cwd: /srv/www/railsapps/rftrack  
:includes:

- mongrel  
:log\_file: log/mongrel.log  
:config\_script:  
:pid\_file: log/mongrel.pid  
:num\_processors: 1024  
:environment: production  
:group: webdev  
:docroot: public  
:user: mongrel  
:timeout: 0  
:host: 0.0.0.0  
:mime\_map:  
:port: “3010”  
:debug: false  
:daemon: true

any ideas? the log file is created/written to just fine, just not the  
pid file.

Chris
