Page MenuHomePhabricator

Fatal InvalidArgumentException "the provided Title object belongs to page" when viewing pages with history broken by Special:MergeHistory
Open, HighPublicPRODUCTION ERROR

Description

On the English Wikipedia, Module:Jct/city/Chinissai had it's entire history merged into another page. Due to T93469, this resulted in a page with no history.

Trying to view such a page results in an InvalidArgumentException:

message
[befd36e9-d82c-44c3-abae-f5a080aa98dc] /wiki/Module:Jct/city/Chinissai   InvalidArgumentException from line 1639 of /srv/mediawiki/php-1.36.0-wmf.9/includes/Revision/RevisionStore.php: Revision 819371998 belongs to page ID 56252475, the provided Title object belongs to page ID 41871839
trace
#0 /srv/mediawiki/php-1.36.0-wmf.9/includes/Revision/RevisionStore.php(2981): MediaWiki\Revision\RevisionStore->ensureRevisionRowMatchesTitle(stdClass, Title, array)
#1 /srv/mediawiki/php-1.36.0-wmf.9/includes/page/WikiPage.php(710): MediaWiki\Revision\RevisionStore->getKnownCurrentRevision(Title, integer)
#2 /srv/mediawiki/php-1.36.0-wmf.9/includes/page/WikiPage.php(747): WikiPage->loadLastEdit()
#3 /srv/mediawiki/php-1.36.0-wmf.9/includes/page/WikiPage.php(602): WikiPage->getRevisionRecord()
#4 /srv/mediawiki/php-1.36.0-wmf.9/includes/libs/objectcache/wancache/WANObjectCache.php(1533): WikiPage->{closure}(boolean, integer, array, NULL, array)
#5 /srv/mediawiki/php-1.36.0-wmf.9/includes/libs/objectcache/wancache/WANObjectCache.php(1376): WANObjectCache->fetchOrRegenerate(string, integer, Closure, array, array)
#6 /srv/mediawiki/php-1.36.0-wmf.9/includes/page/WikiPage.php(615): WANObjectCache->getWithSetCallback(string, integer, Closure)
#7 /srv/mediawiki/php-1.36.0-wmf.9/includes/page/WikiPage.php(275): WikiPage->getContentModel()
#8 /srv/mediawiki/php-1.36.0-wmf.9/includes/page/WikiPage.php(261): WikiPage->getContentHandler()
#9 /srv/mediawiki/php-1.36.0-wmf.9/includes/page/Article.php(2517): WikiPage->getActionOverrides()
#10 /srv/mediawiki/php-1.36.0-wmf.9/includes/actions/Action.php(130): Article->getActionOverrides()
#11 /srv/mediawiki/php-1.36.0-wmf.9/includes/actions/Action.php(189): Action::factory(string, Article, RequestContext)
#12 /srv/mediawiki/php-1.36.0-wmf.9/includes/MediaWiki.php(166): Action::getActionName(RequestContext)
#13 /srv/mediawiki/php-1.36.0-wmf.9/includes/MediaWiki.php(903): MediaWiki->getAction()
#14 /srv/mediawiki/php-1.36.0-wmf.9/includes/MediaWiki.php(543): MediaWiki->main()
#15 /srv/mediawiki/php-1.36.0-wmf.9/index.php(53): MediaWiki->run()
#16 /srv/mediawiki/php-1.36.0-wmf.9/index.php(46): wfIndexMain()
#17 /srv/mediawiki/w/index.php(3): require(string)
#18 {main}

Event Timeline

Daimona updated the task description. (Show Details)
Daimona edited Stack Trace. (Show Details)
Daimona set Phatality ID to e53734155dbec886d8a2aebaf61934b9619d3619fced140fdc3f67e181cd958b.

Well... that's a good lesson learned. Should have just G6'd 'em.

No, you revealed a bug. I'd say that's worth the inconvenience of two extremely backend pages being unviewable. If it hadn't come up now, it would have come up later, most likely with something other than an obscure sandbox.

This bug must be recently introduced, since I was definitely able to view the pages when I nominated them for deletion, and nothing has changed about the pages since.

Fair point, since clearly I would have noticed it after I merged if it were throwing errors.

Krinkle edited Stack Trace. (Show Details)
Krinkle updated the task description. (Show Details)

This will be temporarily fixed by having Scribunto content model to support redirects, there are some patches on that already. But to fix it once and for all, I can see two options: HistoryMerge needs to recognize these content models and delete the source page if no revision is remaining, since there's nothing more to see. It'll just be like how a move without leaving a redirect is currently treated. Otherwise this exception will always be thrown as these pages have all their revisions living elsewhere after the merge.
The other way is to make it mandatory for every content model to support redirect. That seems radical and may have its own downsides.

Change 630580 had a related patch set uploaded (by Ammarpad; owner: Ammarpad):
[mediawiki/core@master] Improve handling of content models that do not supports redirect.

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

Change 630580 merged by jenkins-bot:
[mediawiki/core@master] Improve handling of content models that do not support redirect.

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

Ammarpad claimed this task.

This is not fixed because viewing https://en.wikipedia.org/wiki/Module:Jct/city/Chinissai still results in an error.

Change 641198 had a related patch set uploaded (by Ammarpad; owner: Ammarpad):
[mediawiki/core@master] Add maintenance script to delete corrupted pages

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

daniel added a subscriber: daniel.

Moving to code review on the clinic duty board. This is a production error and should be resolved as part of clinic duty.

Change 658575 had a related patch set uploaded (by Daniel Kinzler; owner: Daniel Kinzler):
[mediawiki/core@master] RevisionStore: better exception when rev belongs to wrong page

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

Change 658575 merged by jenkins-bot:
[mediawiki/core@master] RevisionStore: better exception when rev belongs to wrong page

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

Krinkle renamed this task from "Fatal Exception of Type InvalidArgumentException" when viewing pages with broken history caused by Special:MergeHistory to Fatal InvalidArgumentException "the provided Title object belongs to page" when viewing pages with history broken by Special:MergeHistory.Apr 1 2021, 1:24 AM

Change 683242 had a related patch set uploaded (by Daniel Kinzler; author: Daniel Kinzler):

[mediawiki/core@master] RevisionStore: don't die on mismatching Titles

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

Change 683242 merged by jenkins-bot:

[mediawiki/core@master] RevisionStore: don't die on mismatching Titles

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

Change 641198 merged by jenkins-bot:

[mediawiki/core@master] Add maintenance script to delete corrupted pages

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