FAQ
Hi,

The sessions are in a standard Oracle table in which the primary key is the session id and the session data is a blob. The session should be retrieving the correct data. I think we'd have noticed long before now if the data wasn't be committed properly. (Autocommit is on anyway.)

Under the original setup we delete the key for the javascript template after using it (eg $c->session->{javascript}->{template1}). This morning I removed the delete statement. The problem still occurred.

I dug a bit more and it seems that the session occasionally completely loses its javascript key. (Same session id.)

I reduced the number of fastcgi processes from 5 to 1 and the problem went away.

This may mean that the race condition doesn't show up with one process.

However it may mean that the processes don't coordinate properly.

Should we have done something to make the session handling more sophisticated when we increased the number of fastcgi processes? For example do we have to do something explicit to lock a particular session to a particular process?

Regards

Duncan


-----Original Message-----
From: Andrew Rodland
Sent: 29 March 2011 19:33
To: The elegant MVC web framework
Subject: Re: [Catalyst] Force the session to be saved.
On Tuesday, March 29, 2011 12:46:32 PM Duncan Garland wrote:
Hi,

We've been having some peculiar behaviour from our system. I think it's
because the controller which produces the HTML page stores data in the
session for retrieval by the controller which produces the associated
javascript file.

The client begins processing the HTML page as soon as it starts to arrive.
When it reaches the script tag it requests the javascript page.
Occasionally the first controller hasn't written the session to the
database when the javascript controller tries to retrieve it.
(Catalyst::Plugin::Session::Store::DBIC).

I can move the script tag down the page a bit, but what I really need is a
way to force the session to be written before the HTML template is
rendered.

Something like:

$c->session->{javascript}->{$template} = { one = 1, two => 2};
$c->session->save;

Is there such a method?

Regards

Duncan
finalize_session (which writes the session to the DB) runs before
finalize_body (which writes the response to the client), so Catalyst already
does what you would like it to, and forcing a session write before running the
view is unlikely to help anything. I suspect either your database isn't
guaranteeing ordering, or the problem is somewhere other than where you're
looking.

Andrew

_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 8 of 9 | next ›
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedMar 29, '11 at 5:46p
activeApr 11, '11 at 6:49p
posts9
users6
websitecatalystframework.org
irc#catalyst

People

Translate

site design / logo © 2021 Grokbase