[CDBI] DB connection lost? Program ABENDs on PING?

Tom tom at miramedia.co.uk
Mon Feb 18 11:52:46 GMT 2008


Hi

I have a small TCP daemon running (using Net::EasyTCP and Proc::Daemon). The 
daemon does some very simple interactions with a local database.

I'm not aware of it doing anything complex or special. The same CDBI-based 
classes are used under normal script and mod_perl2 conditions.

However I have found that there appears to be some kind of DB connection 
timeout occurring, which causes the daemon to stop completely. Even though 
'trapped' in an eval{} statement, the program just stops. The only useful 
piece of evidence I have collected so far, is to turn on dbi trace.

For normal operation, trace logs something like this:

    -> FETCH for DBD::mysql::db 
(DBIx::ContextualFetch::db=HASH(0x8edb5a0)~0x8f00ba4 'Active') thr#82d4008
 T  <- FETCH= 1 at DBI.pm line 312
    -> ping for DBD::mysql::db 
(DBIx::ContextualFetch::db=HASH(0x8edb5a0)~0x8f00ba4) thr#82d4008
 T  <- ping= 1 at DBI.pm line 312
    -> prepare_cached for DBD::mysql::db 
(DBIx::ContextualFetch::db=HASH(0x8edb5a0)~0x8f00ba4 'SELECT ........
(e.t.c)

However, if I leave the daemon in-active (or just performing tasks that do 
not use CDBI), it stops at the ping:

    -> FETCH for DBD::mysql::db 
(DBIx::ContextualFetch::db=HASH(0x9f84568)~0x9fa9b8c 'Active') thr#939c008
 T  <- FETCH= 1 at DBI.pm line 312
    -> ping for DBD::mysql::db 
(DBIx::ContextualFetch::db=HASH(0x9f84568)~0x9fa9b8c) thr#939c008

Is there a way I can either fix or investigate this further in CDBI?

An example code snippet:

$log->warning('Pre CDBI method invocation'); # Gets logged.
eval { $foo = My::CDBI::Table->retrieve(%hash) };
$log->warning('Post CDBI method invocation'); # Does not get logged.

Thanks
Tom

No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.516 / Virus Database: 269.20.7/1283 - Release Date: 16/02/2008 
14:16






More information about the ClassDBI mailing list