[Catalyst] Session duplicate key constraints on concurrent requests

Janne Snabb snabb at epipe.com
Sat Oct 8 12:23:13 GMT 2011


On Sat, 8 Oct 2011, Janne Snabb wrote:

>     return $self->model->find_or_create({ $self->id_field => $key })

Just an update:

I discussed about this with mst on irc and we concluded that my
initial suggestion for the fix is also not correct. It is likely
to eliminate the SQL error but also likely to cause spurious behaviour
in the upper layers.

The upper layer (which I have not looked at, is there a call/inheritance
graph of Catalyst available somewhere? :) should get notified that
the old session is gone, thus we can not just autovivify it in the
storage with the old id. Rather a new id should be issued so that
the upper layers will have a chance of noticing what happened. I
think that would also eliminate the collisions (as the new id is a
new random string).

*::Session::Storage::Cache::* is presumambly a better choice than
DBI/DBIC in the usual case.

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



More information about the Catalyst mailing list