Page MenuHomePhabricator

Some pages have revisions by invalid usernames (with leading or trailing space) which break the "Info" and "History" views
Open, NormalPublic

Description

Forked from T137147: Unable to view action=info for certain pages (InfoAction throws ParameterAssertionException: invalid DB key)

Example urls:

I just spotted this again in the logs.
Triggers on https://en.wikipedia.org/w/index.php?title=Audi&action=info

Wikimedia\Assert\ParameterAssertionException Bad value for parameter $dbkey: invalid DB key 'Brad_'
#0 /srv/mediawiki/php-1.31.0-wmf.23/includes/title/TitleValue.php(86): Wikimedia\Assert\Assert::parameter(boolean, string, string)
#1 /srv/mediawiki/php-1.31.0-wmf.23/includes/cache/LinkBatch.php(176): TitleValue->__construct(integer, string)
#2 /srv/mediawiki/php-1.31.0-wmf.23/includes/cache/LinkBatch.php(140): LinkBatch->addResultToCache(LinkCache, Wikimedia\Rdbms\ResultWrapper)
#3 /srv/mediawiki/php-1.31.0-wmf.23/includes/cache/LinkBatch.php(127): LinkBatch->executeInto(LinkCache)
#4 /srv/mediawiki/php-1.31.0-wmf.23/includes/actions/InfoAction.php(540): LinkBatch->execute()
#5 /srv/mediawiki/php-1.31.0-wmf.23/includes/actions/InfoAction.php(120): InfoAction->pageInfo()
#6 /srv/mediawiki/php-1.31.0-wmf.23/includes/actions/FormlessAction.php(43): InfoAction->onView()
#7 /srv/mediawiki/php-1.31.0-wmf.23/includes/MediaWiki.php(500): FormlessAction->show()
#8 /srv/mediawiki/php-1.31.0-wmf.23/includes/MediaWiki.php(294): MediaWiki->performAction(Article, Title)
#9 /srv/mediawiki/php-1.31.0-wmf.23/includes/MediaWiki.php(861): MediaWiki->performRequest()
#10 /srv/mediawiki/php-1.31.0-wmf.23/includes/MediaWiki.php(524): MediaWiki->main()
#11 /srv/mediawiki/php-1.31.0-wmf.23/index.php(42): MediaWiki->run()
#12 /srv/mediawiki/w/index.php(3): include(string)
#13 {main}

I never noticed this task was re-opened. But in both cases I think the error is a bit different - somehow users were created with non-canonical usernames? "Brad_" shouldn't be a usable username, it should be "Brad" - same with " Harest", the leading space is invalid.

Event Timeline

Krinkle created this task.Jul 20 2018, 1:46 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 20 2018, 1:46 AM
Krinkle triaged this task as High priority.Jul 20 2018, 1:47 AM

The number of page this affects is presumably limited. But the impact is quite severe given it makes it impossible to "View history" or view "Page information" for these pages.

However, given the page can still be viewed and edited, it also affects community's ability to counter vandalism.

Krinkle updated the task description. (Show Details)Jul 20 2018, 1:47 AM
Anomie added a subscriber: Anomie.Jul 20 2018, 1:54 PM

This seems like more or less a duplicate or effect of T2323: usernames in really old revisions (copied from pre-MediaWiki versions of Wikipedia) cause various problems.

This seems like more or less a duplicate or effect of T2323: usernames in really old revisions (copied from pre-MediaWiki versions of Wikipedia) cause various problems.

Might be. Although note that T2323 does not cause an exception. It is able to show the revision in diff view without issue, and on Special:Contributions it simply shows no results (or only results for the closest valid form of the username, e.g. in case of simple underscores within a name)

I recently noticed this problem at:
https://en.wikipedia.org/w/index.php?title=AD_42&limit=1&dir=prev&action=history

In that case, per the January 2003 database dump, the username is "branteaton" (note the lowercase "b").

It doesn't affect usernames like "Larry_sanger" though ... if it did, this revision history (among many others) would cause problems:
https://en.wikipedia.org/w/index.php?title=Prince_Harry,_Duke_of_Sussex&dir=prev&action=history

