Page MenuHomePhabricator

RevisionStore.php Could not determine title for page ID X and revision ID Y in EventBus::createRevisionAttrs
Closed, ResolvedPublic

Description

Trying to undelete a page on beta wiktionary:

https://en.wiktionary.beta.wmflabs.org/w/index.php?title=Special:Undelete&action=submit

Specifically:

https://en.wiktionary.beta.wmflabs.org/wiki/Special:Undelete/Anexai

Also seems to happen on other beta sites such as trying to undelete https://en.wikipedia.beta.wmflabs.org/wiki/Special:Undelete/Aftpage

Broken in https://gerrit.wikimedia.org/r/#/c/399174/

[WjwmjwpEE4AAAHaZNKoAAAAj] /w/index.php?title=Special:Undelete&action=submit MediaWiki\Storage\RevisionAccessException from line 217 of /srv/mediawiki/php-master/includes/Storage/RevisionStore.php: Could not determine title for page ID 708 and revision ID 1415

Backtrace:

#0 /srv/mediawiki/php-master/includes/Storage/RevisionStore.php(1078): MediaWiki\Storage\RevisionStore->getTitle(string, string)
#1 /srv/mediawiki/php-master/includes/Storage/RevisionStore.php(1112): MediaWiki\Storage\RevisionStore->newRevisionFromRow_1_29(stdClass, integer, NULL)
#2 /srv/mediawiki/php-master/includes/Storage/RevisionStore.php(1452): MediaWiki\Storage\RevisionStore->newRevisionFromRow(stdClass, integer, NULL)
#3 /srv/mediawiki/php-master/includes/Storage/RevisionStore.php(1424): MediaWiki\Storage\RevisionStore->loadRevisionFromConds(Wikimedia\Rdbms\DatabaseMysqli, array, integer, NULL)
#4 /srv/mediawiki/php-master/includes/Storage/RevisionStore.php(854): MediaWiki\Storage\RevisionStore->newRevisionFromConds(array, integer)
#5 /srv/mediawiki/php-master/includes/Revision.php(96): MediaWiki\Storage\RevisionStore->getRevisionById(integer, integer)
#6 /srv/mediawiki/php-master/extensions/EventBus/EventBus.php(261): Revision::newFromId(integer)
#7 /srv/mediawiki/php-master/extensions/EventBus/EventBus.hooks.php(65): EventBus::createRevisionAttrs(Revision)
#8 /srv/mediawiki/php-master/includes/Hooks.php(177): EventBusHooks::onRevisionInsertComplete(Revision, NULL, NULL)
#9 /srv/mediawiki/php-master/includes/Hooks.php(205): Hooks::callHook(string, array, array, NULL)
#10 /srv/mediawiki/php-master/includes/Revision.php(983): Hooks::run(string, array)
#11 /srv/mediawiki/php-master/includes/page/PageArchive.php(717): Revision->insertOn(Wikimedia\Rdbms\DatabaseMysqli)
#12 /srv/mediawiki/php-master/includes/page/PageArchive.php(434): PageArchive->undeleteRevisions(array, boolean, string)
#13 /srv/mediawiki/php-master/includes/specials/SpecialUndelete.php(1142): PageArchive->undelete(array, string, array, boolean, User)
#14 /srv/mediawiki/php-master/includes/specials/SpecialUndelete.php(201): SpecialUndelete->undelete()
#15 /srv/mediawiki/php-master/includes/specialpage/SpecialPage.php(522): SpecialUndelete->execute(NULL)
#16 /srv/mediawiki/php-master/includes/specialpage/SpecialPageFactory.php(578): SpecialPage->run(NULL)
#17 /srv/mediawiki/php-master/includes/MediaWiki.php(287): SpecialPageFactory::executePath(Title, RequestContext)
#18 /srv/mediawiki/php-master/includes/MediaWiki.php(851): MediaWiki->performRequest()
#19 /srv/mediawiki/php-master/includes/MediaWiki.php(523): MediaWiki->main()
#20 /srv/mediawiki/php-master/index.php(43): MediaWiki->run()
#21 /srv/mediawiki/w/index.php(3): include(string)
#22 {main}

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 21 2017, 9:26 PM
Addshore triaged this task as Unbreak Now! priority.Dec 21 2017, 9:26 PM
Restricted Application added subscribers: Liuxinyu970226, Jay8g, TerraCodes. · View Herald TranscriptDec 21 2017, 9:26 PM
Addshore updated the task description. (Show Details)Dec 21 2017, 9:33 PM
Restricted Application added a project: Analytics. · View Herald TranscriptDec 21 2017, 9:38 PM

