Merge "Ignore errors in RedisConnectionPool destructor"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 14 Aug 2017 15:01:28 +0000 (15:01 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 14 Aug 2017 15:01:28 +0000 (15:01 +0000)
includes/libs/redis/RedisConnectionPool.php

index 99c2c3c..509240f 100644 (file)
@@ -396,9 +396,14 @@ class RedisConnectionPool implements LoggerAwareInterface {
        function __destruct() {
                foreach ( $this->connections as $server => &$serverConnections ) {
                        foreach ( $serverConnections as $key => &$connection ) {
-                               /** @var Redis $conn */
-                               $conn = $connection['conn'];
-                               $conn->close();
+                               try {
+                                       /** @var Redis $conn */
+                                       $conn = $connection['conn'];
+                                       $conn->close();
+                               } catch ( RedisException $e ) {
+                                       // The destructor can be called on shutdown when random parts of the system
+                                       // have been destructed already, causing weird errors. Ignore them.
+                               }
                        }
                }
        }