Forum: Ruby on Rails ":database_manager =>CGI::Session::MemoryStore" doesn't work

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
sayoyo S. (Guest)
on 2006-06-07 19:11
(Received via mailing list)
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.

http://www.geocities.com/sayoyo/

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Jeremy E. (Guest)
on 2006-06-07 19:46
(Received via mailing list)
On 6/7/06, Saiho Y. <removed_email_address@domain.invalid> 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
sayoyo S. (Guest)
on 2006-06-08 19:18
(Received via mailing list)
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. <removed_email_address@domain.invalid> wrote:

> >
> sessions.  The only
> removed_email_address@domain.invalid
> 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.

http://www.geocities.com/sayoyo/

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Jeremy E. (Guest)
on 2006-06-08 20:57
(Received via mailing list)
On 6/8/06, Saiho Y. <removed_email_address@domain.invalid> 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/
Zed S. (Guest)
on 2006-06-08 23:44
(Received via mailing list)
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://www.zedshaw.com/
http://mongrel.rubyforge.org/
sayoyo S. (Guest)
on 2006-06-09 18:12
(Received via mailing list)
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.

http://www.geocities.com/sayoyo/

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
sayoyo S. (Guest)
on 2006-06-09 18:47
(Received via mailing list)
Thanks you very much for the information:)!!!!!




--- Jeremy E. <removed_email_address@domain.invalid> 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.

http://www.geocities.com/sayoyo/

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
This topic is locked and can not be replied to.