summaryrefslogtreecommitdiffstats
path: root/Bugzilla.pm
diff options
context:
space:
mode:
authorbbaetz%acm.org <>2003-02-14 19:37:38 +0100
committerbbaetz%acm.org <>2003-02-14 19:37:38 +0100
commita88bc79dcd14ef13b9a4850c5192981201aa23bf (patch)
tree3a9f651dbc1b016ab7365590def2e3d891d7ad41 /Bugzilla.pm
parentd59e06001d9634de6b5297f9ed93e278b393706a (diff)
downloadbugzilla-a88bc79dcd14ef13b9a4850c5192981201aa23bf.tar.gz
bugzilla-a88bc79dcd14ef13b9a4850c5192981201aa23bf.tar.xz
Bug 192531 - Bugzilla not properly closing DB statement handles
Change code to work arround a perl < 5.8 leak when localising the tied statement attributes. Also, clear the sql statestack compat stuff so that the handles are really dead by the time we disconnect r,a=justdave
Diffstat (limited to 'Bugzilla.pm')
-rw-r--r--Bugzilla.pm11
1 files changed, 11 insertions, 0 deletions
diff --git a/Bugzilla.pm b/Bugzilla.pm
index 56d1f24cc..366acb163 100644
--- a/Bugzilla.pm
+++ b/Bugzilla.pm
@@ -94,6 +94,17 @@ sub switch_to_main_db {
sub _cleanup {
undef $_cgi;
+ # See bug 192531. If we don't clear the possibly active statement handles,
+ # then when this is called from the END block, it happens _before_ the
+ # destructors in Bugzilla::DB have happened.
+ # See http://rt.perl.org/rt2/Ticket/Display.html?id=17450#38810
+ # Without disconnecting explicitly here, noone notices, because DBI::END
+ # ends up calling DBD::mysql's $drh->disconnect_all, which is a noop.
+ # This code is evil, but it needs to be done, at least until SendSQL and
+ # friends can be removed
+ @Bugzilla::DB::SQLStateStack = ();
+ undef $Bugzilla::DB::_current_sth;
+
# When we support transactions, need to ->rollback here
$_dbh_main->disconnect if $_dbh_main;
$_dbh_shadow->disconnect if $_dbh_shadow and Param("shadowdb");