Page MenuHomePhabricator

Logstash messages for DBQueryError should contain the actual error
Closed, ResolvedPublic

Description

The normalised and trimmed version of these messages that developers first see, is:

Exception mesage (current)
[{exception_id}] {exception_url}   Wikimedia\Rdbms\DBQueryError from line 1679 of /srv/mediawiki/php-1.35.0-wmf.35/includes/libs/rdbms/database/Database.php: A database query error has occurred. Did you forget to run your application's database schema upd

Aside from the word DBQueryError there is no useful information here (the path, file and line are all boilerplate to the caller).

The expanded version is currently as follows:

Exception message - expanded (current)
[99bddf1e-174c-4fa9-bf7d-d0c69be4d9ee] /w/index.php?title=Special:MovePage&action=submit   Wikimedia\Rdbms\DBQueryError from line 1679 of /srv/mediawiki/php-1.35.0-wmf.35/includes/libs/rdbms/database/Database.php: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading? 
Query: UPDATE  `page` SET page_namespace = 0,page_title = 'The_Clash' WHERE page_id = 123
Function: MovePage::moveToInternal
Error: 1062 Duplicate entry '0-The_Clash' for key 'name_title' (10…)

There is also a secondary message, logged to the DBQuery channel:

DBQuery message (current)
MovePage::moveToInternal	10.…	1062	Duplicate entry '0-The_Clash' for key 'name_title' (10.…)	UPDATE  `page` SET page_namespace = 0,page_title = 'The_Clash' WHERE page_id = 123
DBQuery message - expanded (current)
normalized_error:  {fname}	{db_server}	{errno}	{error}	{sql1line}
error:        Duplicate entry '0-Deir_ez-Zor_Governorate_clashes' for key 'name_title' (10.…)
sql1line:     UPDATE  `page` SET page_namespace = 0,page_title = 'The_Clash' WHERE page_id = 123
trace:
…
#3 /srv/mediawiki/php-1.35.0-wmf.35/includes/MovePage.php(855): Wikimedia\Rdbms\Database->update(string, array, string, string)
#4 /srv/mediawiki/php-1.35.0-wmf.35/includes/MovePage.php(569): MovePage->moveToInternal(User, Title, string, boolean, array)
#5 /srv/mediawiki/php-1.35.0-wmf.35/includes/MovePage.php(412): MovePage->moveUnsafe(User, string, boolean, array)
#6 /srv/mediawiki/php-1.35.0-wmf.35/includes/specials/SpecialMovepage.php(632): MovePage->moveIfAllowed(User, string, boolean)
#7 /srv/mediawiki/php-1.35.0-wmf.35/includes/specials/SpecialMovepage.php(137): MovePageForm->doSubmit()
…
Proposed
  • Remove the repetition of "There was an error" and unhelpful reminder to "Did you forget to run …?" from the exception object. Instead, output this in the HTML output layer where it more useful to its intended audience (during upgrades for local development and third-parties, not in production).
  • Change the Exception message start with and contain only the faulty method and the error code. This way the message can be aggregated and will thus stand out instead of lost in the noise as unique one-offs.
  • Transfer the other information in extra fields, outside the exception message.
  • Denormalise the DBQuery message so that {fname} and {errno} are not placeholders. This over-normalization currently makes also lost in the noise.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Reedy renamed this task from Logtash messages for DBQueryError should contain the actual error to Logstash messages for DBQueryError should contain the actual error.Jun 11 2020, 9:19 PM

Change 604880 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/core@master] rdbms: Move connection error message from DBQueryError to DBQueryDisconnectedError

https://gerrit.wikimedia.org/r/604880

Change 604881 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/core@master] rdbms: Denormalize fname and errno in DBQuery log messages

https://gerrit.wikimedia.org/r/604881

Change 604882 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/core@master] rdbms: Move "Did you forget…" from DBQueryError to MWExceptionHandler

https://gerrit.wikimedia.org/r/604882

Change 604882 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/core@master] rdbms: Move "Did you forget…" from DBQueryError to MWExceptionHandler

https://gerrit.wikimedia.org/r/604882

BeforeAfter
Krinkle triaged this task as Medium priority.Jun 12 2020, 6:43 PM
Krinkle moved this task from Untriaged to Rdbms library on the Wikimedia-Rdbms board.
Krinkle moved this task from Inbox to Blocked (old) on the Performance-Team board.

Change 604880 merged by jenkins-bot:
[mediawiki/core@master] rdbms: Move connection error message from DBQueryError to DBQueryDisconnectedError

https://gerrit.wikimedia.org/r/604880

Change 604881 merged by jenkins-bot:
[mediawiki/core@master] rdbms: Denormalize fname and errno in DBQuery log messages

https://gerrit.wikimedia.org/r/604881

Change 604882 merged by jenkins-bot:
[mediawiki/core@master] rdbms: Move "Did you forget…" from DBQueryError to MWExceptionHandler

https://gerrit.wikimedia.org/r/604882