Page MenuHomePhabricator

Unable to view action=info for certain pages (InfoAction throws ParameterAssertionException: invalid DB key)
Closed, ResolvedPublicPRODUCTION ERROR

Description

2016-06-06 12:37:35 [V1VujQpAADQAAH3xxPcAAAIA] mw1022 enwiki 1.28.0-wmf.4 exception ERROR: [V1VujQpAADQAAH3xxPcAAAIA] /w/index.php?title=Audi&action=info   Wikimedia\Assert\ParameterAssertionException from line 63 of /srv/mediawiki/php-1.28.0-wmf.4/vendor/wikimedia/assert/src/Assert.php: Bad value for parameter $dbkey: invalid DB key {"exception_id":"V1VujQpAADQAAH3xxPcAAAIA"} 
[Exception Wikimedia\Assert\ParameterAssertionException] (/srv/mediawiki/php-1.28.0-wmf.4/vendor/wikimedia/assert/src/Assert.php:63) Bad value for parameter $dbkey: invalid DB key
  #0 /srv/mediawiki/php-1.28.0-wmf.4/includes/title/TitleValue.php(81): Wikimedia\Assert\Assert::parameter(boolean, string, string)
  #1 /srv/mediawiki/php-1.28.0-wmf.4/includes/cache/LinkBatch.php(174): TitleValue->__construct(integer, string)
  #2 /srv/mediawiki/php-1.28.0-wmf.4/includes/cache/LinkBatch.php(135): LinkBatch->addResultToCache(LinkCache, ResultWrapper)
  #3 /srv/mediawiki/php-1.28.0-wmf.4/includes/cache/LinkBatch.php(122): LinkBatch->executeInto(LinkCache)
  #4 /srv/mediawiki/php-1.28.0-wmf.4/includes/actions/InfoAction.php(494): LinkBatch->execute()
  #5 /srv/mediawiki/php-1.28.0-wmf.4/includes/actions/InfoAction.php(118): InfoAction->pageInfo()
  #6 /srv/mediawiki/php-1.28.0-wmf.4/includes/actions/FormlessAction.php(43): InfoAction->onView()
  #7 /srv/mediawiki/php-1.28.0-wmf.4/includes/MediaWiki.php(504): FormlessAction->show()
  #8 /srv/mediawiki/php-1.28.0-wmf.4/includes/MediaWiki.php(288): MediaWiki->performAction(Article, Title)
  #9 /srv/mediawiki/php-1.28.0-wmf.4/includes/MediaWiki.php(746): MediaWiki->performRequest()
  #10 /srv/mediawiki/php-1.28.0-wmf.4/includes/MediaWiki.php(520): MediaWiki->main()
  #11 /srv/mediawiki/php-1.28.0-wmf.4/index.php(43): MediaWiki->run()
  #12 /srv/mediawiki/w/index.php(3): include(string)
  #13 {main}

Event Timeline

				$batch->add( NS_USER, $firstRevUser );
				$batch->add( NS_USER_TALK, $firstRevUser );
				$batch->add( NS_USER, $lastRevUser );
				$batch->add( NS_USER_TALK, $lastRevUser );

My hunch is that usernames are using spaces and not underscores. We should normalize these by going through Title first.

Change 293038 had a related patch set uploaded (by Legoktm):
InfoAction: Don't pass non-dbkeys to LinkBatch

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

Change 293038 merged by jenkins-bot:
InfoAction: Don't pass non-dbkeys to LinkBatch

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

Ciencia_Al_Poder subscribed.

Looks like it hasn't been resolved

[WZRyFQpAIDgAAB7YPWEAAAAC] 2017-08-16 16:25:57: Fatal exception of type "Wikimedia\Assert\ParameterAssertionException"

action=info: https://en.wikipedia.org/w/index.php?title=Audi&action=info
action=history: https://en.wikipedia.org/w/index.php?title=Audi&offset=20020225154311&limit=1&action=history

In the api I see there's a user called "Brad_":

https://en.wikipedia.org/wiki/Special:ApiSandbox#action=query&format=json&prop=revisions&titles=Audi&rvprop=ids%7Ctimestamp%7Cflags%7Ccomment%7Cuser%7Cuserid&rvstart=2001-09-26T12%3A34%3A19.000Z

{
    "batchcomplete": "",
    "query": {
        "pages": {
            "848": {
                "pageid": 848,
                "ns": 0,
                "title": "Audi",
                "revisions": [
                    {
                        "revid": 234233,
                        "parentid": 0,
                        "minor": "",
                        "user": "Brad_",
                        "anon": "",
                        "userid": 0,
                        "timestamp": "2001-09-26T12:34:19Z",
                        "comment": "Added English translation of Vorsprung durch Technik"
                    }
                ]
            }
        }
    }
}

This is happening on an external wiki as well: https://pathofexile.gamepedia.com/index.php?title=Vendor_recipe_system&action=history

In that case there's a user " Harest" https://pathofexile.gamepedia.com/Special:ApiSandbox#action=query&format=json&prop=revisions&list=&titles=Vendor_recipe_system&rvprop=ids%7Ctimestamp%7Cflags%7Ccomment%7Cuser%7Cparsedcomment%7Cuserid&rvstart=2016-03-07T04%3A45%3A56.000Z

{
                        "revid": 191774,
                        "parentid": 191372,
                        "minor": "",
                        "user": " Harest",
                        "userid": 171842,
                        "timestamp": "2016-03-07T04:45:56Z",
                        "comment": "/* Alchemy Shard */ % IIR = 2 alchemy shards, not sure about alt shards (i think it's one instead of 2).",
                        "parsedcomment": "<a href=\"/Vendor_recipe_system#Alchemy_Shard\" title=\"Vendor recipe system\">\u2192</a>\u200e<span dir=\"auto\"><span class=\"autocomment\">Alchemy Shard: </span> % IIR = 2 alchemy shards, not sure about alt shards (i think it&#039;s one instead of 2).</span>"
                    },

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.

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}
Krinkle renamed this task from InfoAction: Bad value for parameter $dbkey: invalid DB key to Unable to view action=info for certain pages (InfoAction throws ParameterAssertionException: invalid DB key).Jul 20 2018, 1:34 AM
Krinkle triaged this task as High priority.
Krinkle moved this task from Resolved to Dec2019/1.35.wmf.10+ on the Wikimedia-production-error board.
Krinkle subscribed.

@Legoktm Ah, yeah. The previous issue was presumably a short-lived regression that caused any space-containing username to fail InfoAction because it was using space instead of underscores.

The issue we now see on the action=info view of certain pages is limited to cases where the username itself has no valid encoding but is in fact invalid. And indeed those cases also break action=history and probably other things. I'll re-close and file anew.

mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:11 PM