Page MenuHomePhabricator

Bad value for parameter $dbkey: should not be empty unless namespace is main and fragment is non-empty
Closed, ResolvedPublic

Description

Error

Request URLs:

Request ID: XOTEygpAICEAALqO5IYAAADT

message
Bad value for parameter $dbkey: should not be empty unless namespace is main and fragment is non-empty

An exemple from the Flow extension:

trace
#0 /srv/mediawiki/php-1.34.0-wmf.6/includes/title/TitleValue.php(107): Wikimedia\Assert\Assert::parameter(boolean, string, string)
#1 /srv/mediawiki/php-1.34.0-wmf.6/includes/Linker.php(915): TitleValue->__construct(integer, string)
#2 /srv/mediawiki/php-1.34.0-wmf.6/extensions/Flow/includes/Templating.php(105): Linker::userLink(integer, NULL)
#3 /srv/mediawiki/php-1.34.0-wmf.6/extensions/Flow/includes/Formatter/RevisionFormatter.php(924): Flow\Templating->getUserLinks(Flow\Model\PostRevision)
#4 /srv/mediawiki/php-1.34.0-wmf.6/extensions/Flow/includes/Formatter/RevisionFormatter.php(886): Flow\Formatter\RevisionFormatter->processParam(string, Flow\Model\PostRevision, Flow\Model\UUID, ContribsPager, Flow\Formatter\ContributionsRow)
#5 /srv/mediawiki/php-1.34.0-wmf.6/extensions/Flow/includes/Formatter/RevisionFormatter.php(232): Flow\Formatter\RevisionFormatter->buildProperties(Flow\Model\UUID, Flow\Model\PostRevision, ContribsPager, Flow\Formatter\ContributionsRow)
#6 /srv/mediawiki/php-1.34.0-wmf.6/extensions/Flow/includes/Formatter/ContributionsFormatter.php(26): Flow\Formatter\RevisionFormatter->formatApi(Flow\Formatter\ContributionsRow, ContribsPager, string)
#7 /srv/mediawiki/php-1.34.0-wmf.6/extensions/Flow/Hooks.php(777): Flow\Formatter\ContributionsFormatter->format(Flow\Formatter\ContributionsRow, ContribsPager)
#8 /srv/mediawiki/php-1.34.0-wmf.6/extensions/Flow/Hooks.php(812): FlowHooks::onDeletedContributionsLineEnding(ContribsPager, string, Flow\Formatter\ContributionsRow, array)
#9 /srv/mediawiki/php-1.34.0-wmf.6/includes/Hooks.php(174): FlowHooks::onContributionsLineEnding(ContribsPager, string, Flow\Formatter\ContributionsRow, array, array)
#10 /srv/mediawiki/php-1.34.0-wmf.6/includes/Hooks.php(202): Hooks::callHook(string, array, array, NULL)
#11 /srv/mediawiki/php-1.34.0-wmf.6/includes/specials/pagers/ContribsPager.php(771): Hooks::run(string, array)
#12 /srv/mediawiki/php-1.34.0-wmf.6/includes/pager/IndexPager.php(490): ContribsPager->formatRow(Flow\Formatter\ContributionsRow)
#13 /srv/mediawiki/php-1.34.0-wmf.6/includes/specials/SpecialContributions.php(246): IndexPager->getBody()
#14 /srv/mediawiki/php-1.34.0-wmf.6/includes/specialpage/SpecialPage.php(570): SpecialContributions->execute(string)
#15 /srv/mediawiki/php-1.34.0-wmf.6/includes/specialpage/SpecialPageFactory.php(575): SpecialPage->run(string)
#16 /srv/mediawiki/php-1.34.0-wmf.6/includes/MediaWiki.php(288): MediaWiki\Special\SpecialPageFactory->executePath(Title, RequestContext)
#17 /srv/mediawiki/php-1.34.0-wmf.6/includes/MediaWiki.php(865): MediaWiki->performRequest()
#18 /srv/mediawiki/php-1.34.0-wmf.6/includes/MediaWiki.php(515): MediaWiki->main()
#19 /srv/mediawiki/php-1.34.0-wmf.6/index.php(42): MediaWiki->run()
#20 /srv/mediawiki/w/index.php(3): include(string)
#21 {main}

Impact

Internal error is shown!

Notes

Affects various pages

https://logstash.wikimedia.org/goto/8c9d3b83322b23305122be6603222246

First occurence is from April 30th with number of occurrences varying:

Caused by:

34582db81c9418a12721df58081c02bb05d2660a / https://gerrit.wikimedia.org/r/#/c/mediawiki/core/+/504000/

Event Timeline

