Made SqlBagOStuff unset DB handles on connection errors
authorAaron Schulz <aschulz@wikimedia.org>
Tue, 23 Jun 2015 19:28:03 +0000 (12:28 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Tue, 23 Jun 2015 19:28:03 +0000 (12:28 -0700)
* A "gone away" error can trigger ping(), which can fail,
  triggering a full open(). If this fails (as it often will),
  mConn is false and the DatabaseBase object is not usable.

Bug: T103435
Change-Id: Id2aaed87d2642e73c7811076da908180ee5ab5a4

includes/objectcache/SqlBagOStuff.php

index b8c1e75..a80c68f 100644 (file)
@@ -756,6 +756,8 @@ class SqlBagOStuff extends BagOStuff {
         * @param int $serverIndex
         */
        protected function markServerDown( $exception, $serverIndex ) {
+               unset( $this->conns[$serverIndex] ); // bug T103435
+
                if ( isset( $this->connFailureTimes[$serverIndex] ) ) {
                        if ( time() - $this->connFailureTimes[$serverIndex] >= 60 ) {
                                unset( $this->connFailureTimes[$serverIndex] );