[Catalyst] flash with DBIC session storage

J. Shirley jshirley at gmail.com
Fri Jul 27 19:38:17 GMT 2007


On 7/27/07, Tobias Kremer <list at funkreich.de> wrote:
> 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
>

MyISAM cannot do row level locking, so the only alternative is table
locking on writes.  So, what happens is you'll have two concurrent
write requests with the same session key and they'll clobber each
other.

The session table really really really should be InnoDB.  MyISAM is
very poorly suited for such activities.  As a general rule of thumb, I
tend to always say that unless you know why you should be using
MyISAM, you should use InnoDB.

Good luck with it though :)

-Jay
-- 
J. Shirley :: jshirley at gmail.com :: Killing two stones with one bird...
http://www.toeat.com



More information about the Catalyst mailing list