Error message is not being logged when unable to connect to the database


#1

Observed Behavior:
Users are reporting that they are seeing the follow error message multiple times per day:

I can see a number of 500s in our nginx access logs, but nothing in the PHP-FPM logs.

Expected Behavior:
I expect to see the error message ($issue->getMessage()) in the PHP-FPM logs, which would help me to diagnose the problem. For now, I have manually applied the following patch:

diff --git src/aphront/configuration/AphrontApplicationConfiguration.php src/aphront/configuration/AphrontApplicationConfiguration.php
index 60b12557c..9c07cd736 100644
--- src/aphront/configuration/AphrontApplicationConfiguration.php
+++ src/aphront/configuration/AphrontApplicationConfiguration.php
@@ -95,6 +95,7 @@ abstract class AphrontApplicationConfiguration extends Phobject {
         $database_exception,
         true);
       $response = PhabricatorSetupCheck::newIssueResponse($issue);
+      phlog($issue->getMessage());
       return self::writeResponse($sink, $response);
     }

Phabricator Version:
rP237a2a190984cb359f8de62cdf023cfcff8d80e6
rARC45a8d22c74a62624e69f5cd6ce901c9ab2658904
rPHU414a4c6abb1b574f576d72432e8ceb4b9b3cbf91

Reproduction Steps:

  1. Load Phabricator successfully (so that the setup checks pass)
  2. Revoke the MySQL permissions for the MySQL user that Phabricator is running as.
  3. Tail the PHP-FPM logs whilst attempting to load any page.

#2

Unrelated, but I’m also see a lot of these warnings in our logs:

[13-Dec-2018 00:33:56 Etc/UTC] [2018-12-13 00:33:56] PHLOG: 'UNSAFE: Raw string ("LEFT JOIN") passed to query ("%s %s e_subtask
          ON e_subtask.src = task.phid
          AND e_subtask.type = %s
         %Q %T subtask
           ON e_subtask.dst = subtask.phid
           AND subtask.status IN (%Ls)") for "%Q" conversion. %Q should be passed a query string.' at [/usr/local/src/libphutil/src/xsprintf/qsprintf.php:435]

#3

Thanks, see https://secure.phabricator.com/D19880.