[Rt-commit] rt branch, 4.2/fewer-active-handles, created. rt-4.2.1-192-ga5873d2
Alex Vandiver
alexmv at bestpractical.com
Thu Feb 13 16:30:36 EST 2014
The branch, 4.2/fewer-active-handles has been created
at a5873d29214fbfe0099d3203803b5365b224a402 (commit)
- Log -----------------------------------------------------------------
commit 3caa4236abfd97a4fdded3da0d5c0005589bac4b
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 a8652e4..daa748e 100644
--- a/lib/RT/Handle.pm
+++ b/lib/RT/Handle.pm
@@ -250,7 +250,7 @@ sub CheckIntegrity {
return (0, 'no nobody user', "Couldn't find Nobody user in the DB '". $RT::Handle->DSN ."'");
}
- return $RT::Handle->dbh;
+ return 1;
}
sub CheckCompatibility {
commit a5873d29214fbfe0099d3203803b5365b224a402
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 68ec109..ab6d5fe 100644
--- a/sbin/rt-server.in
+++ b/sbin/rt-server.in
@@ -131,6 +131,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