[Jifty-commit] r6953 - Jifty-DBI/trunk/lib/Jifty/DBI

Jifty commits jifty-commit at lists.jifty.org
Thu May 7 18:43:51 EDT 2009


Author: alexmv
Date: Thu May  7 18:43:51 2009
New Revision: 6953

Modified:
   Jifty-DBI/trunk/lib/Jifty/DBI/Handle.pm

Log:
During DESTROY, don't explicitly disconnect a dbh set InactiveDestroy

The InactiveDestroy flag on DBI objects prevent them from being
implicitly disconnected when they go out of scope -- for example, in
the case where a process has forked, and two processes hold the socket
open.

However, it does not prevent them from being _explicitly_
disconnected, as we were doing in Jifty::DBI::Handle's DESTROY method.
This caused InactiveDestroy to never kick in, causing either a shared
socket, or two closed handles after a fork.  We prevent this by having
Jifty::DBI::Handle respect InactiveDestroy in its DESTROY method.

Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Handle.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Handle.pm	(original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Handle.pm	Thu May  7 18:43:51 2009
@@ -1328,7 +1328,7 @@
 
 sub DESTROY {
     my $self = shift;
-    $self->disconnect;
+    $self->disconnect unless $self->dbh and $self->dbh->{InactiveDestroy};
     delete $DBIHandle{$self};
 }
 


More information about the Jifty-commit mailing list