Page MenuHomePhabricator

MediaWiki\Revision\RevisionAccessException: Could not determine title for page ID {page_id} and revision ID {rev_id}
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
normalized_message
[{reqId}] {exception_url}   MediaWiki\Revision\RevisionAccessException: Could not determine title for page ID {page_id} and revision ID {rev_id}
exception.trace
from /srv/mediawiki/php-1.39.0-wmf.13/includes/Revision/RevisionStore.php(362)
#0 /srv/mediawiki/php-1.39.0-wmf.13/includes/Revision/RevisionStore.php(352): MediaWiki\Revision\RevisionStore->getPage(integer, integer, integer)
#1 /srv/mediawiki/php-1.39.0-wmf.13/includes/Revision/RevisionStore.php(1732): MediaWiki\Revision\RevisionStore->getPage(integer, integer, integer)
#2 /srv/mediawiki/php-1.39.0-wmf.13/includes/Revision/RevisionStore.php(1611): MediaWiki\Revision\RevisionStore->newRevisionFromRowAndSlots(stdClass, NULL, integer, NULL, boolean)
#3 /srv/mediawiki/php-1.39.0-wmf.13/extensions/Translate/src/TranslatorInterface/Aid/EditSummariesAid.php(42): MediaWiki\Revision\RevisionStore->newRevisionFromRow(stdClass)
#4 /srv/mediawiki/php-1.39.0-wmf.13/extensions/Translate/src/TranslatorInterface/Aid/TranslationAidsActionApi.php(111): MediaWiki\Extension\Translate\TranslatorInterface\Aid\EditSummariesAid->getData()
#5 /srv/mediawiki/php-1.39.0-wmf.13/includes/api/ApiMain.php(1900): MediaWiki\Extension\Translate\TranslatorInterface\Aid\TranslationAidsActionApi->execute()
#6 /srv/mediawiki/php-1.39.0-wmf.13/includes/api/ApiMain.php(874): ApiMain->executeAction()
#7 /srv/mediawiki/php-1.39.0-wmf.13/includes/api/ApiMain.php(845): ApiMain->executeActionWithErrorHandling()
#8 /srv/mediawiki/php-1.39.0-wmf.13/api.php(90): ApiMain->execute()
#9 /srv/mediawiki/php-1.39.0-wmf.13/api.php(45): wfApiMain()
#10 /srv/mediawiki/w/api.php(3): require(string)
#11 {main}
Impact
Notes

Page id is 0 in all cases. Seems to be caused by https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Translate/+/779829.

Details

MediaWiki Version
1.39.0-wmf.13
Request URL
https://www.mediawiki.org/w/api.php?action=translationaids&format=*&title=*&uselang=*

Event Timeline

~35 instances in the last 15 minutes, tagging as a blocker for now.

Do you have example rev_ids? I just successfully loaded the translation aids (including the edit summaries) for a random translation unit on mediawiki.org, so it’s not totally broken. Maybe the broken revisions have something in common.

Do you have example rev_ids? I just successfully loaded the translation aids (including the edit summaries) for a random translation unit on mediawiki.org, so it’s not totally broken. Maybe the broken revisions have something in common.

Could not determine title for page ID 0 and revision ID 699461

It's actually only that revision id.

MariaDB [mediawikiwiki_p]> SELECT * FROM revision WHERE rev_id = 699461;
+--------+----------+----------------+-----------+----------------+----------------+-------------+---------+---------------+---------------------------------+
| rev_id | rev_page | rev_comment_id | rev_actor | rev_timestamp  | rev_minor_edit | rev_deleted | rev_len | rev_parent_id | rev_sha1                        |
+--------+----------+----------------+-----------+----------------+----------------+-------------+---------+---------------+---------------------------------+
| 699461 |        0 |         349590 |   1091377 | 20121012174843 |              0 |           0 |    2490 |             0 | b7rlqawc9gdaezbggvx2tt26tnsdsui |
+--------+----------+----------------+-----------+----------------+----------------+-------------+---------+---------------+---------------------------------+
1 row in set (0.002 sec)

MariaDB [mediawikiwiki_p]> SELECT COUNT(*) FROM revision WHERE rev_page = 0;
+----------+
| COUNT(*) |
+----------+
|      320 |
+----------+
1 row in set (0.003 sec)

It looks like the code doesn’t check whether the page exists, it just assumes that non-existent pages (page ID is 0) don’t have records in the database, but in fact there are hundreds of such records. While it looks like a database corruption, we can unblock the train by short-circuiting in case the page doesn’t exist:

