Add DBConnRef sanity check to LoadBalancer::reuseConnection()
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 22 Sep 2016 22:19:17 +0000 (15:19 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Thu, 22 Sep 2016 22:19:17 +0000 (15:19 -0700)
Change-Id: I6b079b994f29c5f7953efe73982ef9e6946a21f8

includes/libs/rdbms/loadbalancer/LoadBalancer.php

index c030cb2..bda185a 100644 (file)
@@ -597,6 +597,13 @@ class LoadBalancer implements ILoadBalancer {
                         * should be ignored
                         */
                        return;
+               } elseif ( $conn instanceof DBConnRef ) {
+                       // DBConnRef already handles calling reuseConnection() and only passes the live
+                       // Database instance to this method. Any caller passing in a DBConnRef is broken.
+                       $this->connLogger->error( __METHOD__ . ": got DBConnRef instance.\n" .
+                               ( new RuntimeException() )->getTraceAsString() );
+
+                       return;
                }
 
                $domain = $conn->getDomainID();