Duplicate session problem?

View: New views
9 Messages — Rating Filter:   Alert me  

Duplicate session problem?

by Dr. Jennifer Nussbaum :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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.

Also, this is _only_ happening on the thing im working on that uses
the new auth routines--the older stuff works fine. Sessions seem to be
set up correctly--im using DBIC for my session storage. Im using
mysql, obviously.

The archives show one other discussion of this, last year, in relation
to flash, but there was no real solution posted.

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

Thanks again,

Jen


     

_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: Duplicate session problem?

by Tobias Kremer-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 05.07.2008, at 23:21, Dr. Jennifer Nussbaum wrote:
> 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.


I'm seeing this error constantly several times a day on our medium-
traffic site. The last time I asked the list about the cause I didn't  
receive a satisfying answer. Unfortunately I haven't been able to  
reproduce the error to be able to track it down :( Hopefully this time  
somebody can shed some light on it.

--Tobias

_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: Duplicate session problem?

by Dr. Jennifer Nussbaum :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


--- On Sat, 7/5/08, Tobias Kremer <list@...> wrote:

> From: Tobias Kremer <list@...>
> Subject: Re: [Catalyst] Duplicate session problem?
> To: "The elegant MVC web framework" <catalyst@...>
> Date: Saturday, July 5, 2008, 3:13 PM
> On 05.07.2008, at 23:21, Dr. Jennifer Nussbaum wrote:
> > 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.
>
>
> I'm seeing this error constantly several times a day on
> our medium-
> traffic site. The last time I asked the list about the
> cause I didn't  
> receive a satisfying answer. Unfortunately I haven't
> been able to  
> reproduce the error to be able to track it down :(
> Hopefully this time  
> somebody can shed some light on it.

Well in my testing setup I'm seeing it 100% of the time, so maybe
that'll help debug things :-)

Meanwhile it's sort of hard to develop when i cant get past any screen!

jen.


     

_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: Duplicate session problem?

by Tomas Doran :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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


_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: Duplicate session problem? (LONG)

by Dr. Jennifer Nussbaum :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



--- On Sun, 7/6/08, Tomas Doran <bobtfish@...> wrote:

> From: Tomas Doran <bobtfish@...>
> Subject: Re: [Catalyst] Duplicate session problem?
> To: bg271828@..., "The elegant MVC web framework" <catalyst@...>
> Date: Sunday, July 6, 2008, 4:05 AM
> 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..

Uh, i may not be that smart, but i would have said so if i had written
a routine to generate my own session ID! :-)

No, theres nothing in my root controller of interest. Just the usual
config stuff, and my Root.pm just has default and auto routines without
any session generation things.

Oh, for testing purposes ive switched to Session::Store::File and this
works OK for now.But id like to get to the bottom of this!

> > 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...

No subs, as noted. My plugins are:

use Catalyst qw/-Debug ConfigLoader Static::Simple RequireSSL
                Authentication
                Session Session::Store::DBIC Session::State::Cookie
/;

Heres the full debug log and stack trace, from running it from a clean
state, ie. my cookies are cleared, and i restart the test server.

As i said this happens 100% of the time. Im running on Debian Lenny,
by the way, with versions of everything installed from the Debian
package system. Thanks, and hope this helps someone else too!

Jen

P.S. I changed the name of my real app to "MyApp", but havent made any
other changes to this output.

-----



SELECT me.id, me.login, me.password, me.access_level, me.email, me.last_login, me.created, me.deleted FROM user me WHERE ( ( ( login = ? ) AND ( ( ( deleted IS NULL ) OR ( deleted = ? ) ) ) ) ) ORDER BY login: 'testuser', '0'
SELECT me.id, me.login, me.password, me.access_level, me.email, me.last_login, me.created, me.deleted FROM user me WHERE ( ( ( ( ( ( me.id = ? ) ) ) ) AND ( ( ( deleted IS NULL ) OR ( deleted = ? ) ) ) ) ) ORDER BY login: '3', '0'
UPDATE user SET last_login = now() WHERE ( id = ? ): '3'
SELECT me.id, me.session_data, me.expires, me.t FROM sessions me WHERE ( ( me.id = ? ) ): 'session:4f540dcae6da5bf8bc91b15f65bf6a34e16733a5'
INSERT INTO sessions (id) VALUES (?): 'session:4f540dcae6da5bf8bc91b15f65bf6a34e16733a5'
UPDATE sessions SET expires = ?, session_data = ? WHERE ( id = ? ): '1215354122', 'BQcDAAAABQUAAAAIb3JpZ191cmkKBGRiaWMAAAAMX191c2VyX3JlYWxtBAMAAAAIChMyMDA4LTA3
LTA2IDA3OjA3OjQxAAAACmxhc3RfbG9naW4FAAAAB2RlbGV0ZWQKBmplc3RlcgAAAAVsb2dpbgoQ
amVzdGVyQHBhbml4LmNvbQAAAAVlbWFpbAoTMjAwMS0wOC0wOCAwMDo0MTo1NAAAAAdjcmVhdGVk
CghwYXNzdzByZAAAAAhwYXNzd29yZAoBMwAAAAJpZAoJU1VQRVJVU0VSAAAADGFjY2Vzc19sZXZl
bAAAAAZfX3VzZXIJSHDG+gAAAAlfX2NyZWF0ZWQJSHDG+gAAAAlfX3VwZGF0ZWQ=
', 'session:4f540dcae6da5bf8bc91b15f65bf6a34e16733a5'
[info] *** Request 1 (0.053/s) [1432] [Sun Jul  6 09:22:02 2008] ***
[debug] Body Parameters are:
.-------------------------------------+--------------------------------------.
| Parameter                           | Value                                |
+-------------------------------------+--------------------------------------+
| password                            | passw0rd                             |
| username                            | testuser                               |
'-------------------------------------+--------------------------------------'
[debug] "POST" request for "login" from "127.0.0.1"
[debug] Path is "login"
[debug] Created session "4f540dcae6da5bf8bc91b15f65bf6a34e16733a5"
[debug] Redirecting to "/"
[info] Request took 0.060899s (16.421/s)
.----------------------------------------------------------------+-----------.
| Action                                                         | Time      |
+----------------------------------------------------------------+-----------+
| /auto                                                          | 0.000447s |
| /user/login                                                    | 0.040580s |
| /end                                                           | 0.000169s |
'----------------------------------------------------------------+-----------'

[error] Caught exception in engine "Can't update MyApp::Model::MyAppDB::Session=HASH(0x91cb968): row not found at /usr/share/perl5/DBIx/Class/Schema.pm line 954
        DBIx::Class::Schema::throw_exception('MyApp::Schema::Main=HASH(0x8f288e0)', 'Can\'t update MyApp::Model::MyAppDB::Session=HASH(0...') called at /usr/share/perl5/DBIx/Class/Row.pm line 757
        DBIx::Class::Row::throw_exception('MyApp::Model::MyAppDB::Session=HASH(0x91cb968)', 'Can\'t update MyApp::Model::MyAppDB::Session=HASH(0...') called at /usr/share/perl5/DBIx/Class/Row.pm line 302
        DBIx::Class::Row::update('MyApp::Model::MyAppDB::Session=HASH(0x91cb968)') called at /usr/share/perl5/DBIx/Class/Relationship/CascadeActions.pm line 30
        DBIx::Class::Relationship::CascadeActions::update('MyApp::Model::MyAppDB::Session=HASH(0x91cb968)') called at /usr/share/perl5/Catalyst/Plugin/Session/Store/DBIC/Delegate.pm line 85
        Catalyst::Plugin::Session::Store::DBIC::Delegate::flush('Catalyst::Plugin::Session::Store::DBIC::Delegate=HASH(0x91cbb38)') called at /usr/share/perl5/Catalyst/Plugin/Session/Store/Delegate.pm line 72
        Catalyst::Plugin::Session::Store::Delegate::finalize_session_delegate('MyApp=HASH(0x913ace8)', 'Catalyst::Plugin::Session::Store::DBIC::Delegate=HASH(0x91cbb38)') called at /usr/share/perl5/Catalyst/Plugin/Session/Store/Delegate.pm line 65
        Catalyst::Plugin::Session::Store::Delegate::_clear_session_instance_data('MyApp=HASH(0x913ace8)') called at /usr/share/perl/5.10/NEXT.pm line 77
        NEXT::AUTOLOAD('MyApp=HASH(0x913ace8)') called at /usr/share/perl5/Catalyst/Plugin/Session.pm line 268
        Catalyst::Plugin::Session::_clear_session_instance_data('MyApp=HASH(0x913ace8)') called at /usr/share/perl5/Catalyst/Plugin/Session.pm line 119
        Catalyst::Plugin::Session::finalize_session('MyApp=HASH(0x913ace8)') called at /usr/share/perl5/Catalyst/Plugin/Session.pm line 106
        Catalyst::Plugin::Session::finalize('MyApp=HASH(0x913ace8)') called at /usr/share/perl/5.10/NEXT.pm line 77
        NEXT::AUTOLOAD('MyApp=HASH(0x913ace8)') called at /usr/local/share/perl/5.10.0/Catalyst/Plugin/RequireSSL.pm line 57
        Catalyst::Plugin::RequireSSL::finalize('MyApp=HASH(0x913ace8)') called at /usr/share/perl/5.10/NEXT.pm line 77
        NEXT::AUTOLOAD('MyApp=HASH(0x913ace8)') called at /usr/share/perl5/Catalyst/Plugin/Static/Simple.pm line 79
        Catalyst::Plugin::Static::Simple::finalize('MyApp=HASH(0x913ace8)') called at /usr/share/perl5/Catalyst.pm line 1513
        eval {...} called at /usr/share/perl5/Catalyst.pm line 1503
        Catalyst::handle_request('MyApp') called at /usr/share/perl5/Catalyst/Engine/HTTP.pm line 381
        Catalyst::Engine::HTTP::_handler('Catalyst::Engine::HTTP=HASH(0x8a51530)', 'MyApp', 3000, 'POST', '/login', 'HTTP/1.1') called at /usr/share/perl5/Catalyst/Engine/HTTP.pm line 286
        Catalyst::Engine::HTTP::run('Catalyst::Engine::HTTP=HASH(0x8a51530)', 'MyApp', 3000, undef, 'HASH(0x86edfe0)') called at /usr/share/perl5/Catalyst.pm line 1827
        Catalyst::run('MyApp', 3000, undef, 'HASH(0x86edfe0)') called at ./script/MyApp_server.pl line 57"
SELECT me.id, me.session_data, me.expires, me.t FROM sessions me WHERE ( ( me.id = ? ) ): 'session:4f540dcae6da5bf8bc91b15f65bf6a34e16733a5'
INSERT INTO sessions (id) VALUES (?): 'session:4f540dcae6da5bf8bc91b15f65bf6a34e16733a5'
SELECT me.id, me.session_data, me.expires, me.t FROM sessions me WHERE ( ( me.id = ? ) ): 'session:4f540dcae6da5bf8bc91b15f65bf6a34e16733a5'
INSERT INTO sessions (id) VALUES (?): 'session:4f540dcae6da5bf8bc91b15f65bf6a34e16733a5'
[info] *** Request 2 (0.105/s) [1432] [Sun Jul  6 09:22:02 2008] ***
[debug] "GET" request for "/" from "127.0.0.1"
[debug] Path is "/"
[debug] Found sessionid "4f540dcae6da5bf8bc91b15f65bf6a34e16733a5" in cookie
[error] DBI Exception: DBD::mysql::st execute failed: Duplicate entry 'session:4f540dcae6da5bf8bc91b15f' for key 1 [for Statement "INSERT INTO sessions (id) VALUES (?)" with ParamValues: 0='session:4f540dcae6da5bf8bc91b15f65bf6a34e16733a5'] at /usr/share/perl5/DBIx/Class/Schema.pm line 954
        DBIx::Class::Schema::throw_exception('MyApp::Schema::Main=HASH(0x8f288e0)', 'DBI Exception: DBD::mysql::st execute failed: Duplicate entry...') called at /usr/share/perl5/DBIx/Class/Storage.pm line 122
        DBIx::Class::Storage::throw_exception('DBIx::Class::Storage::DBI::mysql=HASH(0x8f28c70)', 'DBI Exception: DBD::mysql::st execute failed: Duplicate entry...') called at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 846
        DBIx::Class::Storage::DBI::__ANON__('DBD::mysql::st execute failed: Duplicate entry \'session:4f54...', 'DBI::st=HASH(0x91cba98)', undef) called at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1003
        DBIx::Class::Storage::DBI::_dbh_execute('DBIx::Class::Storage::DBI::mysql=HASH(0x8f28c70)', 'DBI::db=HASH(0x9189c08)', 'insert', 'ARRAY(0x91e23f8)', 'DBIx::Class::ResultSource::Table=HASH(0x8f28a20)', undef, 'HASH(0x916b680)') called at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 600
        eval {...} called at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 590
        DBIx::Class::Storage::DBI::dbh_do('DBIx::Class::Storage::DBI::mysql=HASH(0x8f28c70)', 'CODE(0x907f510)', 'insert', 'ARRAY(0x91e23f8)', 'DBIx::Class::ResultSource::Table=HASH(0x8f28a20)', undef, 'HASH(0x916b680)') called at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1013
        DBIx::Class::Storage::DBI::_execute('DBIx::Class::Storage::DBI::mysql=HASH(0x8f28c70)', 'insert', 'ARRAY(0x91e23f8)', 'DBIx::Class::ResultSource::Table=HASH(0x8f28a20)', undef, 'HASH(0x916b680)') called at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1022
        DBIx::Class::Storage::DBI::insert('DBIx::Class::Storage::DBI::mysql=HASH(0x8f28c70)', 'DBIx::Class::ResultSource::Table=HASH(0x8f28a20)', 'HASH(0x916b680)') called at /usr/share/perl5/DBIx/Class/Row.pm line 207
        DBIx::Class::Row::insert('MyApp::Model::MyAppDB::Session=HASH(0x91cbad8)') called at /usr/share/perl5/DBIx/Class/ResultSet.pm line 1638
        DBIx::Class::ResultSet::create('DBIx::Class::ResultSet=HASH(0x91d0308)', 'HASH(0x91d06e8)') called at /usr/share/perl5/DBIx/Class/ResultSet.pm line 1684
        DBIx::Class::ResultSet::find_or_create('DBIx::Class::ResultSet=HASH(0x91d0308)', 'HASH(0x91d06e8)') called at /usr/share/perl5/Catalyst/Plugin/Session/Store/DBIC/Delegate.pm line 33
        Catalyst::Plugin::Session::Store::DBIC::Delegate::session('Catalyst::Plugin::Session::Store::DBIC::Delegate=HASH(0x91d9c08)', 'session:4f540dcae6da5bf8bc91b15f65bf6a34e16733a5') called at /usr/share/perl5/Catalyst/Plugin/Session/Store/DBIC/Delegate.pm line 71
        Catalyst::Plugin::Session::Store::DBIC::Delegate::expires('Catalyst::Plugin::Session::Store::DBIC::Delegate=HASH(0x91d9c08)', 'expires:4f540dcae6da5bf8bc91b15f65bf6a34e16733a5') called at /usr/share/perl5/Catalyst/Plugin/Session/Store/DBIC.pm line 180
        Catalyst::Plugin::Session::Store::DBIC::__ANON__('Catalyst::Plugin::Session::Store::DBIC::Delegate=HASH(0x91d9c08)') called at /usr/share/perl5/Catalyst/Plugin/Session/Store/Delegate.pm line 87
        Catalyst::Plugin::Session::Store::Delegate::get_session_data('MyApp=HASH(0x913ac68)', 'expires:4f540dcae6da5bf8bc91b15f65bf6a34e16733a5') called at /usr/share/perl5/Catalyst/Plugin/Session.pm line 186
        Catalyst::Plugin::Session::_load_session_expires('MyApp=HASH(0x913ac68)') called at /usr/share/perl5/Catalyst/Plugin/Session.pm line 206
        Catalyst::Plugin::Session::_load_session('MyApp=HASH(0x913ac68)') called at /usr/share/perl5/Catalyst/Plugin/Session.pm line 365
        Catalyst::Plugin::Session::session_is_valid('MyApp=HASH(0x913ac68)') called at /usr/share/perl5/Catalyst/Plugin/Authentication.pm line 146
        Catalyst::Plugin::Authentication::_user_in_session('MyApp=HASH(0x913ac68)') called at /usr/share/perl5/Catalyst/Plugin/Authentication.pm line 70
        Catalyst::Plugin::Authentication::user_exists('MyApp=HASH(0x913ac68)') called at /home/jen/cvs/cite-editor/MyApp/script/../lib/MyApp/Controller/Root.pm line 35
        MyApp::Controller::Root::auto('MyApp::Controller::Root=HASH(0x8ccda20)', 'MyApp=HASH(0x913ac68)') called at /usr/share/perl5/Catalyst/Action.pm line 46
        Catalyst::Action::execute('Catalyst::Action=HASH(0x91364d8)', 'MyApp::Controller::Root=HASH(0x8ccda20)', 'MyApp=HASH(0x913ac68)') called at /usr/share/perl5/Catalyst/Action.pm line 32
        Catalyst::Action::__ANON__('MyApp::Controller::Root=HASH(0x8ccda20)', 'MyApp=HASH(0x913ac68)') called at /usr/share/perl5/Catalyst.pm line 1220
        eval {...} called at /usr/share/perl5/Catalyst.pm line 1220
        Catalyst::execute('MyApp=HASH(0x913ac68)', 'MyApp::Controller::Root', 'Catalyst::Action=HASH(0x91364d8)') called at /usr/share/perl5/Catalyst/Action.pm line 41
        Catalyst::Action::dispatch('Catalyst::Action=HASH(0x91364d8)', 'MyApp=HASH(0x913ac68)') called at /usr/share/perl5/Catalyst/Controller.pm line 66
        Catalyst::Controller::_AUTO('MyApp::Controller::Root=HASH(0x8ccda20)', 'MyApp=HASH(0x913ac68)') called at /usr/share/perl5/Catalyst/Action.pm line 46
        Catalyst::Action::execute('Catalyst::Action=HASH(0x9138218)', 'MyApp::Controller::Root=HASH(0x8ccda20)', 'MyApp=HASH(0x913ac68)') called at /usr/share/perl5/Catalyst/Action.pm line 32
        Catalyst::Action::__ANON__('MyApp::Controller::Root=HASH(0x8ccda20)', 'MyApp=HASH(0x913ac68)') called at /usr/share/perl5/Catalyst.pm line 1220
        eval {...} called at /usr/share/perl5/Catalyst.pm line 1220
        Catalyst::execute('MyApp=HASH(0x913ac68)', 'MyApp::Controller::Root', 'Catalyst::Action=HASH(0x9138218)') called at /usr/share/perl5/Catalyst/Action.pm line 41
        Catalyst::Action::dispatch('Catalyst::Action=HASH(0x9138218)', 'MyApp=HASH(0x913ac68)') called at /usr/share/perl5/Catalyst/Dispatcher.pm line 177
        Catalyst::Dispatcher::forward('Catalyst::Dispatcher=HASH(0x8a31ff8)', 'MyApp=HASH(0x913ac68)', '_AUTO') called at /usr/share/perl5/Catalyst.pm line 313
        Catalyst::forward('MyApp=HASH(0x913ac68)', '_AUTO') called at /usr/share/perl5/Catalyst/Controller.pm line 48
        Catalyst::Controller::_DISPATCH('MyApp::Controller::Root=HASH(0x8ccda20)', 'MyApp=HASH(0x913ac68)') called at /usr/share/perl5/Catalyst/Action.pm line 46
        Catalyst::Action::execute('Catalyst::Action=HASH(0x9136378)', 'MyApp::Controller::Root=HASH(0x8ccda20)', 'MyApp=HASH(0x913ac68)') called at /usr/share/perl5/Catalyst/Action.pm line 32
        Catalyst::Action::__ANON__('MyApp::Controller::Root=HASH(0x8ccda20)', 'MyApp=HASH(0x913ac68)') called at /usr/share/perl5/Catalyst.pm line 1220
        eval {...} called at /usr/share/perl5/Catalyst.pm line 1220
        Catalyst::execute('MyApp=HASH(0x913ac68)', 'MyApp::Controller::Root', 'Catalyst::Action=HASH(0x9136378)') called at /usr/share/perl5/Catalyst/Action.pm line 41
        Catalyst::Action::dispatch('Catalyst::Action=HASH(0x9136378)', 'MyApp=HASH(0x913ac68)') called at /usr/share/perl5/Catalyst/Dispatcher.pm line 177
        Catalyst::Dispatcher::forward('Catalyst::Dispatcher=HASH(0x8a31ff8)', 'MyApp=HASH(0x913ac68)', '//_DISPATCH') called at /usr/share/perl5/Catalyst.pm line 313
        Catalyst::forward('MyApp=HASH(0x913ac68)', '//_DISPATCH') called at /usr/share/perl5/Catalyst/Dispatcher.pm line 116
        Catalyst::Dispatcher::dispatch('Catalyst::Dispatcher=HASH(0x8a31ff8)', 'MyApp=HASH(0x913ac68)') called at /usr/share/perl5/Catalyst.pm line 1169
        Catalyst::dispatch('MyApp=HASH(0x913ac68)') called at /usr/share/perl/5.10/NEXT.pm line 77
        NEXT::AUTOLOAD('MyApp=HASH(0x913ac68)') called at /usr/share/perl5/Catalyst/Plugin/Static/Simple.pm line 67
        Catalyst::Plugin::Static::Simple::dispatch('MyApp=HASH(0x913ac68)') called at /usr/share/perl5/Catalyst.pm line 1512
        eval {...} called at /usr/share/perl5/Catalyst.pm line 1503
        Catalyst::handle_request('MyApp') called at /usr/share/perl5/Catalyst/Engine/HTTP.pm line 381
        Catalyst::Engine::HTTP::_handler('Catalyst::Engine::HTTP=HASH(0x8a51530)', 'MyApp', 3000, 'GET', '/', 'HTTP/1.1') called at /usr/share/perl5/Catalyst/Engine/HTTP.pm line 286
        Catalyst::Engine::HTTP::run('Catalyst::Engine::HTTP=HASH(0x8a51530)', 'MyApp', 3000, undef, 'HASH(0x86edfe0)') called at /usr/share/perl5/Catalyst.pm line 1827
        Catalyst::run('MyApp', 3000, undef, 'HASH(0x86edfe0)') called at ./script/MyApp_server.pl line 57
[info] Request took 0.034838s (28.704/s)
.----------------------------------------------------------------+-----------.
| Action                                                         | Time      |
+----------------------------------------------------------------+-----------+
| /auto                                                          | 0.008990s |
| /end                                                           | 0.000157s |
'----------------------------------------------------------------+-----------'

[error] Caught exception in engine "DBI Exception: DBD::mysql::st execute failed: Duplicate entry 'session:4f540dcae6da5bf8bc91b15f' for key 1 [for Statement "INSERT INTO sessions (id) VALUES (?)" with ParamValues: 0='session:4f540dcae6da5bf8bc91b15f65bf6a34e16733a5'] at /usr/share/perl5/DBIx/Class/Schema.pm line 954
        DBIx::Class::Schema::throw_exception('MyApp::Schema::Main=HASH(0x8f288e0)', 'DBI Exception: DBD::mysql::st execute failed: Duplicate entry...') called at /usr/share/perl5/DBIx/Class/Storage.pm line 122
        DBIx::Class::Storage::throw_exception('DBIx::Class::Storage::DBI::mysql=HASH(0x8f28c70)', 'DBI Exception: DBD::mysql::st execute failed: Duplicate entry...') called at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 846
        DBIx::Class::Storage::DBI::__ANON__('DBD::mysql::st execute failed: Duplicate entry \'session:4f54...', 'DBI::st=HASH(0x91cba98)', undef) called at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1003
        DBIx::Class::Storage::DBI::_dbh_execute('DBIx::Class::Storage::DBI::mysql=HASH(0x8f28c70)', 'DBI::db=HASH(0x9189c08)', 'insert', 'ARRAY(0x922dcf8)', 'DBIx::Class::ResultSource::Table=HASH(0x8f28a20)', undef, 'HASH(0x9231f20)') called at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 600
        eval {...} called at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 590
        DBIx::Class::Storage::DBI::dbh_do('DBIx::Class::Storage::DBI::mysql=HASH(0x8f28c70)', 'CODE(0x907f510)', 'insert', 'ARRAY(0x922dcf8)', 'DBIx::Class::ResultSource::Table=HASH(0x8f28a20)', undef, 'HASH(0x9231f20)') called at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1013
        DBIx::Class::Storage::DBI::_execute('DBIx::Class::Storage::DBI::mysql=HASH(0x8f28c70)', 'insert', 'ARRAY(0x922dcf8)', 'DBIx::Class::ResultSource::Table=HASH(0x8f28a20)', undef, 'HASH(0x9231f20)') called at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1022
        DBIx::Class::Storage::DBI::insert('DBIx::Class::Storage::DBI::mysql=HASH(0x8f28c70)', 'DBIx::Class::ResultSource::Table=HASH(0x8f28a20)', 'HASH(0x9231f20)') called at /usr/share/perl5/DBIx/Class/Row.pm line 207
        DBIx::Class::Row::insert('MyApp::Model::MyAppDB::Session=HASH(0x91d02e8)') called at /usr/share/perl5/DBIx/Class/ResultSet.pm line 1638
        DBIx::Class::ResultSet::create('DBIx::Class::ResultSet=HASH(0x91d0308)', 'HASH(0x921b5a8)') called at /usr/share/perl5/DBIx/Class/ResultSet.pm line 1684
        DBIx::Class::ResultSet::find_or_create('DBIx::Class::ResultSet=HASH(0x91d0308)', 'HASH(0x921b5a8)') called at /usr/share/perl5/Catalyst/Plugin/Session/Store/DBIC/Delegate.pm line 33
        Catalyst::Plugin::Session::Store::DBIC::Delegate::session('Catalyst::Plugin::Session::Store::DBIC::Delegate=HASH(0x91d9c08)', 'session:4f540dcae6da5bf8bc91b15f65bf6a34e16733a5') called at /usr/share/perl5/Catalyst/Plugin/Session/Store/DBIC.pm line 185
        Catalyst::Plugin::Session::Store::DBIC::__ANON__('Catalyst::Plugin::Session::Store::DBIC::Delegate=HASH(0x91d9c08)', 'BQcDAAAAAgoKMTIxNTM1MDUyMgAAAAlfX2NyZWF0ZWQJSHDG+gAAAAlfX3VwZ...') called at /usr/share/perl5/Catalyst/Plugin/Session/Store/Delegate.pm line 94
        Catalyst::Plugin::Session::Store::Delegate::store_session_data('MyApp=HASH(0x913ac68)', 'session:4f540dcae6da5bf8bc91b15f65bf6a34e16733a5', 'HASH(0x91cb518)') called at /usr/share/perl5/Catalyst/Plugin/Session.pm line 151
        Catalyst::Plugin::Session::_save_session('MyApp=HASH(0x913ac68)') called at /usr/share/perl5/Catalyst/Plugin/Session.pm line 116
        Catalyst::Plugin::Session::finalize_session('MyApp=HASH(0x913ac68)') called at /usr/share/perl5/Catalyst/Plugin/Session.pm line 106
        Catalyst::Plugin::Session::finalize('MyApp=HASH(0x913ac68)') called at /usr/share/perl/5.10/NEXT.pm line 77
        NEXT::AUTOLOAD('MyApp=HASH(0x913ac68)') called at /usr/local/share/perl/5.10.0/Catalyst/Plugin/RequireSSL.pm line 57
        Catalyst::Plugin::RequireSSL::finalize('MyApp=HASH(0x913ac68)') called at /usr/share/perl/5.10/NEXT.pm line 77
        NEXT::AUTOLOAD('MyApp=HASH(0x913ac68)') called at /usr/share/perl5/Catalyst/Plugin/Static/Simple.pm line 79
        Catalyst::Plugin::Static::Simple::finalize('MyApp=HASH(0x913ac68)') called at /usr/share/perl5/Catalyst.pm line 1513
        eval {...} called at /usr/share/perl5/Catalyst.pm line 1503
        Catalyst::handle_request('MyApp') called at /usr/share/perl5/Catalyst/Engine/HTTP.pm line 381
        Catalyst::Engine::HTTP::_handler('Catalyst::Engine::HTTP=HASH(0x8a51530)', 'MyApp', 3000, 'GET', '/', 'HTTP/1.1') called at /usr/share/perl5/Catalyst/Engine/HTTP.pm line 286
        Catalyst::Engine::HTTP::run('Catalyst::Engine::HTTP=HASH(0x8a51530)', 'MyApp', 3000, undef, 'HASH(0x86edfe0)') called at /usr/share/perl5/Catalyst.pm line 1827
        Catalyst::run('MyApp', 3000, undef, 'HASH(0x86edfe0)') called at ./script/MyApp_server.pl line 57"



     

_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: Duplicate session problem? (LONG)

by J. Shirley :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sun, Jul 6, 2008 at 6:30 AM, Dr. Jennifer Nussbaum
<bg271828@...> wrote:

>
>
> --- On Sun, 7/6/08, Tomas Doran <bobtfish@...> wrote:
>
>> From: Tomas Doran <bobtfish@...>
>> Subject: Re: [Catalyst] Duplicate session problem?
>> To: bg271828@..., "The elegant MVC web framework" <catalyst@...>
>> Date: Sunday, July 6, 2008, 4:05 AM
>> 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>
> <snip>

I'm actually more inclined to think that there is something wrong with
the database.  Due to your previous problem of the '0' vs. 0 returning
different data, which shouldn't happen, there is something else going
on with MySQL.

If you'll note, DBIC uses bind parameters which takes care of quoting:
SELECT me.id, me.login, me.password, me.access_level, me.email,
me.last_login, me.created, me.deleted FROM user me WHERE ( ( ( ( ( (
me.id = ? ) ) ) ) AND ( ( ( deleted IS NULL ) OR ( deleted = ? ) ) ) )
) ORDER BY login: '3', '0'

The ? mark means it is a bind param, and the quoting on '3' and '0' is
for display purposes.  From your previous message about the auth
framework, if that query isn't working out of the box there is some
other problem.

Is your MySQL database configured strangely, if you run these queries
do you get a valid record back?

SELECT me.id, me.session_data, me.expires, me.t FROM sessions me WHERE
( ( me.id = ? 'session:4f540dcae6da5bf8bc91b15f65bf6a34e16733a5' ) )
INSERT INTO sessions (id) VALUES
('session:4f540dcae6da5bf8bc91b15f65bf6a34e16733a5')
SELECT me.id, me.session_data, me.expires, me.t FROM sessions me WHERE
( ( me.id = 'session:4f540dcae6da5bf8bc91b15f65bf6a34e16733a5' ))

_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: Duplicate session problem? (LONG)

by Dr. Jennifer Nussbaum :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


--- On Sun, 7/6/08, J. Shirley <jshirley@...> wrote:

> From: J. Shirley <jshirley@...>
> Subject: Re: [Catalyst] Duplicate session problem? (LONG)
> To: bg271828@..., "The elegant MVC web framework" <catalyst@...>
> Cc: "Tomas Doran" <bobtfish@...>
> Date: Sunday, July 6, 2008, 6:57 AM
> On Sun, Jul 6, 2008 at 6:30 AM, Dr. Jennifer Nussbaum
> <bg271828@...> wrote:
> >
> >
> > --- On Sun, 7/6/08, Tomas Doran
> <bobtfish@...> wrote:
> >
> >> From: Tomas Doran <bobtfish@...>
> >> Subject: Re: [Catalyst] Duplicate session problem?
> >> To: bg271828@..., "The elegant MVC web
> framework" <catalyst@...>
> >> Date: Sunday, July 6, 2008, 4:05 AM
> >> 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>
> > <snip>
>
> I'm actually more inclined to think that there is
> something wrong with
> the database.  Due to your previous problem of the
> '0' vs. 0 returning
> different data, which shouldn't happen, there is
> something else going
> on with MySQL.

I did try this with a different version of MySQL--a 4.x version on
FreeBSD (this is a 5.x version on Linux), and there was also a
difference between the "deleted = 0" and "deleted = '0'" search.

> If you'll note, DBIC uses bind parameters which takes
> care of quoting:
> SELECT me.id, me.login, me.password, me.access_level,
> me.email,
> me.last_login, me.created, me.deleted FROM user me WHERE (
> ( ( ( ( (
> me.id = ? ) ) ) ) AND ( ( ( deleted IS NULL ) OR ( deleted
> = ? ) ) ) )
> ) ORDER BY login: '3', '0'
>
> The ? mark means it is a bind param, and the quoting on
> '3' and '0' is
> for display purposes.  From your previous message about the
> auth
> framework, if that query isn't working out of the box
> there is some
> other problem.
>
> Is your MySQL database configured strangely, if you run
> these queries
> do you get a valid record back?
>
> SELECT me.id, me.session_data, me.expires, me.t FROM
> sessions me WHERE
> ( ( me.id = ?
> 'session:4f540dcae6da5bf8bc91b15f65bf6a34e16733a5'
> ) )

If I remove your "?", then I get:

mysql> SELECT me.id, me.session_data, me.expires, me.t FROM
    -> sessions me WHERE ( ( me.id = 'session:4f540dcae6da5bf8bc91b15f65bf6a34e16733a5' ) );
Empty set (0.00 sec)


> INSERT INTO sessions (id) VALUES
> ('session:4f540dcae6da5bf8bc91b15f65bf6a34e16733a5')

mysql> INSERT INTO sessions (id) VALUES
    -> ('session:4f540dcae6da5bf8bc91b15f65bf6a34e16733a5');
ERROR 1062 (23000): Duplicate entry 'session:4f540dcae6da5bf8bc91b15f' for key 1


> SELECT me.id, me.session_data, me.expires, me.t FROM
> sessions me WHERE
> ( ( me.id =
> 'session:4f540dcae6da5bf8bc91b15f65bf6a34e16733a5'
> ))

mysql> SELECT me.id, me.session_data, me.expires, me.t FROM
    -> sessions me WHERE ( ( me.id =
    -> 'session:4f540dcae6da5bf8bc91b15f65bf6a34e16733a5' ) );
Empty set (0.00 sec)

What does all this mean?

Heres the sessions table, btw (the a_session is legacy):
mysql> desc sessions;
+--------------+-------------+------+-----+-------------------+-------+
| Field        | Type        | Null | Key | Default           | Extra |
+--------------+-------------+------+-----+-------------------+-------+
| id           | varchar(32) | NO   | PRI |                   |       |
| t            | timestamp   | NO   |     | CURRENT_TIMESTAMP |       |
| a_session    | text        | YES  |     | NULL              |       |
| session_data | text        | YES  |     | NULL              |       |
| expires      | int(10)     | YES  |     | NULL              |       |
+--------------+-------------+------+-----+-------------------+-------+
5 rows in set (0.00 sec)

Thanks.

Jen



     

_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: Duplicate session problem? (LONG)

by J. Shirley :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sun, Jul 6, 2008 at 7:12 AM, Dr. Jennifer Nussbaum
<bg271828@...> wrote:

>
> --- On Sun, 7/6/08, J. Shirley <jshirley@...> wrote:
>
>> From: J. Shirley <jshirley@...>
>> Subject: Re: [Catalyst] Duplicate session problem? (LONG)
>> To: bg271828@..., "The elegant MVC web framework" <catalyst@...>
>> Cc: "Tomas Doran" <bobtfish@...>
>> Date: Sunday, July 6, 2008, 6:57 AM
>> On Sun, Jul 6, 2008 at 6:30 AM, Dr. Jennifer Nussbaum
>> <bg271828@...> wrote:
>> >
>> >
>> > --- On Sun, 7/6/08, Tomas Doran
>> <bobtfish@...> wrote:
>> >
>> >> From: Tomas Doran <bobtfish@...>
>> >> Subject: Re: [Catalyst] Duplicate session problem?
>> >> To: bg271828@..., "The elegant MVC web
>> framework" <catalyst@...>
>> >> Date: Sunday, July 6, 2008, 4:05 AM
>> >> 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>
>> > <snip>
>>
>> I'm actually more inclined to think that there is
>> something wrong with
>> the database.  Due to your previous problem of the
>> '0' vs. 0 returning
>> different data, which shouldn't happen, there is
>> something else going
>> on with MySQL.
>
> I did try this with a different version of MySQL--a 4.x version on
> FreeBSD (this is a 5.x version on Linux), and there was also a
> difference between the "deleted = 0" and "deleted = '0'" search.
>

Not for me :)  I tried this on 3 different MySQL hosts of varying
versions and 1 Pg host.  I'm inclined to think it is configuration
base (all 3 are fairly default configs, with only InnoDB size and
replication changes):

mysql> select count(*) from persons where verified = 0;
+----------+
| count(*) |
+----------+
|        3 |
+----------+
1 row in set (0.00 sec)

mysql> select count(*) from persons where verified = '0';
+----------+
| count(*) |
+----------+
|        3 |
+----------+
1 row in set (0.00 sec)


>> If you'll note, DBIC uses bind parameters which takes
>> care of quoting:
>> SELECT me.id, me.login, me.password, me.access_level,
>> me.email,
>> me.last_login, me.created, me.deleted FROM user me WHERE (
>> ( ( ( ( (
>> me.id = ? ) ) ) ) AND ( ( ( deleted IS NULL ) OR ( deleted
>> = ? ) ) ) )
>> ) ORDER BY login: '3', '0'
>>
>> The ? mark means it is a bind param, and the quoting on
>> '3' and '0' is
>> for display purposes.  From your previous message about the
>> auth
>> framework, if that query isn't working out of the box
>> there is some
>> other problem.
>>
>> Is your MySQL database configured strangely, if you run
>> these queries
>> do you get a valid record back?
>>
>> SELECT me.id, me.session_data, me.expires, me.t FROM
>> sessions me WHERE
>> ( ( me.id = ?
>> 'session:4f540dcae6da5bf8bc91b15f65bf6a34e16733a5'
>> ) )
>
> If I remove your "?", then I get:
>
> mysql> SELECT me.id, me.session_data, me.expires, me.t FROM
>    -> sessions me WHERE ( ( me.id = 'session:4f540dcae6da5bf8bc91b15f65bf6a34e16733a5' ) );
> Empty set (0.00 sec)
>
>
>> INSERT INTO sessions (id) VALUES
>> ('session:4f540dcae6da5bf8bc91b15f65bf6a34e16733a5')
>
> mysql> INSERT INTO sessions (id) VALUES
>    -> ('session:4f540dcae6da5bf8bc91b15f65bf6a34e16733a5');
> ERROR 1062 (23000): Duplicate entry 'session:4f540dcae6da5bf8bc91b15f' for key 1
>
>
>> SELECT me.id, me.session_data, me.expires, me.t FROM
>> sessions me WHERE
>> ( ( me.id =
>> 'session:4f540dcae6da5bf8bc91b15f65bf6a34e16733a5'
>> ))
>
> mysql> SELECT me.id, me.session_data, me.expires, me.t FROM
>    -> sessions me WHERE ( ( me.id =
>    -> 'session:4f540dcae6da5bf8bc91b15f65bf6a34e16733a5' ) );
> Empty set (0.00 sec)
>
> What does all this mean?
>
> Heres the sessions table, btw (the a_session is legacy):
> mysql> desc sessions;
> +--------------+-------------+------+-----+-------------------+-------+
> | Field        | Type        | Null | Key | Default           | Extra |
> +--------------+-------------+------+-----+-------------------+-------+
> | id           | varchar(32) | NO   | PRI |                   |       |
> | t            | timestamp   | NO   |     | CURRENT_TIMESTAMP |       |
> | a_session    | text        | YES  |     | NULL              |       |
> | session_data | text        | YES  |     | NULL              |       |
> | expires      | int(10)     | YES  |     | NULL              |       |
> +--------------+-------------+------+-----+-------------------+-------+
> 5 rows in set (0.00 sec)
>
> Thanks.
>
> Jen
>
>
>
>
>

I'm guessing it is because your sessions are being silently truncated
at 32 bytes, when the string is 48 bytes.

Try changing the length (the Pod for Store::DBIC suggests 72 bytes)
and see if that fixes your issue.

_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: Duplicate session problem? (LONG)

by Dr. Jennifer Nussbaum :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


--- On Sun, 7/6/08, J. Shirley <jshirley@...> wrote:

> From: J. Shirley <jshirley@...>
> Subject: Re: [Catalyst] Duplicate session problem? (LONG)
> To: bg271828@...
> Cc: "The elegant MVC web framework" <catalyst@...>, "Tomas Doran" <bobtfish@...>
> Date: Sunday, July 6, 2008, 7:29 AM
> On Sun, Jul 6, 2008 at 7:12 AM, Dr. Jennifer Nussbaum
> <bg271828@...> wrote:
> >
> > --- On Sun, 7/6/08, J. Shirley
> <jshirley@...> wrote:
> >
> >> From: J. Shirley <jshirley@...>
> >> Subject: Re: [Catalyst] Duplicate session problem?
> (LONG)
> >> To: bg271828@..., "The elegant MVC web
> framework" <catalyst@...>
> >> Cc: "Tomas Doran"
> <bobtfish@...>
> >> Date: Sunday, July 6, 2008, 6:57 AM
> >> On Sun, Jul 6, 2008 at 6:30 AM, Dr. Jennifer
> Nussbaum
> >> <bg271828@...> wrote:
> >> >
> >> >
> >> > --- On Sun, 7/6/08, Tomas Doran
> >> <bobtfish@...> wrote:
> >> >
> >> >> From: Tomas Doran
> <bobtfish@...>
> >> >> Subject: Re: [Catalyst] Duplicate session
> problem?
> >> >> To: bg271828@..., "The elegant
> MVC web
> >> framework" <catalyst@...>
> >> >> Date: Sunday, July 6, 2008, 4:05 AM
> >> >> 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>
> >> > <snip>
> >>
> >> I'm actually more inclined to think that there
> is
> >> something wrong with
> >> the database.  Due to your previous problem of the
> >> '0' vs. 0 returning
> >> different data, which shouldn't happen, there
> is
> >> something else going
> >> on with MySQL.
> >
> > I did try this with a different version of MySQL--a
> 4.x version on
> > FreeBSD (this is a 5.x version on Linux), and there
> was also a
> > difference between the "deleted = 0" and
> "deleted = '0'" search.
> >
>
> Not for me :)  I tried this on 3 different MySQL hosts of
> varying
> versions and 1 Pg host.  I'm inclined to think it is
> configuration
> base (all 3 are fairly default configs, with only InnoDB
> size and
> replication changes):
>
> mysql> select count(*) from persons where verified = 0;
> +----------+
> | count(*) |
> +----------+
> |        3 |
> +----------+
> 1 row in set (0.00 sec)
>
> mysql> select count(*) from persons where verified =
> '0';
> +----------+
> | count(*) |
> +----------+
> |        3 |
> +----------+
> 1 row in set (0.00 sec)

But i assume "verified" is an interger or something? For me "deleted"
is a timestamp, so there could be a difference between a timestamp = 0
and a timestamp = 0000 00:00:00 or whatever it is.

> >
> > Heres the sessions table, btw (the a_session is
> legacy):
> > mysql> desc sessions;
> >
> +--------------+-------------+------+-----+-------------------+-------+
> > | Field        | Type        | Null | Key | Default  
>        | Extra |
> >
> +--------------+-------------+------+-----+-------------------+-------+
> > | id           | varchar(32) | NO   | PRI |          
>        |       |
> > | t            | timestamp   | NO   |     |
> CURRENT_TIMESTAMP |       |
> > | a_session    | text        | YES  |     | NULL      
>        |       |
> > | session_data | text        | YES  |     | NULL      
>        |       |
> > | expires      | int(10)     | YES  |     | NULL      
>        |       |
> >
> +--------------+-------------+------+-----+-------------------+-------+
> > 5 rows in set (0.00 sec)
> >
>
> I'm guessing it is because your sessions are being
> silently truncated
> at 32 bytes, when the string is 48 bytes.
>
> Try changing the length (the Pod for Store::DBIC suggests
> 72 bytes)
> and see if that fixes your issue.

It does!!!

Wow, that was stupid of me. And i did read (or thought i read) all
the docs over and over, but i never thought the underlying table
structure would be the problem.

Thank you!

Back to work now.

Jen


     

_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/