Page MenuHomePhabricator

/w/index.php?title=Main_Page&action=info can cause PHP Warning: Linker::userToolLinks received an empty username.
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error

Request URL: https://mh.wiktionary.org/w/index.php?title=Main_Page&action=info
Request ID: XOO8XgpAIC4AALtisD0AAACH

message
PHP Warning: Linker::userLink received an empty username. Are there database errors that need to be fixed? [Called from Linker::userLink in /srv/mediawiki/php-1.34.0-wmf.5/includes/Linker.php at line 899]
trace
#0 /srv/mediawiki/php-1.34.0-wmf.5/includes/debug/MWDebug.php(309): MWExceptionHandler::handleError(integer, string, string, integer, array, array)
#1 /srv/mediawiki/php-1.34.0-wmf.5/includes/debug/MWDebug.php(164): MWDebug::sendMessage(string, array, string, integer)
#2 /srv/mediawiki/php-1.34.0-wmf.5/includes/GlobalFunctions.php(1069): MWDebug::warning(string, integer, integer, string)
#3 /srv/mediawiki/php-1.34.0-wmf.5/includes/Linker.php(899): wfLogWarning(string)
#4 /srv/mediawiki/php-1.34.0-wmf.5/includes/Linker.php(1126): Linker::userLink(integer, string)
#5 /srv/mediawiki/php-1.34.0-wmf.5/includes/actions/InfoAction.php(564): Linker::revUserTools(Revision)
#6 /srv/mediawiki/php-1.34.0-wmf.5/includes/actions/InfoAction.php(120): InfoAction->pageInfo()
#7 /srv/mediawiki/php-1.34.0-wmf.5/includes/actions/FormlessAction.php(43): InfoAction->onView()
#8 /srv/mediawiki/php-1.34.0-wmf.5/includes/MediaWiki.php(499): FormlessAction->show()
#9 /srv/mediawiki/php-1.34.0-wmf.5/includes/MediaWiki.php(294): MediaWiki->performAction(Article, Title)
#10 /srv/mediawiki/php-1.34.0-wmf.5/includes/MediaWiki.php(865): MediaWiki->performRequest()
#11 /srv/mediawiki/php-1.34.0-wmf.5/includes/MediaWiki.php(515): MediaWiki->main()
#12 /srv/mediawiki/php-1.34.0-wmf.5/index.php(42): MediaWiki->run()
#13 /srv/mediawiki/w/index.php(3): include(string)
#14 {main}

Impact

This error indicates MediaWiki is unable to render a link to a username despite the code expecting to be able to do so.

This happens on the "Page information" action, for the "Page creator" field. The impact is that for a number of pages this now says: "(no username available)"

Example: https://wikitech.wikimedia.org/w/index.php?title=Main_Page&action=info

Page creator (no username available) (no username available)
Date of page creation23:18, 10 June 2004 ( https://wikitech.wikimedia.org/w/index.php?title=Main_Page&oldid=12270 )

Apparently when trying to retrieve the username for the first page creation (based on pageinfo-firstuser). Which is a revision by the MediaWiki installer / addWiki:

https://wikitech.wikimedia.org/w/index.php?title=Main_Page&dir=prev&limit=1&action=history

So that is most probably a very old bug from includes/actions/InfoAction.php

Notes

Started with 1.34-wmf.4, triggered about 5,000 times per week.

Screenshot 2019-05-24 at 16.06.16.png (784×2 px, 185 KB)

Event Timeline

Krinkle raised the priority of this task from Low to High.EditedMay 24 2019, 3:04 PM
Krinkle updated the task description. (Show Details)
Krinkle added a subscriber: Krinkle.

Raising priority because the bug and/or detection is recently introduced, uses a severity we actively monitor globally, and has high frequency.

If this feature is known to be broken, please disable the logging and/or use debug severity until the known problems are fixed.


Traced to ddd1d4b9203aa / https://gerrit.wikimedia.org/r/508287 (@Simetrical, @daniel).

Change 512461 had a related patch set uploaded (by BPirkle; owner: BPirkle):
[mediawiki/core@master] Switch empty username logging from warning to debug.

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

Change 512531 had a related patch set uploaded (by Krinkle; owner: BPirkle):
[mediawiki/core@wmf/1.34.0-wmf.6] Switch empty username logging from warning to debug.

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

This is a known problem, but not all instances of the problem are known. The purpose of logging is to identify all code paths that trigger this warning. It would be useful to have a collection of different stack traces here, before we switch severity to "debug".

I recommend against merging the proposed patch before we have a good overview of what code paths need fixing.

There is one stack trace and URL in the task description. And an overview by wiki, by entrypoint, and all the 5,371 other stack traces and their request URLs are available in Logstash, where they will retain for 30 days. Is that enough time to capture what you need into the task?

For any URL, even after this patch, one can use WikimediaDebug+log to see if it still triggers the issue e.g. after a patch intending to fix one of the issues is deployed, to verify it.

Change 512461 merged by jenkins-bot:
[mediawiki/core@master] Switch empty username logging from warning to debug.

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

There is one stack trace and URL in the task description. And an overview by wiki, by entrypoint, and all the 5,371 other stack traces and their request URLs are available in Logstash, where they will retain for 30 days. Is that enough time to capture what you need into the task?

Right - as long as "someone" does it :) I filed a ticket: T224368: Ensure Linker::userLink is not called with empty user name

For any URL, even after this patch, one can use WikimediaDebug+log to see if it still triggers the issue e.g. after a patch intending to fix one of the issues is deployed, to verify it.

The works if you already know the functionality that triggers the problem.

Change 512531 abandoned by Krinkle:
Switch empty username logging from warning to debug.

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

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