I'm finding it hard to reproduce this one locally but this will probably be fixed by the already prepared patch https://gerrit.wikimedia.org/r/398385

The patch did not resolve the issue so this needs digging into a bit more.

After setting up replication for my local dev environment I can reproduce this.

The issue is caused by EventBus::createRevisionAttrs calling Revision::newFromId( $parentId ) during an undeletion, at which point it needs to select from the master.

Change 399764 had a related patch set uploaded (by Addshore; owner: Addshore):
[mediawiki/extensions/EventBus@master] Use Revision::newFromId with READ_LATEST for onRevisionInsertComplete

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

A patch fixing the error is up, although I still haven't identified the exact reason for the change in behaviour here.
However, that's it for today.

Change 399795 had a related patch set uploaded (by Addshore; owner: Addshore):
[mediawiki/core@master] [MCR] Add optional $title param to Revision byId methods

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

Change 399795 merged by jenkins-bot:
[mediawiki/core@master] [MCR] Add optional $title param to Revision byId methods

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

Change 399764 merged by jenkins-bot:
[mediawiki/extensions/EventBus@master] Pass a Title to Revision::newFromId in onRevisionInsertComplete

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

Addshore closed this task as Resolved.Dec 22 2017, 12:55 PM

Deleting pages with 2 or more revisions now works again on beta

Addshore renamed this task from MediaWiki\Storage\RevisionAccessException from line 217 of /srv/mediawiki/php-master/includes/Storage/RevisionStore.php Could not determine title for page ID 708 and revision ID 1415 to RevisionStore.php Could not determine title for page ID X and revision ID Y in EventBus::createRevisionAttrs.Dec 22 2017, 1:49 PM

[mediawiki/core@master] [MCR] Add optional $title param to Revision byId methods
https://gerrit.wikimedia.org/r/399795

I hope someone can answer the following questions.

How is changing the signature [0] of Revision::newFromId fixing the issue you encountered for callers that use the newFromId method? Is any other user (extension etc.) now required to inject the Title to avert a similar occurrence of "Could not determine title for ..." which has not been necessary until the MCR revision changes were merged into master. When should the Title be injected (don't tell me all the time, it wasn't necessary til now!)?

[0] https://github.com/wikimedia/mediawiki/blob/REL1_30/includes/Revision.php#L116-L118

@mwjames Yup, you are absolutely right, we need a different fix for this.

Change 399856 had a related patch set uploaded (by Addshore; owner: Addshore):
[mediawiki/core@master] [MCR] Don't require $title to be passed to Revision::newFromId

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

Change 399856 merged by jenkins-bot:
[mediawiki/core@master] [MCR] Don't require $title to be passed to Revision::newFromId

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

Change 400577 had a related patch set uploaded (by Addshore; owner: Addshore):
[mediawiki/core@master] [MCR] pass $queryFlags into RevisionStore::getTitle

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

Change 400602 had a related patch set (by Addshore) published:
[mediawiki/core@master] Revert "[MCR] Add optional $title param to Revision byId methods"

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

Change 400577 merged by jenkins-bot:
[mediawiki/core@master] [MCR] pass $queryFlags into RevisionStore::getTitle

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

Change 400602 merged by jenkins-bot:
[mediawiki/core@master] Revert "[MCR] Add optional $title param to Revision byId methods"

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

Change 403446 had a related patch set uploaded (by Addshore; owner: Addshore):
[mediawiki/core@wmf/1.31.0-wmf.16] [MCR] RevisionStore::getTitle final logged fallback to master

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

Change 403446 merged by jenkins-bot:
[mediawiki/core@wmf/1.31.0-wmf.16] [MCR] RevisionStore::getTitle final logged fallback to master

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

Change 404757 had a related patch set uploaded (by Addshore; owner: Addshore):
[mediawiki/core@wmf/1.31.0-wmf.17] [MCR] RevisionStore::getTitle final logged fallback to master

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

Change 404757 merged by jenkins-bot:
[mediawiki/core@wmf/1.31.0-wmf.17] [MCR] RevisionStore::getTitle final logged fallback to master

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

Change 403422 merged by jenkins-bot:
[mediawiki/core@master] [MCR] RevisionStore::getTitle final logged fallback to master

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