Page MenuHomePhabricator

[betalabs-regression] RC and Watchlist pages cannot be loaded
Closed, ResolvedPublic

Description

On enwiki betalabs the Special:RecentChanges and Special:Watchlist never finish loading:

Screen Shot 2019-07-03 at 3.31.17 PM.png (584×1 px, 197 KB)
Screen Shot 2019-07-03 at 3.31.04 PM.png (490×1 px, 104 KB)

Stack trace:

[XR0qVKwQBHcAAHu5Q@oAAAAC] /w/load.php?lang=en&modules=ext.centralNotice.geoIP%7Cext.centralauth.ForeignApi%7Cext.centralauth.centralautologin.clearcookie%7Cext.echo.api%2Cinit%7Cext.eventLogging%2CguidedTour%2CnavigationTiming%2CwikimediaEvents%7Cext.growthExperiments.HelpPanel.init%7Cext.guidedTour.lib%2Cstyles%7Cext.guidedTour.lib.internal%7Cext.guidedTour.tour.RcFiltersHighlight%2Chelpdesk%7Cext.uls.common%2Cinterface%2Cpreferences%2Cwebfonts%7Cext.urlShortener.toolbar%7Cext.visualEditor.desktopArticleTarget.init%7Cext.visualEditor.progressBarWidget%2CsupportCheck%2CtargetLoader%2CtempWikitextEditorWidget%2Ctrack%2Cve%7Cext.wikimediaEvents.loggedin%7Cjquery%2Coojs%2Coojs-ui-core%2Coojs-ui-widgets%2Csite%7Cjquery.accessKeyLabel%2CcheckboxShiftClick%2Cclient%2Ccookie%2CgetAttrs%2ChighlightText%2CmakeCollapsible%2Csuggestions%2CtabIndex%2Ctablesorter%2CtextSelection%2Cthrottle-debounce%7Cjquery.uls.data%7Cmediawiki.ForeignApi%2CRegExp%2CString%2CTitle%2CUri%2Capi%2Cbase%2Ccldr%2Ccookie%2Cexperiments%2CjqueryMsg%2Clanguage%2Cnotify%2CsearchSuggest%2Cstorage%2Ctemplate%2Cuser%2Cutil%2Cwidgets%7Cmediawiki.ForeignApi.core%7Cmediawiki.editfont.styles%7Cmediawiki.language.months%7Cmediawiki.legacy.wikibits%7Cmediawiki.libs.guiders%2Cpluralruleparser%7Cmediawiki.page.ready%2Cstartup%7Cmediawiki.rcfilters.filters.dm%2Cui%7Cmediawiki.special.changeslist.legend.js%7Cmediawiki.special.recentchanges%7Cmediawiki.template.regexp%7Cmediawiki.ui.button%7Cmw.config.values.wbDataBridgeConfig%7Coojs-ui-widgets.icons%7Coojs-ui.styles.icons-content%2Cicons-editing-core%2Cicons-editing-styling%2Cicons-interactions%2Cicons-layout%2Cicons-media%2Cicons-moderation%7Csentry.init%7Cskins.vector.js%7Cuser.defaults%7Cwikibase.client.data-bridge.init&skin=vector&version=03qfwh9   BadMethodCallException from line 823 of /srv/mediawiki/php-master/includes/session/SessionManager.php: Sessions are disabled for this entry point
Backtrace:
#0 /srv/mediawiki/php-master/includes/session/SessionManager.php(196): MediaWiki\Session\SessionManager->getSessionFromInfo(MediaWiki\Session\SessionInfo, WebRequest)
#1 /srv/mediawiki/php-master/includes/WebRequest.php(758): MediaWiki\Session\SessionManager->getSessionForRequest(WebRequest)
#2 /srv/mediawiki/php-master/includes/user/User.php(1279): WebRequest->getSession()
#3 /srv/mediawiki/php-master/includes/user/User.php(378): User->loadFromSession()
#4 /srv/mediawiki/php-master/includes/user/User.php(5127): User->load()
#5 /srv/mediawiki/php-master/includes/user/User.php(2957): User->loadOptions()
#6 /srv/mediawiki/php-master/includes/context/RequestContext.php(337): User->getOption(string)
#7 /srv/mediawiki/php-master/includes/language/Message.php(393): RequestContext->getLanguage()
#8 /srv/mediawiki/php-master/includes/language/Message.php(1263): Message->getLanguage()
#9 /srv/mediawiki/php-master/includes/language/Message.php(890): Message->parseText(string)
#10 /srv/mediawiki/php-master/includes/language/Message.php(943): Message->toString(string)
#11 /srv/mediawiki/php-master/includes/specialpage/ChangesListSpecialPage.php(943): Message->parse()
#12 /srv/mediawiki/php-master/includes/specialpage/ChangesListSpecialPage.php(853): ChangesListSpecialPage::getChangeTagList(ResourceLoaderContext)
#13 /srv/mediawiki/php-master/includes/resourceloader/ResourceLoaderFileModule.php(1231): ChangesListSpecialPage::getRcFiltersConfigVars(ResourceLoaderContext)
#14 /srv/mediawiki/php-master/includes/resourceloader/ResourceLoaderFileModule.php(388): ResourceLoaderFileModule->getPackageFiles(ResourceLoaderContext)
#15 /srv/mediawiki/php-master/includes/resourceloader/ResourceLoaderModule.php(714): ResourceLoaderFileModule->getScript(ResourceLoaderContext)
#16 /srv/mediawiki/php-master/includes/resourceloader/ResourceLoaderModule.php(681): ResourceLoaderModule->buildContent(ResourceLoaderContext)
#17 /srv/mediawiki/php-master/includes/resourceloader/ResourceLoader.php(1054): ResourceLoaderModule->getModuleContent(ResourceLoaderContext)
#18 /srv/mediawiki/php-master/includes/resourceloader/ResourceLoader.php(761): ResourceLoader->makeModuleResponse(ResourceLoaderContext, array, array)
#19 /srv/mediawiki/php-master/load.php(46): ResourceLoader->respond(ResourceLoaderContext)
#20 /srv/mediawiki/w/load.php(3): include(string)
#21 {main}

