Page MenuHomePhabricator

Call to a member function getPrefixedText() on a non-object (null) in ResouceLoader::preloadTitleInfo
Closed, ResolvedPublic

Description

This only occurs on Persian Wikipedia right now. When you open a page (even logged out and with an empty cache), you get an error message in the JS console which reads:

[V@nHVQpAAEUAAAkm-KcAAAAW] 2016-09-27 01:11:49: Fatal exception of type "BadMethodCallException"

I thought this could be a local JS but I cannot find any common JS which would throw that exception.

Logtash

https://github.com/wikimedia/mediawiki/blob/wmf/1.28.0-wmf.20/includes/resourceloader/ResourceLoaderWikiModule.php#L362

Event Timeline

Huji created this task.Sep 27 2016, 1:17 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 27 2016, 1:17 AM
Dereckson renamed this task from BadMethodCallException on Persian Wikipedia to Call to a member function getPrefixedText() on a non-object (null) in ResouceLoader::preloadTitleInfo.Sep 27 2016, 1:23 AM
Dereckson updated the task description. (Show Details)
Dereckson edited projects, added MediaWiki-ResourceLoader; removed MediaWiki-General.
Dereckson updated the task description. (Show Details)Sep 27 2016, 1:27 AM
Dereckson updated the task description. (Show Details)

The issue could have been introduced by dbe592df, a fix for T145673.

Dereckson triaged this task as High priority.Sep 27 2016, 1:33 AM

Priority seems rather high, as it could affect any RTL wikis

Legoktm raised the priority of this task from High to Unbreak Now!.Sep 27 2016, 10:23 AM
Restricted Application added subscribers: Jay8g, Luke081515, TerraCodes. · View Herald TranscriptSep 27 2016, 10:23 AM

I think this is causing the PROBLEM - MediaWiki exceptions and fatals per minute on graphite1001 is CRITICAL: CRITICAL: 40.00% of data above the critical threshold [50.0] every so often in #wikimedia-operations.

Change 313043 had a related patch set uploaded (by Krinkle):
resourceloader: Fix undefined getPrefixedText()

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

Change 313153 had a related patch set uploaded (by Krinkle):
resourceloader: Fix undefined getPrefixedText()

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

fef64dc685fd4 has landed in master and a backport has been proposed to wmf.20. However, due to the no-deploy policy this week, I've not deployed that backport.

I did apply it to a canary server for a while (mw1017) and logged a subsequent request to fa.wikipedia.org and its load.php?modules=startup&only=scripts endpoint.

Produces the following warnings:

Invalid wiki page title "MediaWiki:Gadget-refStyle.css[ResourceLoader]" in ResourceLoaderWikiModule::preloadTitleInfo
Invalid wiki page title "MediaWiki:Gadget-refStyle.css[ResourceLoader]" in ResourceLoaderWikiModule::preloadTitleInfo

So this is merely a case where the input is genuinely broken. The "refStyle" gadget was equally broken on fa.wikipedia.org before the regression from dbe592df. However, the recent regression made the error easier to detect since ResourceLoader catches the exception in PHP, and (manually) copies the error message to be displayed in the "error" section of the browser developer console. (It was not a run-time exception in JavaScript and will not have affected the run-time of any other modules).

In the end, this is mostly a scary message that started to show up for tech-savvy users peeking in the browser error console on wikis where there is a gadget with a pre-existing syntax error in the definition of a gadget.

The proposed patch avoids this exception, restores silently failure mode, in favour of server-side logging.

The error logging may become a tad too verbose and isn't terribly useful since right now the Gadgets extension is not validating its input before registering the ResourceLoader module. The appropiate place to detect this syntax error and (silently) discard it would be in the Gadgets extension, ResourceLoader should not tolerate this.

Once that is fixed, we can restore the exception and/or raise log level from info to warning.

However, due to the no-deploy policy this week, I've not deployed that backport.

For production, I've resolved the exception by fixing the underlying syntax error in an edit on fa.wikipedia.org.

Krinkle claimed this task.Sep 28 2016, 1:00 AM
Krinkle lowered the priority of this task from Unbreak Now! to High.
Krinkle moved this task from Found during 1.34-wmf.9 to Meta on the Wikimedia-production-error board.
Krinkle moved this task from Inbox to Backlog on the MediaWiki-ResourceLoader board.
Huji added a comment.Sep 28 2016, 3:39 AM

Thanks Krinkle. I think the biggest issuse I had here was not the fact that there was this error in the console, but the fact that it was a useless warning (who knows what "V@nHVQpAAEUAAAkm-KcAAAAW" stood for?!) so in addition to the benefits you mentioned above (silent alert, etc) I like your patch because it provides a more meaningful log message.

Change 313043 merged by jenkins-bot:
resourceloader: Fix undefined getPrefixedText()

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

Krinkle closed this task as Resolved.Sep 29 2016, 7:02 PM
Krinkle added a project: Performance-Team.

Change 313153 abandoned by Krinkle:
resourceloader: Fix undefined getPrefixedText()

Reason:
Will roll out next week in the train. No deploys this week.

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

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