Re: Apache::DBI "connection lost contact" error

Perrin Harkins <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <CAC0_be1=ncNqUAqcBkEVtqAtGDH=E2yboZPBQi7xM5OFoij51w@mail.gmail.com>
On Thu, Jun 6, 2013 at 12:22 PM, Xinhuan Zheng <[email protected]>
wrote:
> The database handle that is created in startup.pl needs to be really
disconnected (not overloaded disconnect) so that won't leave an idle server
> process running on the database side. Once it's really disconnected, the
server process can be cleaned up on the server side.

Right, that's what the bug is preventing.

Because my flight was delayed last night, I had time to make a patch.
 Please try this on your system and send the debug, like you did before.

- Perrin
apache-dbi.patch (application/octet-stream, 806 B)
Index: lib/Apache/DBI.pm
===================================================================
--- lib/Apache/DBI.pm	(revision 1489197)
+++ lib/Apache/DBI.pm	(working copy)
@@ -124,8 +124,10 @@
     # unpredictable query results.
     # See: http://perl.apache.org/docs/2.0/user/porting/compat.html#C__Apache__Server__Starting__and_C__Apache__Server__ReStarting_
     if (MP2) {
-        require Apache2::ServerUtil;
-        if (Apache2::ServerUtil::restart_count() == 1) {
+        require ModPerl::Util;
+        my $callback = ModPerl::Util::current_callback();
+        if ($callback !~ m/Handler$/ or
+            $callback =~ m/(PostConfig|OpenLogs)/) {
             debug(2, "$prefix skipping connection during server startup, read the docu !!");
             return $drh->connect(@args);
         }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.