Even browsing to such a page (e.g. https://test.wikipedia.org/wiki/User:Test_/test1) results in a mediawiki error, dump below:

MediaWiki internal error.

Original exception: [XP8PjwpAICkAAEDrqXEAAAAO] /wiki/User:Test_/test1 Wikimedia\Assert\ParameterAssertionException from line 63 of /srv/mediawiki/php-1.34.0-wmf.8/vendor/wikimedia/assert/src/Assert.php: Bad value for parameter $dbkey: invalid DB key 'Test_'
Backtrace:
#0 /srv/mediawiki/php-1.34.0-wmf.8/includes/title/TitleValue.php(105): Wikimedia\Assert\Assert::parameter(boolean, string, string)
#1 /srv/mediawiki/php-1.34.0-wmf.8/includes/title/NamespaceInfo.php(162): TitleValue->__construct(integer, string)
#2 /srv/mediawiki/php-1.34.0-wmf.8/includes/Title.php(1523): NamespaceInfo->getTalkPage(Title)
#3 /srv/mediawiki/php-1.34.0-wmf.8/extensions/WikiLove/includes/WikiLoveHooks.php(166): Title->getTalkPage()
#4 /srv/mediawiki/php-1.34.0-wmf.8/extensions/WikiLove/includes/WikiLoveHooks.php(57): WikiLoveHooks::getUserTalkPage(Title, User)
#5 /srv/mediawiki/php-1.34.0-wmf.8/includes/Hooks.php(174): WikiLoveHooks::onBeforePageDisplay(OutputPage, SkinMonoBook)
#6 /srv/mediawiki/php-1.34.0-wmf.8/includes/Hooks.php(234): Hooks::callHook(string, array, array, NULL, string)
#7 /srv/mediawiki/php-1.34.0-wmf.8/includes/OutputPage.php(2746): Hooks::runWithoutAbort(string, array)
#8 /srv/mediawiki/php-1.34.0-wmf.8/includes/MediaWiki.php(872): OutputPage->output(boolean)
#9 /srv/mediawiki/php-1.34.0-wmf.8/includes/MediaWiki.php(884): MediaWiki->{closure}()
#10 /srv/mediawiki/php-1.34.0-wmf.8/includes/MediaWiki.php(515): MediaWiki->main()
#11 /srv/mediawiki/php-1.34.0-wmf.8/index.php(42): MediaWiki->run()
#12 /srv/mediawiki/w/index.php(3): require(string)
#13 {main}

Exception caught inside exception handler: [XP8PjwpAICkAAEDrqXEAAAAO] /wiki/User:Test_/test1 Wikimedia\Assert\ParameterAssertionException from line 63 of /srv/mediawiki/php-1.34.0-wmf.8/vendor/wikimedia/assert/src/Assert.php: Bad value for parameter $dbkey: invalid DB key 'Test_'
Backtrace:
#0 /srv/mediawiki/php-1.34.0-wmf.8/includes/title/TitleValue.php(105): Wikimedia\Assert\Assert::parameter(boolean, string, string)
#1 /srv/mediawiki/php-1.34.0-wmf.8/includes/title/NamespaceInfo.php(162): TitleValue->__construct(integer, string)
#2 /srv/mediawiki/php-1.34.0-wmf.8/includes/Title.php(1523): NamespaceInfo->getTalkPage(Title)
#3 /srv/mediawiki/php-1.34.0-wmf.8/extensions/WikiLove/includes/WikiLoveHooks.php(166): Title->getTalkPage()
#4 /srv/mediawiki/php-1.34.0-wmf.8/extensions/WikiLove/includes/WikiLoveHooks.php(57): WikiLoveHooks::getUserTalkPage(Title, User)
#5 /srv/mediawiki/php-1.34.0-wmf.8/includes/Hooks.php(174): WikiLoveHooks::onBeforePageDisplay(OutputPage, SkinMonoBook)
#6 /srv/mediawiki/php-1.34.0-wmf.8/includes/Hooks.php(234): Hooks::callHook(string, array, array, NULL, string)
#7 /srv/mediawiki/php-1.34.0-wmf.8/includes/OutputPage.php(2746): Hooks::runWithoutAbort(string, array)
#8 /srv/mediawiki/php-1.34.0-wmf.8/includes/exception/MWExceptionRenderer.php(134): OutputPage->output()
#9 /srv/mediawiki/php-1.34.0-wmf.8/includes/exception/MWExceptionRenderer.php(53): MWExceptionRenderer::reportHTML(Wikimedia\Assert\ParameterAssertionException)
#10 /srv/mediawiki/php-1.34.0-wmf.8/includes/exception/MWExceptionHandler.php(121): MWExceptionRenderer::output(Wikimedia\Assert\ParameterAssertionException, integer)
#11 /srv/mediawiki/php-1.34.0-wmf.8/includes/exception/MWExceptionHandler.php(195): MWExceptionHandler::report(Wikimedia\Assert\ParameterAssertionException)
#12 /srv/mediawiki/php-1.34.0-wmf.8/includes/MediaWiki.php(542): MWExceptionHandler::handleException(Wikimedia\Assert\ParameterAssertionException)
#13 /srv/mediawiki/php-1.34.0-wmf.8/index.php(42): MediaWiki->run()
#14 /srv/mediawiki/w/index.php(3): require(string)
#15 {main}

That's a slightly different issue, having to do with recently added validation in Title rather than this task which has to do with usernames stored in the database. The specific example affects user pages only because it's WikiLove trying to find the user talk page for a user subpage.

mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:09 PM
daniel lowered the priority of this task from High to Normal.Tue, Sep 24, 6:34 PM
daniel added a subscriber: daniel.

Doesn't seem to be "high", since nobody has cared for a while.

  1. View article https://en.wikipedia.org/wiki/Audi
  2. Press "Page information"

This does not appear to be an edge case or where something is somewhat odd with the article itself that a user could repair. Rather there is something somewhere else on the wiki causing it (in this case, I think it's the name of the actor that created the page some years ago).

Whether we can display that actor's name is another matter, but I think it should be high priority that we don't completely fail for such basic and discoverable feature, especially since there's a lot of other information on that page that would still be useful. And because it's a fatal error, exposed to logged-out users, over a UI-discoverable url, on any GET request to it. And with no discoverable workaround for end-users. The fatal nature also makes it a bit of a prod risk, I think.

Change 540395 had a related patch set uploaded (by Daniel Kinzler; owner: Daniel Kinzler):
[mediawiki/core@master] WIP Don't fail hard on bad titles in the database.

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

daniel claimed this task.Wed, Oct 2, 12:35 PM