Page MenuHomePhabricator

"Fatal Exception of Type InvalidArgumentException" when viewing pages with broken history caused by Special:MergeHistory


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:

[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
#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}


Request ID
Request URL

Event Timeline

Pppery created this task.Sep 19 2020, 9:51 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 19 2020, 9:51 PM
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.

Pppery added a comment.EditedSep 20 2020, 3:41 PM

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 updated the task description. (Show Details)Sep 22 2020, 4:34 PM
Krinkle edited Stack Trace. (Show Details)
Krinkle updated the task description. (Show Details)
daniel triaged this task as High priority.Sep 22 2020, 8:20 PM
daniel moved this task from Inbox to Ready on the Platform Team Workboards (Clinic Duty Team) board.

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.

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

Ammarpad closed this task as Resolved.Tue, Nov 10, 1:18 AM
Ammarpad claimed this task.
Pppery reopened this task as Open.Tue, Nov 10, 1:38 AM

This is not fixed because viewing 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

Moving back to inbox for code review