[BULK] - Re: [Catalyst] flash with DBIC session storage

Mesdaq, Ali amesdaq at websense.com
Fri Jul 27 19:49:44 GMT 2007


I believe this may be an issue with DBIx and multiple inserts from
different processes. This is something we have seen when we created our
own db abstraction layer. When you have a unique key constraint you we
saw that it was possible to check the table for that key and if it
doesn't exist to insert it and return the id. But if another process was
doing the same thing (checking for it and not finding it and inserting)
you would get a collision on the constraint. So our solution was to wrap
the call so that on insert if we saw that exact error we would reselect
from that table with that constraint and return the id.  

I believe you will have this issue with any DB that enforces that
constraint with multiple processes running with medium to high load.
This load test probably would be the ideal place to see this error since
its probably using same session id's for various requests.

Thanks,
------------------------------------------
Ali Mesdaq
Security Researcher II
Websense Security Labs
http://www.WebsenseSecurityLabs.com
------------------------------------------

-----Original Message-----
From: Tobias Kremer [mailto:list at funkreich.de] 
Sent: Friday, July 27, 2007 11:28 AM
To: The elegant MVC web framework
Subject: [BULK] - Re: [Catalyst] flash with DBIC session storage

Am 27.07.2007 um 20:14 schrieb J. Shirley:
> On 7/27/07, Tobias Kremer <list at funkreich.de> wrote:
>> While hammering my site with ab (Apache bench) I'm getting loads of 
>> the the following error message:
>> Couldn't render template "undef error -
>> DBIx::Class::ResultSet::find_or_create(): DBI Exception:
>> DBD::mysql::st execute failed: Duplicate entry 
>> 'flash:4f1bddce6c7828c27b2e47265f614109d4c21f19'
>> for key 1 [for Statement "INSERT INTO sessions (id) VALUES (?)"
>> with ParamValues: 0='flash:4f1bddce6c7828c27b2e47265f614109d4c21f19']
>> at /usr/local/lib/perl5/site_perl/5.8.8/Catalyst/Plugin/
>> Session/Store/DBIC/Delegate.pm line 52"
>
> What's your backend RDBMS?  Not using MyISAM or something similarly 
> silly, right?

Indeed, I'm using MySQL + MyISAM but I've never come across this problem
before.

Is this some sort of locking issue and I've no choice but switch to
InnoDB?

--Tobias





_______________________________________________
List: Catalyst at lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive:
http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/



More information about the Catalyst mailing list