Page MenuHomePhabricator

User::loadFromSession called before the end of Setup.php
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error

MediaWiki version: 1.36.0-wmf.33

message
User::loadFromSession called before the end of Setup.php

Impact

Not sure.

This is triggered also by GET to regular wiki pages – it's not something specific to this gadget or action=raw AFAICT

Notes

First seen on March 3, so an issue introduced in T274937: 1.36.0-wmf.33 deployment blockers, and there have been 36,045 of these errors logged so far.

Details

Request URL
https://he.wikipedia.org/w/index.php?title=MediaWiki:Gadget-TemplateParamWizard.js&action=raw&ctype=text/javascript
Stack Trace
exception.trace
from /srv/mediawiki/php-1.36.0-wmf.33/includes/user/User.php(374)
#0 /srv/mediawiki/php-1.36.0-wmf.33/includes/user/User.php(2079): User->load()
#1 /srv/mediawiki/php-1.36.0-wmf.33/includes/user/User.php(3062): User->getId()
#2 /srv/mediawiki/php-1.36.0-wmf.33/includes/user/UserOptionsManager.php(587): User->isRegistered()
#3 /srv/mediawiki/php-1.36.0-wmf.33/includes/user/UserOptionsManager.php(490): MediaWiki\User\UserOptionsManager->getCacheKey(User)
#4 /srv/mediawiki/php-1.36.0-wmf.33/includes/user/UserOptionsManager.php(138): MediaWiki\User\UserOptionsManager->loadUserOptions(User, integer)
#5 /srv/mediawiki/php-1.36.0-wmf.33/includes/user/User.php(2664): MediaWiki\User\UserOptionsManager->getOption(User, string, NULL, boolean)
#6 /srv/mediawiki/php-1.36.0-wmf.33/includes/context/RequestContext.php(376): User->getOption(string)
#7 /srv/mediawiki/php-1.36.0-wmf.33/extensions/GrowthExperiments/ServiceWiring.php(141): RequestContext->getLanguage()
#8 /srv/mediawiki/php-1.36.0-wmf.33/vendor/wikimedia/services/src/ServiceContainer.php(447): Wikimedia\Services\ServiceContainer->{closure}(MediaWiki\MediaWikiServices)
#9 /srv/mediawiki/php-1.36.0-wmf.33/vendor/wikimedia/services/src/ServiceContainer.php(416): Wikimedia\Services\ServiceContainer->createService(string)
#10 /srv/mediawiki/php-1.36.0-wmf.33/includes/MediaWikiServices.php(261): Wikimedia\Services\ServiceContainer->getService(string)
#11 /srv/mediawiki/php-1.36.0-wmf.33/vendor/wikimedia/services/src/ServiceContainer.php(424): MediaWiki\MediaWikiServices->getService(string)
#12 /srv/mediawiki/php-1.36.0-wmf.33/extensions/GrowthExperiments/includes/GrowthExperimentsServices.php(92): Wikimedia\Services\ServiceContainer->get(string)
#13 /srv/mediawiki/php-1.36.0-wmf.33/extensions/GrowthExperiments/includes/Mentorship/MentorHooks.php(38): GrowthExperiments\GrowthExperimentsServices->getMentorManager()
#14 /srv/mediawiki/php-1.36.0-wmf.33/includes/HookContainer/HookContainer.php(163): GrowthExperiments\Mentorship\MentorHooks->onLocalUserCreated(User, boolean)
#15 /srv/mediawiki/php-1.36.0-wmf.33/includes/HookContainer/HookRunner.php(2459): MediaWiki\HookContainer\HookContainer->run(string, array)
#16 /srv/mediawiki/php-1.36.0-wmf.33/includes/auth/AuthManager.php(1778): MediaWiki\HookContainer\HookRunner->onLocalUserCreated(User, boolean)
#17 /srv/mediawiki/php-1.36.0-wmf.33/includes/Setup.php(823): MediaWiki\Auth\AuthManager->autoCreateUser(User, string, boolean)
#18 /srv/mediawiki/php-1.36.0-wmf.33/includes/WebStart.php(89): require_once(string)
#19 /srv/mediawiki/php-1.36.0-wmf.33/index.php(44): require(string)
#20 /srv/mediawiki/w/index.php(3): require(string)
#21 {main}

Event Timeline

@Urbanecm_WMF maybe rEGREc5dcf91dde18: Move mentor assignment to MentorHooks.php has something to do with it; previously mentor assignment was done inside a guard that excluded autocreated users. It looks like all of these error messages originate from the autoCreateUser() call.

Change 669494 had a related patch set uploaded (by Kosta Harlan; owner: Kosta Harlan):
[mediawiki/extensions/GrowthExperiments@master] MentorHooks: Make mentor assignment follow same rules as HomepageHooks

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

Change 669494 merged by jenkins-bot:
[mediawiki/extensions/GrowthExperiments@master] MentorHooks: Make mentor assignment follow same rules as HomepageHooks

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

Right, you can't do anything during autocreation that would depend on the session user (such as getting the user language), because that's when the session user gets determined. Although I suppose core could be more clever and only call the LocalUserCreated hook after finishing autocreation.

I wonder if we really need the user language. Custom mentor introductions are in the content language, we could just use that for the default introduction as well.

I would agree with converting the default description to content language,
to make it consistent with custom descriptions, which are always in content
language.

I would also support making core more clever with calling this hook, but
that's probably a topic for another task.

Change 668824 had a related patch set uploaded (by Kosta Harlan; owner: Kosta Harlan):
[mediawiki/extensions/GrowthExperiments@wmf/1.36.0-wmf.33] MentorHooks: Make mentor assignment follow same rules as HomepageHooks

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

Change 668824 merged by jenkins-bot:
[mediawiki/extensions/GrowthExperiments@wmf/1.36.0-wmf.33] MentorHooks: Make mentor assignment follow same rules as HomepageHooks

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

Mentioned in SAL (#wikimedia-operations) [2021-03-08T12:20:51Z] <urbanecm@deploy1002> Synchronized php-1.36.0-wmf.33/extensions/GrowthExperiments/includes/Mentorship/MentorHooks.php: 48d6c55c91b42445900ccdf06b78703c1c5233a6: MentorHooks: Make mentor assignment follow same rules as HomepageHooks (T276720) (duration: 00m 58s)