Event Timeline

I suspect that this is because of a code path in ChangeTags::tagShortDescriptionMessage() that returns a RawMessage (specifically, new RawMessage( '$1', [ Message::plainTextParam( $tag ) ] )). Because this Message instance isn't created using the MessageLocalizer that's being passed around., it doesn't have the right language set, and looks up the user language.

Unfortunately, there is no clean way to generate a RawMessage using the right language, because of some annoying gaps in the related infrastructure:

  • You can call ->setContext() on a Message, but that takes an IContextSource, and what we have here is a MessageLocalizer (specifically, a ResourceLoaderContext)
  • MessageLocalizer only specifies ->msg(), it doesn't have ->getLanguage() or ->getTitle() (if it had both, the type hint on Message->setContext() could be relaxed to MessageLocalizer)
  • All classes that implement MessageLocalizer also implement ->getLanguage(), but with different return types (ResourceLoaderContext->getLanguage() returns a string instead of a Language object)
  • Despite the name, MessageLocalizer doesn't provide a method that takes a Message object and localizes it, it only provides the ->msg() method which takes a message key and parameters
  • Passing a Message object to MessageLocalizer->msg() generally works, because a Message is also a MessageSpecifier. However, using a RawMessage as a MessageSpecifier doesn't work (even though it implements the MessageSpecifer interface!) and instead returns ⧼$1⧽

The "best" way to do this that I found was to use the MessageLocalizer to create a regular Message (conveniently, we already do this in that function), then call ->getLanguage() on that Message object, and pass the result to ->inLanguage() on the RawMessage. Patch coming.

Change 520658 had a related patch set uploaded (by Catrope; owner: Catrope):
[mediawiki/core@master] Follow-up 9c9cfa2ec3d7: fix non-session entry point error

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

Change 520658 merged by jenkins-bot:
[mediawiki/core@master] Follow-up 9c9cfa2ec3d7: fix non-session entry point error

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