[Catalyst] Session duplicate key constraints on concurrent requests

Janne Snabb snabb at epipe.com
Mon Oct 10 11:53:26 GMT 2011

On Mon, 10 Oct 2011, Tobias Kremer wrote:

> So, isn't the use of find_or_create() just plain wrong or am I seeing
> things here? :)

I have been thinking also that the correct solution might be as
simple as to just replace find_or_create() with find(), but I have
not managed to have a look at upper layers how exactly the session
store methods are being invoked... thus I am not sure.

In the case of 2 simultaneous connections with an expired session
cookie (which is now triggering the SQL constraint issue), both
connections would get a new session, but the browser would get to
decide which one it will hold on to, and which one will be forgotten
and eventually also expired from the server. I think the browser
will hold on to the session that it receives later.

Janne Snabb / EPIPE Communications
snabb at epipe.com - http://epipe.com/

More information about the Catalyst mailing list