":database_manager =>CGI::Session::MemoryStore" doesn't work

Hi,

We are try to use the “database_manager
=>CGI::Session::MemoryStore” for the session
management. our website has a lot of “redirect_to”.
while the website is running under webrick, everything
is fine. But when we run the system under
aprache/fcgi. the redirect_to seems doesn’t work
anymore with the option “MemoryStore”

does anyone have the same problem, or have any idea
about this???

Thanks you very much!!!

Saiho

The mind is its own place, and in itself.
Can make a Heaven of Hell, a Hell of Heaven.


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around

On 6/7/06, Saiho Y. [email protected] wrote:

MemoryStore is local to the ruby process. So if you have more than one
fcgi listener, you will have separate MemoryStores for each process,
which will generally break applications that use sessions. The only
time MemoryStore is workable is if you are using Webrick or
fcgi/scgi/mongrel with a single listener, which is generally not the
case in production. Try one of the other session storage options.

Jeremy

Hi Jeremy,

First, thanks you very much for the information!!!

However, in our case, we have a hugh object stored in
the session variable, since each time we receive a
html request, rails will serialize and deserialize the
session obj. It is a very time consumming task.

We have take a look on the session storage option, the
only one (we find) which does not serialize object is
the memoryStore…

Does it exist another way that will not serializes the
session object???

Thanks you very much

Saiho

— Jeremy E. [email protected] wrote:

sessions. The only
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

The mind is its own place, and in itself.
Can make a Heaven of Hell, a Hell of Heaven.


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around

On Thu, 2006-06-08 at 08:16 -0700, Saiho Y. wrote:

Hi Jeremy,

First, thanks you very much for the information!!!

However, in our case, we have a hugh object stored in
the session variable, since each time we receive a
html request, rails will serialize and deserialize the
session obj. It is a very time consumming task.

You probably are coming from Java where you would just store an object
in the session temporarily as you worked on it. Correct?

We have take a look on the session storage option, the
only one (we find) which does not serialize object is
the memoryStore…

Does it exist another way that will not serializes the
session object???

Yes, don’t store anything in the session store. Store the object in the
database just like normal, even though it’s “partially built”. Keep a
field of this object to indicate it’s “stage” or “state” so that if
someone stops half through you can continue where they left off.

Then, the only thing you really could store in the session is an integer
indicating what object they are working on at that moment.


Zed A. Shaw

http://mongrel.rubyforge.org/

On 6/8/06, Saiho Y. [email protected] wrote:

session object???
The only thing I can think of that would allow you to share memory
between processes and not serialize session objects is to create a new
session store type using SystemVIPC’s SharedMemory class [1] or mmap
[2]. That may work if all processes are on the same Unix/Linux/BSD
machine. I’m guessing it will require a C extension, if not changes
to the ruby interpreter itself, because of memory layout and garbage
collection issues. See POSH [3] for an example of a Python extension
that does something similar to what I am talking about.

IMO, it is probably a better idea to rearchitect your application so
that serialization isn’t an issue. Or you could try fixing Rails so
that it is thread safe, so you could use one process to serve multiple
requests. Both would probably be easier than trying to get multiple
ruby processes to share objects in memory without serialization.

Jeremy

[1] http://deisui.org/~ueno/ruby/sysvipc.html
[2] http://moulon.inra.fr/ruby/mmap.html
[3] http://poshmodule.sourceforge.net/

Thanks you very much for the information:)!!!

— Jeremy E. [email protected] wrote:

only one (we find) which does not serialize object
is to create a new
that does something similar to what I am talking
ruby processes to share objects in memory without
http://lists.rubyonrails.org/mailman/listinfo/rails

The mind is its own place, and in itself.
Can make a Heaven of Hell, a Hell of Heaven.


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around

Hi Zed,

Thanks for the information:)!!!

You probably are coming from Java where you would
just store an object
in the session temporarily as you worked on it.
Correct?

yes:)

session is an integer
indicating what object they are working on at that
moment.

I wonder if I store the session obj in the a database,
presently, I change the storage mode to
ACtiveRecordStore, I wonder if the data is serialize
then put into the field, or it is in binaire mode???

do you have a guess?

Thanks you very much again:)

Saiho

The mind is its own place, and in itself.
Can make a Heaven of Hell, a Hell of Heaven.


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around