-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Badai Aqrandista wrote:
> I am having problem with database connection for the session locks
> dropping intermittently...
> DBD::mysql::st execute failed: Lost connection to MySQL server...
...
> {
> my $main_dbh = MyApp::DB->_connect_db(db_name => 'myapp');
> sub __admin_mason_handler
> {
> return HTML::Mason::ApacheHandler->new(
...
> request_class => 'MasonX::Request::WithApacheSession',
...
> session_handle => $main_dbh,
> session_lock_handle => $main_dbh,
> );
> }
> }
>
> sub handler($$)
> {
> my $class = shift;
> my $r = Apache::Request->new(shift);
> return __admin_mason_handler()->handle_request($r);
> }
>
> I use Apache::DBI in startup.pl to have persistent connection.
The short answer: you're using same handle for session and session_lock.
This should be the source of your error, with or without Apache::DBI.
I've seen this (almost?) always happening in this scenario
(Apache::Session initialized using a DB handle — same for sessions and
locks). So, either use DSN descriptors (letting Apache::Session take
care of dbh) or upgrade your MyApp::DB->_connect_db method to allow
using private attributes (then being able to use separate handles for
sessions/locks).
On a side note, you have a huge performance penalty by instantiating
your handler with each request (BTW, _avoid_ Apache::Request->new,
always use Apache::Request->instance) — something like going from
mod_perl to CGI back again :(
- --
Marius Feraru
-----BEGIN PGP SIGNATURE-----
iD8DBQFEFobNtZHp/AYZiNkRAoYTAJ9ojKbw7yTnaq2l8yjnjWG6JVRoqwCfSCbX
jl5nYWzI1Mm0xMuYv+y82is=
=b+VD
-----END PGP SIGNATURE-----
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Mason-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mason-users