active_record_store mysterious failures

I switched from using the filesystem to active_record_store for session
and some users of my site started getting this error:

Application error
Change this error message for exceptions thrown outside of an action
(like in Dispatcher setups or broken Ruby code) in public/500.htm

Here is the weird part. This only happens for some users and once a
user gets this error they will continue getting it on every page they
try to go to. If they delete their cookie, i.e. get a new session, they
can browse the site again. But, once they get the error again they'll
have it on every page. If i switch the sessions back to the fs all is
fine. Go back to active_record_store and it happens again.

The worst part is that there is NOTHING in the log files. Anyone have
any ideas of what could be wrong or at least how I can get a stack
trace or a log of the error.

Are you storing data in the users' sessions? Because it sounds like
incomplete/incorrect data is being stored in the session. That's why
deleting the cookie fixes it: they get a fresh new session.

If it happens to you, you could look up your cookie's ID and inspect
the corresponding to see what's in it. You should be
able to read what's been saved in there, because it's stored in YAML

Are you using shared hosting? I know with my provider (Dreamhost) they
have a daemon that goes through and kills long-running processes. That
sort of thing is a common cause of problems.

-- Urbanus

it's on a our own server and yes we're storing data in the session.
Inspecting it is not so easy. We have many thousands of sessions in a
matter of a couple of hours and the error only happens for some users.
Since there is no log of the error I have no way of knowing which
sessions are failing unless I can duplicate it and I usually can't :frowning: