Page MenuHomePhabricator

ResourceLoader broken with DisplayTitle: "Sessions are disabled for load entry point"
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

Displaytitle breaks resourceloader.

What happens?:

load.php code will not load, stack trace:

Sessions are disabled for load entry point in /var/www/html/includes/session/SessionManager.php:900
Stack trace:
#0 /var/www/html/includes/session/SessionManager.php(248): MediaWiki\Session\SessionManager->getSessionFromInfo()
#1 /var/www/html/includes/WebRequest.php(843): MediaWiki\Session\SessionManager->getSessionForRequest()
#2 /var/www/html/includes/user/User.php(1115): WebRequest->getSession()
#3 /var/www/html/includes/user/User.php(438): User->loadFromSession()
#4 /var/www/html/includes/user/User.php(1658): User->load()
#5 /var/www/html/includes/user/User.php(2310): User->getId()
#6 /var/www/html/includes/user/UserOptionsManager.php(645): User->isRegistered()
#7 /var/www/html/includes/user/UserOptionsManager.php(497): MediaWiki\User\UserOptionsManager->getCacheKey()
#8 /var/www/html/includes/user/UserOptionsManager.php(148): MediaWiki\User\UserOptionsManager->loadUserOptions()
#9 /var/www/html/extensions/DisplayTitle/includes/DisplayTitleHooks.php(155): MediaWiki\User\UserOptionsManager->getOption()
#10 /var/www/html/includes/HookContainer/HookContainer.php(160): MediaWiki\Extension\DisplayTitle\DisplayTitleHooks->onHtmlPageLinkRendererBegin()
#11 /var/www/html/includes/HookContainer/HookRunner.php(2025): MediaWiki\HookContainer\HookContainer->run()
#12 /var/www/html/includes/linker/LinkRenderer.php(168): MediaWiki\HookContainer\HookRunner->onHtmlPageLinkRendererBegin()
#13 /var/www/html/includes/linker/LinkRenderer.php(191): MediaWiki\Linker\LinkRenderer->runBeginHook()
#14 /var/www/html/includes/linker/LinkRenderer.php(242): MediaWiki\Linker\LinkRenderer->makePreloadedLink()
#15 /var/www/html/includes/linker/LinkRenderer.php(158): MediaWiki\Linker\LinkRenderer->makeKnownLink()
#16 /var/www/html/includes/parser/LinkHolderArray.php(313): MediaWiki\Linker\LinkRenderer->makeLink()
#17 /var/www/html/includes/parser/LinkHolderArray.php(159): LinkHolderArray->replaceInterwiki()
#18 /var/www/html/includes/parser/Parser.php(5085): LinkHolderArray->replace()
#19 /var/www/html/includes/parser/Parser.php(1713): Parser->replaceLinkHoldersPrivate()
#20 /var/www/html/includes/parser/Parser.php(727): Parser->internalParseHalfParsed()
#21 /var/www/html/includes/language/MessageCache.php(1374): Parser->parse()
#22 /var/www/html/includes/language/Message.php(1427): MessageCache->parse()
#23 /var/www/html/includes/language/Message.php(1004): Message->parseText()
#24 /var/www/html/includes/language/Message.php(1042): Message->format()
#25 /var/www/html/extensions/VisualEditor/includes/VisualEditorDataModule.php(32): Message->parse()
#26 /var/www/html/includes/ResourceLoader/Module.php(817): MediaWiki\Extension\VisualEditor\VisualEditorDataModule->getScript()
#27 /var/www/html/includes/ResourceLoader/Module.php(786): MediaWiki\ResourceLoader\Module->buildContent()
#28 /var/www/html/includes/ResourceLoader/Module.php(925): MediaWiki\ResourceLoader\Module->getModuleContent()
#29 /var/www/html/includes/ResourceLoader/StartUpModule.php(224): MediaWiki\ResourceLoader\Module->getVersionHash()
#30 /var/www/html/includes/ResourceLoader/StartUpModule.php(425): MediaWiki\ResourceLoader\StartUpModule->getModuleRegistrations()
#31 /var/www/html/includes/ResourceLoader/Module.php(817): MediaWiki\ResourceLoader\StartUpModule->getScript()
#32 /var/www/html/includes/ResourceLoader/Module.php(786): MediaWiki\ResourceLoader\Module->buildContent()
#33 /var/www/html/includes/ResourceLoader/Module.php(925): MediaWiki\ResourceLoader\Module->getModuleContent()
#34 /var/www/html/includes/ResourceLoader/ResourceLoader.php(701): MediaWiki\ResourceLoader\Module->getVersionHash()
#35 [internal function]: MediaWiki\ResourceLoader\ResourceLoader->MediaWiki\ResourceLoader\{closure}()
#36 /var/www/html/includes/ResourceLoader/ResourceLoader.php(699): array_map()
#37 /var/www/html/includes/ResourceLoader/ResourceLoader.php(798): MediaWiki\ResourceLoader\ResourceLoader->getCombinedVersion()
#38 /var/www/html/load.php(53): MediaWiki\ResourceLoader\ResourceLoader->respond()
#39 /var/www/html/load.php(39): wfLoadMain()
#40 {main}

Because Load.php sets MW_NO_SESSION, so user cannot be retrieved from session. It seems to me that session should not be required for user option when user is also provided, but that's some weird core code.

Problem is that message visualeditor-wikitext-warning is required by VE in js loaded by resourceloader, and that message contains link to [[{{MediaWiki:visualeditor-wikitext-warning-link}}|wikitext]] (in English localisation), which is then handled before injected into js by DisplayTitle, but without session nor user, so user options cannot be retrieved.

Problem seems to be introduced in add option to handle displaylinks.

What should have happened instead?:

Resourceloader should not be broken

Software version (skip for WMF-hosted wikis like Wikipedia):

DisplayTitle REL1_39, commit hash 429a67f8497c7c29d3387300df44f17a37dad75b
VisualEditor 0.1.2

MediaWiki 1.39.3
PHP 8.0.29 (apache2handler)
MariaDB 10.4.26-MariaDB-log
ICU 67.1
Pygments 2.11.2
Elasticsearch 6.8.21
Build image 2.0.0.5

Other information (browser name/version, screenshots, etc.):
Stack trace, see above

Event Timeline

Aklapper renamed this task from Resource loader is broken with newest displaytitle version to ResourceLoader broken with DisplayTitle: "Sessions are disabled for load entry point".Jul 26 2023, 1:02 PM

Change 941878 had a related patch set uploaded (by Cicalese; author: Cicalese):

[mediawiki/extensions/DisplayTitle@master] Revert "Add a user preference to disable extension"

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

Thank you for diagnosing and reporting this issue! I'm going to revert the user preference functionality both because of this issue as well as a realization that the current approach introduces latency and risk.

Change 941878 merged by jenkins-bot:

[mediawiki/extensions/DisplayTitle@master] Revert "Add a user preference to disable extension"

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

Change 941885 had a related patch set uploaded (by Cicalese; author: Cicalese):

[mediawiki/extensions/DisplayTitle@REL1_39] Revert "Add a user preference to disable extension"

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

Change 941986 had a related patch set uploaded (by Cicalese; author: Cicalese):

[mediawiki/extensions/DisplayTitle@REL1_40] Revert "Add a user preference to disable extension"

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

Change 941885 merged by jenkins-bot:

[mediawiki/extensions/DisplayTitle@REL1_39] Revert "Add a user preference to disable extension"

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

Change 941986 merged by jenkins-bot:

[mediawiki/extensions/DisplayTitle@REL1_40] Revert "Add a user preference to disable extension"

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

cicalese claimed this task.
cicalese moved this task from Backlog to Closed on the MediaWiki-extensions-DisplayTitle board.