[Rt-commit] rt branch, 4.0/fewer-active-handles, created. rt-4.0.19rc1-2-g4717d57
Alex Vandiver
alexmv at bestpractical.com
Fri Jan 10 18:56:49 EST 2014
The branch, 4.0/fewer-active-handles has been created
at 4717d5729e49fe23e8127ef6d7941c5c8ba50c58 (commit)
- Log -----------------------------------------------------------------
commit 1cdff0b0fe007c98aa76b73cfdd4e1da160d00ac
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Fri Jan 10 18:03:38 2014 -0500
Stop leaking an extra dbh during server startup
RT::Handle->CheckIntegrity is called during rt-server startup, and its
return value is is stored in $integrity. Additionally, $RT::Handle is
explicitly destroyed, to ensure that the database is disconnected before
forking.
Unfortunately, this replies on the dbh going out of scope, and
disconnecting during its DESTROY. As the dbh is stored in the
$integrity variable in addition to $RT::Handle->dbh, it never goes out
of scope, and is thus never disconnected. For fastcgi deployments, this
causes every fastcgi process to hold open an extra database handle;
standalone servers only ever gain one extra handle.
As no callsite of CheckIntegrity relies on the $dbh return value, simply
return true. This allows the database handle to be disconnected using
$RT::Handle->dbh(undef).
diff --git a/lib/RT/Handle.pm b/lib/RT/Handle.pm
index 4ea1576..5d9b505 100644
--- a/lib/RT/Handle.pm
+++ b/lib/RT/Handle.pm
@@ -246,7 +246,7 @@ sub CheckIntegrity {
return (0, 'no nobody user', "Couldn't find Nobody user in the DB '". $self->DSN ."'");
}
- return $RT::Handle->dbh;
+ return 1;
}
sub CheckCompatibility {
commit 4717d5729e49fe23e8127ef6d7941c5c8ba50c58
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Fri Jan 10 18:41:51 2014 -0500
Explicitly disconnect the dbh before forking, if it exists
This remoes the reliance on disconnect-on-DESTROY, and ensures that the
database handle is disconnected even if outstanding references to
$RT::Handle->dbh still exist.
diff --git a/sbin/rt-server.in b/sbin/rt-server.in
index 0d11f01..5bd8f3e 100644
--- a/sbin/rt-server.in
+++ b/sbin/rt-server.in
@@ -138,6 +138,7 @@ EOF
# we must disconnect DB before fork
if ($RT::Handle) {
+ $RT::Handle->dbh->disconnect if $RT::Handle->dbh;
$RT::Handle->dbh(undef);
undef $RT::Handle;
}
-----------------------------------------------------------------------
More information about the rt-commit
mailing list