hashar created this task.May 22 2019, 9:18 AM
Restricted Application added a project: Growth-Team. · View Herald TranscriptMay 22 2019, 9:18 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
hashar updated the task description. (Show Details)May 22 2019, 11:21 AM
Restricted Application added a subscriber: Cosine02. · View Herald TranscriptMay 22 2019, 11:21 AM
hashar renamed this task from [Flow] Bad value for parameter $dbkey: should not be empty unless namespace is main and fragment is non-empty to Bad value for parameter $dbkey: should not be empty unless namespace is main and fragment is non-empty.May 22 2019, 11:26 AM
hashar updated the task description. (Show Details)
hashar added subscribers: Simetrical, daniel.

I am not sure whether that one should be a blocker given it already got shipped with the previous version last week (1.34.0-wmf.5).

zeljkofilipin triaged this task as Unbreak Now! priority.May 22 2019, 1:12 PM

Train blockers are UBN.

Restricted Application added a subscriber: Liuxinyu970226. · View Herald TranscriptMay 22 2019, 1:12 PM
Restricted Application removed a subscriber: Liuxinyu970226. · View Herald TranscriptMay 22 2019, 1:54 PM

Thank you @Aklapper , I have transfered the informations to the task.

Not a blocker since that predate 1.34.0-wmf.6.

daniel reopened this task as Open.May 22 2019, 8:06 PM
daniel claimed this task.

This is not the same as T222628, which is about a problem in Linker::formatAutocomments. This here is about a problem with Linker::userLink, which needs a different fix. Both were triggered by the same change, b6e1e99bec8d -- but while the code in formatAutocomments was actually wrong, the problem here seems to be different. The error is triggered in line 915 of Linker, which has:

$page = new TitleValue( NS_USER, strtr( $userName, ' ', '_' ) );

but a few lines up, we do:

  		if ( $userName === '' ) {
			wfLogWarning( __METHOD__ . ' received an empty username. Are there database errors ' .
				'that need to be fixed?' );
			return wfMessage( 'empty-username' )->parse();
		}

this was introduced as a fix for T222529: Wikimedia\Assert\ParameterAssertionException when rendering a log snippet and log_user_text is empty. So, if $userName was an empty string, that guard would trigger and we'd log the incident. But apparently, what Flow passes as $userName is not a string, but something falsish that gets turned into an empty string by strtr, causing the misleading error message. And indeed, looking at the Flow code, $userName comes from UserNameBatch::get, which is documented to return "false if username is not found or display is suppressed".

So, the actual Bug is in Flow: it needs to check the return value of UserNameBatch::get before using it.

We can make core a bit more resilient though, by also triggering the guard on false and null as well as the empty string, so we don't fail hard later on.

Change 511979 had a related patch set uploaded (by Daniel Kinzler; owner: Daniel Kinzler):
[mediawiki/core@master] Make userLink() not fail too hard on false and null.

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

Pinging @matthiasmullie, because he last touched the relevant code in Flow.

daniel added a comment.EditedMay 22 2019, 8:16 PM

Change 511979 had a related patch set uploaded (by Daniel Kinzler; owner: Daniel Kinzler):
[mediawiki/core@master] Make userLink() not fail too hard on false and null.
https://gerrit.wikimedia.org/r/511979

Note that this patch is not a full fix, but it should unblock the train.

Change 512157 had a related patch set uploaded (by Sbisson; owner: Sbisson):
[mediawiki/extensions/Flow@master] Don't try to create userlinks when username is not available

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

Change 512157 merged by jenkins-bot:
[mediawiki/extensions/Flow@master] Don't try to create userlinks when username is not available

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

Krinkle closed this task as Resolved.May 25 2019, 10:01 PM
Krinkle added a subscriber: Krinkle.

Change 512502 merged by jenkins-bot:
[mediawiki/core@wmf/1.34.0-wmf.6] Linker: Fix empty auto-summaries triggering a fatal error
https://gerrit.wikimedia.org/r/512502

Mentioned in SAL (#wikimedia-operations) [2019-05-25T22:00:05Z] <krinkle@deploy1001> Synchronized php-1.34.0-wmf.6/includes/Linker.php: T222628 / c735a545df3a (duration: 00m 51s)

Thanks all. Confirmed in prod with all the given urls that were mentioned in this task.

daniel reopened this task as Open.Jun 5 2019, 11:16 AM
daniel lowered the priority of this task from Unbreak Now! to High.

reopened as "high", since the fix has not been merged into master.

The patch as two +1, looking for a +2... https://gerrit.wikimedia.org/r/c/mediawiki/core/+/511979

Change 511979 merged by jenkins-bot:
[mediawiki/core@master] Make userLink() not fail too hard on false and null.

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

daniel closed this task as Resolved.Jun 5 2019, 4:30 PM

Change 516501 had a related patch set uploaded (by Krinkle; owner: Daniel Kinzler):
[mediawiki/core@wmf/1.34.0-wmf.8] Make userLink() not fail too hard on false and null.

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

Change 516501 abandoned by Krinkle:
Make userLink() not fail too hard on false and null.

Reason:
Unable to reproduce issue in prod. Will let the fix ride the train next week instead.

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

hashar removed a subscriber: hashar.Mon, Jul 8, 7:56 AM