Ignore reuseConnection() errors after LoadBalancer/LBFactory destruction
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 6 Oct 2016 00:53:35 +0000 (17:53 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Thu, 6 Oct 2016 01:04:26 +0000 (01:04 +0000)
Bug: T147520
Change-Id: I9fe6acb0ab24127c1e9f3279129ff46c6b480873

includes/libs/rdbms/loadbalancer/LoadBalancer.php

index 66e4fcf..73aa23c 100644 (file)
@@ -614,6 +614,10 @@ class LoadBalancer implements ILoadBalancer {
                        return;
                }
 
+               if ( $this->disabled ) {
+                       return; // DBConnRef handle probably survived longer than the LoadBalancer
+               }
+
                $domain = $conn->getDomainID();
                if ( !isset( $this->mConns['foreignUsed'][$serverIndex][$domain] ) ) {
                        throw new InvalidArgumentException( __METHOD__ .
@@ -1533,6 +1537,6 @@ class LoadBalancer implements ILoadBalancer {
 
        function __destruct() {
                // Avoid connection leaks for sanity
-               $this->closeAll();
+               $this->disable();
        }
 }