From: Gergő Tisza Date: Sun, 13 Aug 2017 14:18:18 +0000 (+0000) Subject: Ignore errors in RedisConnectionPool destructor X-Git-Tag: 1.31.0-rc.0~2394^2 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmes_infos.php?a=commitdiff_plain;h=a778ea13160cf3c087415dc8e35517c7785ee0a9;p=lhc%2Fweb%2Fwiklou.git Ignore errors in RedisConnectionPool destructor The destructor can be called on shutdown so any operation which relies on another object or resource can fail. E.g. running anything involving Redis (such as >>new Message('').''<<) from shell.php and then exiting will result in a RedisException since the PHP engine closes the Redis connection before destroying the connection pool. Such errors can be safely ignored. Change-Id: I38474a9dda89c82edbcb878facb4a97740e9189a --- diff --git a/includes/libs/redis/RedisConnectionPool.php b/includes/libs/redis/RedisConnectionPool.php index 99c2c3c287..509240f71c 100644 --- a/includes/libs/redis/RedisConnectionPool.php +++ b/includes/libs/redis/RedisConnectionPool.php @@ -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. + } } } }