Subject: | Cached DBH in Apache::Session::Store don't get ping'ed before usage |
As the db storage modules all seem to cache the DBH for the database:
$self->{dbh} = DBI->connect(..);
it would be a good idea to ping the DB connection on every connection
attempt:
return if (defined $self->{dbh} and $self->{dbh}->ping());
instead of just returning an eventually closed/timedout db handle:
return if (defined $self->{dbh});
This would avoid errors like:
DBD::mysql::st execute failed: MySQL server has gone away at
/usr/local/share/perl/5.8.1/Apache/Session/Store/DBI.pm line 65.
(in cleanup) DBD::mysql::st execute failed: MySQL server has
gone away at /usr/local/share/perl/5.8.1/Apache/Session/Store/DBI.pm
line 65.
The ping method is described in the DBI-POD.