diff --git a/src/TranslatorInterface/Aid/EditSummariesAid.php b/src/TranslatorInterface/Aid/EditSummariesAid.php
index 1050e3f6a..f8544234d 100644
--- a/src/TranslatorInterface/Aid/EditSummariesAid.php
+++ b/src/TranslatorInterface/Aid/EditSummariesAid.php
@@ -18,6 +18,9 @@ class EditSummariesAid extends TranslationAid {
 
        public function getData(): array {
                $pageTitle = $this->handle->getTitle();
+               if ( !$pageTitle->exists() ) {
+                       return [];
+               }
                $mwService = MediaWikiServices::getInstance();
                $revisionFactory = $mwService->getRevisionFactory();

Change 799266 had a related patch set uploaded (by Abijeet Patro; author: Abijeet Patro):

[mediawiki/extensions/Translate@master] EditSummariesAid: Check if title exists before further processing

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

abi_ triaged this task as Unbreak Now! priority.
MariaDB [mediawikiwiki_p]> SELECT * FROM revision WHERE rev_id = 699461;
+--------+----------+----------------+-----------+----------------+----------------+-------------+---------+---------------+---------------------------------+
| rev_id | rev_page | rev_comment_id | rev_actor | rev_timestamp  | rev_minor_edit | rev_deleted | rev_len | rev_parent_id | rev_sha1                        |
+--------+----------+----------------+-----------+----------------+----------------+-------------+---------+---------------+---------------------------------+
| 699461 |        0 |         349590 |   1091377 | 20121012174843 |              0 |           0 |    2490 |             0 | b7rlqawc9gdaezbggvx2tt26tnsdsui |
+--------+----------+----------------+-----------+----------------+----------------+-------------+---------+---------------+---------------------------------+
1 row in set (0.002 sec)

MariaDB [mediawikiwiki_p]> SELECT COUNT(*) FROM revision WHERE rev_page = 0;
+----------+
| COUNT(*) |
+----------+
|      320 |
+----------+
1 row in set (0.003 sec)

It looks like the code doesn’t check whether the page exists, it just assumes that non-existent pages (page ID is 0) don’t have records in the database, but in fact there are hundreds of such records. While it looks like a database corruption, we can unblock the train by short-circuiting in case the page doesn’t exist:

diff --git a/src/TranslatorInterface/Aid/EditSummariesAid.php b/src/TranslatorInterface/Aid/EditSummariesAid.php
index 1050e3f6a..f8544234d 100644
--- a/src/TranslatorInterface/Aid/EditSummariesAid.php
+++ b/src/TranslatorInterface/Aid/EditSummariesAid.php
@@ -18,6 +18,9 @@ class EditSummariesAid extends TranslationAid {
 
        public function getData(): array {
                $pageTitle = $this->handle->getTitle();
+               if ( !$pageTitle->exists() ) {
+                       return [];
+               }
                $mwService = MediaWikiServices::getInstance();
                $revisionFactory = $mwService->getRevisionFactory();

Thanks for getting that data from production. I've submitted a patch to unblock the train.

None of the other translation aids have that check either but appear to be not having issues.

Ladsgroup added a subscriber: Ladsgroup.

I suggest creating a separate ticket for the revisions with page id of zero in the database.

Change 798816 had a related patch set uploaded (by KartikMistry; author: Abijeet Patro):

[mediawiki/extensions/Translate@wmf/1.39.0-wmf.13] EditSummariesAid: Check if title exists before further processing

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

Change 799266 merged by jenkins-bot:

[mediawiki/extensions/Translate@master] EditSummariesAid: Check if title exists before further processing

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

Change 798816 merged by jenkins-bot:

[mediawiki/extensions/Translate@wmf/1.39.0-wmf.13] EditSummariesAid: Check if title exists before further processing

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

Mentioned in SAL (#wikimedia-operations) [2022-05-25T09:21:31Z] <kartik@deploy1002> Synchronized php-1.39.0-wmf.13/extensions/Translate/src/TranslatorInterface/Aid/EditSummariesAid.php: Backport: [[gerrit:798816|EditSummariesAid: Check if title exists before further processing (T309151)]] (duration: 00m 49s)

I suggest creating a separate ticket for the revisions with page id of zero in the database.

T309185

Not seeing any other occurrences of this issue since the patch was deployed via backports.