[Catalyst] flash - Duplicate entries

Ian Docherty catalyst at iandocherty.com
Tue Sep 25 18:04:20 GMT 2007


Tobias Kremer wrote:
> After deploying our new Catalyst application I'm receiving this
> error quite often per day:
>
> "DBIx::Class::ResultSet::find_or_create(): DBI Exception:
> DBD::mysql::st execute failed: Duplicate entry
> 'flash:9b11b5354715b56c9395abdf21544e83db5b0814' for key 1
> [...] at /usr/local/lib/perl5/site_perl/5.8.8/Catalyst/Plugin/
> Session/Store/DBIC/Delegate.pm line 52"
>
> I'm using MySQL and I'm quite sure that this is _NOT_ a locking
> issue (or MySQL's fault as somebody on the list recently suggested)
> because the session stuff without the flash works perfectly.
>
> Any ideas what could be wrong here? Thanks!
>
> --Tobias
>
>   
Did I not see something on here, or on DBIx-class list some time ago to 
the effect that in find_or_create there is a short window where having 
found that a record does not exist it then creates it. I presume that 
two threads could each detect that a record does not exist and then one 
of them would create this error.

Reversing the order (try a create first, catch the error, then do a find 
if the create fails) was ISTR the proposed answer.

But this may not help you if the problem is in the 
Session/Store/DBIC/Delegate plugin.

Regards
Ian



More information about the Catalyst mailing list