From 68008dce609b1ad4327430039630458fb534d722 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 17 Aug 2017 11:24:23 -0700 Subject: [PATCH] Fix a possible database ref fatal during MySQL setup checks if a host is unreachable Summary: Ref T12966. See that task for a description and reproduction steps. If you put Phabricator in a master/replica configuration and then restart it, we may fatal here if the master is unreachable. Instead, we should survive setup checks. Test Plan: Put Phabricator in a master/replica configuration, explicitly disabled the master by misconfiguring the port, restarted Phabricator. Before: fatal; after: login screen in read-only mode. Reviewers: chad Reviewed By: chad Maniphest Tasks: T12966 Differential Revision: https://secure.phabricator.com/D18442 --- .../config/check/PhabricatorMySQLSetupCheck.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/applications/config/check/PhabricatorMySQLSetupCheck.php b/src/applications/config/check/PhabricatorMySQLSetupCheck.php index 8e2f39a504..dad9ba6d7b 100644 --- a/src/applications/config/check/PhabricatorMySQLSetupCheck.php +++ b/src/applications/config/check/PhabricatorMySQLSetupCheck.php @@ -9,7 +9,13 @@ final class PhabricatorMySQLSetupCheck extends PhabricatorSetupCheck { protected function executeChecks() { $refs = PhabricatorDatabaseRef::getActiveDatabaseRefs(); foreach ($refs as $ref) { - $this->executeRefChecks($ref); + try { + $this->executeRefChecks($ref); + } catch (AphrontConnectionQueryException $ex) { + // If we're unable to connect to a host, just skip the checks for it. + // This can happen if we're restarting during a cluster incident. See + // T12966 for discussion. + } } }