Anyone experience problems with mongrel and sessions?

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

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

http://mongrel.rubyforge.org/
http://www.railsmachine.com/ – Need Mongrel support?

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