[Catalyst] Duplicate session problem?

Tomas Doran bobtfish at bobtfish.net
Sun Jul 6 12:05:41 BST 2008


On 5 Jul 2008, at 22:21, Dr. Jennifer Nussbaum wrote:

> Now that i got my authentication routines working, im running into
> another problem.
>
> Anything i do, i am getting elaborate "duplicate session" errors;  
> in my error
> log they show up as things like:
>
> DBI Exception: DBD::mysql::st execute failed: Duplicate entry  
> 'session:12a7c108ba07843441d5bed0' for key 1 [for Statement "INSERT  
> INTO sessions (id) VALUES (?)" with ParamValues: 0='session: 
> 12a7c108ba07843441d5bed0467e3398a8e7c3f1'] at /usr/share/perl5/DBIx/ 
> Class/Schema.pm line 954
>
> This happens just about constnatly. Im the only one using the system,
> its just for testing now, so i dont expect any collisions.

<snip>

The generated session ID should be randomly generated. The above  
would suggest that either:

You've created a sub in MyApp.pm who's name conflicts with something  
in the session generation code, and so you're returning a fixed  
answer, instead of a changing value, then I'd guess this would happen..

Looking at: http://search.cpan.org/src/NUFFIN/Catalyst-Plugin- 
Session-0.19/lib/Catalyst/Plugin/Session.pm

If you were to define a 'sub session_hash_seed' in MyApp.pm which  
returned a fixed string - you'd get sessions which always had the  
same key...

This namespace issue is why you're meant to put your root actions &  
etc in Catalyst::Controller::Root...

> Has anyone else seen this, or have a suggestion for how to solve?
>

My first suggestion about how to solve would be to work out exactly  
what the call stack is when you get to this point.

If you set RaiseError => 1 in your DBI dsn and run Catalyst in debug  
mode, then you'll get a stack trace out, which should start to point  
us in the right direction. Can you also give us the complete list of  
plugins your app is loading, and confirm if you do have any subs  
defined in the root MyApp.pm...

Cheers
t0m




More information about the Catalyst mailing list