Page MenuHomePhabricator

Error: Call to a member function getId() on null
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

What happens?:

MediaWiki internal error.

Original exception: [Yf@HdCP3fCc5AfGpHztgcAAAAAI] /wiki/%E9%A6%96%E9%A1%B5 Error: Call to a member function getId() on null
Backtrace:
from /srv/mediawiki/php-master/extensions/GrowthExperiments/includes/Mentorship/Provider/WikitextMentorProvider.php(333)
#0 /srv/mediawiki/php-master/extensions/GrowthExperiments/includes/Mentorship/Provider/WikitextMentorProvider.php(342): GrowthExperiments\Mentorship\Provider\WikitextMentorProvider->makeCacheKeyWeightedAutoAssignedMentors()
#1 /srv/mediawiki/php-master/extensions/GrowthExperiments/includes/Mentorship/MentorPageMentorManager.php(223): GrowthExperiments\Mentorship\Provider\WikitextMentorProvider->getWeightedAutoAssignedMentors()
#2 /srv/mediawiki/php-master/extensions/GrowthExperiments/includes/Mentorship/MentorPageMentorManager.php(160): GrowthExperiments\Mentorship\MentorPageMentorManager->getRandomAutoAssignedMentor(User, array)
#3 /srv/mediawiki/php-master/extensions/GrowthExperiments/includes/Mentorship/MentorPageMentorManager.php(114): GrowthExperiments\Mentorship\MentorPageMentorManager->getRandomAutoAssignedMentorForUserAndRole(User, string)
#4 /srv/mediawiki/php-master/extensions/GrowthExperiments/includes/Mentorship/MentorPageMentorManager.php(169): GrowthExperiments\Mentorship\MentorPageMentorManager->getMentorForUser(User, string)
#5 /srv/mediawiki/php-master/extensions/GrowthExperiments/includes/HelpPanelHooks.php(222): GrowthExperiments\Mentorship\MentorPageMentorManager->getMentorForUserSafe(User)
#6 /srv/mediawiki/php-master/extensions/GrowthExperiments/includes/HelpPanelHooks.php(148): GrowthExperiments\HelpPanelHooks->getMentorData(GrowthExperiments\Config\GrowthExperimentsMultiConfig, User, RequestContext)
#7 /srv/mediawiki/php-master/includes/HookContainer/HookContainer.php(160): GrowthExperiments\HelpPanelHooks->onBeforePageDisplay(OutputPage, SkinVector)
#8 /srv/mediawiki/php-master/includes/HookContainer/HookRunner.php(939): MediaWiki\HookContainer\HookContainer->run(string, array, array)
#9 /srv/mediawiki/php-master/includes/OutputPage.php(2703): MediaWiki\HookContainer\HookRunner->onBeforePageDisplay(OutputPage, SkinVector)
#10 /srv/mediawiki/php-master/includes/MediaWiki.php(917): OutputPage->output(boolean)
#11 /srv/mediawiki/php-master/includes/MediaWiki.php(930): MediaWiki::{closure}()
#12 /srv/mediawiki/php-master/includes/MediaWiki.php(563): MediaWiki->main()
#13 /srv/mediawiki/php-master/index.php(53): MediaWiki->run()
#14 /srv/mediawiki/php-master/index.php(46): wfIndexMain()
#15 /srv/mediawiki/w/index.php(3): require(string)
#16 {main}

Exception caught inside exception handler: [Yf@HdCP3fCc5AfGpHztgcAAAAAI] /wiki/%E9%A6%96%E9%A1%B5 Error: Call to a member function getId() on null
Backtrace:
from /srv/mediawiki/php-master/extensions/GrowthExperiments/includes/Mentorship/Provider/WikitextMentorProvider.php(333)
#0 /srv/mediawiki/php-master/extensions/GrowthExperiments/includes/Mentorship/Provider/WikitextMentorProvider.php(342): GrowthExperiments\Mentorship\Provider\WikitextMentorProvider->makeCacheKeyWeightedAutoAssignedMentors()
#1 /srv/mediawiki/php-master/extensions/GrowthExperiments/includes/Mentorship/MentorPageMentorManager.php(223): GrowthExperiments\Mentorship\Provider\WikitextMentorProvider->getWeightedAutoAssignedMentors()
#2 /srv/mediawiki/php-master/extensions/GrowthExperiments/includes/Mentorship/MentorPageMentorManager.php(160): GrowthExperiments\Mentorship\MentorPageMentorManager->getRandomAutoAssignedMentor(User, array)
#3 /srv/mediawiki/php-master/extensions/GrowthExperiments/includes/Mentorship/MentorPageMentorManager.php(114): GrowthExperiments\Mentorship\MentorPageMentorManager->getRandomAutoAssignedMentorForUserAndRole(User, string)
#4 /srv/mediawiki/php-master/extensions/GrowthExperiments/includes/Mentorship/MentorPageMentorManager.php(169): GrowthExperiments\Mentorship\MentorPageMentorManager->getMentorForUser(User, string)
#5 /srv/mediawiki/php-master/extensions/GrowthExperiments/includes/HelpPanelHooks.php(222): GrowthExperiments\Mentorship\MentorPageMentorManager->getMentorForUserSafe(User)
#6 /srv/mediawiki/php-master/extensions/GrowthExperiments/includes/HelpPanelHooks.php(148): GrowthExperiments\HelpPanelHooks->getMentorData(GrowthExperiments\Config\GrowthExperimentsMultiConfig, User, RequestContext)
#7 /srv/mediawiki/php-master/includes/HookContainer/HookContainer.php(160): GrowthExperiments\HelpPanelHooks->onBeforePageDisplay(OutputPage, SkinVector)
#8 /srv/mediawiki/php-master/includes/HookContainer/HookRunner.php(939): MediaWiki\HookContainer\HookContainer->run(string, array, array)
#9 /srv/mediawiki/php-master/includes/OutputPage.php(2703): MediaWiki\HookContainer\HookRunner->onBeforePageDisplay(OutputPage, SkinVector)
#10 /srv/mediawiki/php-master/includes/exception/MWExceptionRenderer.php(158): OutputPage->output()
#11 /srv/mediawiki/php-master/includes/exception/MWExceptionRenderer.php(77): MWExceptionRenderer::reportHTML(Error)
#12 /srv/mediawiki/php-master/includes/exception/MWExceptionHandler.php(107): MWExceptionRenderer::output(Error, integer)
#13 /srv/mediawiki/php-master/includes/exception/MWExceptionHandler.php(202): MWExceptionHandler::report(Error)
#14 /srv/mediawiki/php-master/includes/MediaWiki.php(585): MWExceptionHandler::handleException(Error, string)
#15 /srv/mediawiki/php-master/index.php(53): MediaWiki->run()
#16 /srv/mediawiki/php-master/index.php(46): wfIndexMain()
#17 /srv/mediawiki/w/index.php(3): require(string)
#18 {main}

What should have happened instead?:

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc.:
MediaWiki e51312f GrowthExperiments 0c2cdde

Event Timeline

Tgr subscribed.

Same issue as T297827: Error: Call to a member function getId() on null. Might be worth looking at the abandoned hardening patch there.

kostajh triaged this task as High priority.Feb 7 2022, 10:38 AM

I failed to reproduce on what you said "go to any page", but something really bad do happen at Special:Homepage. Description modified, feel free to add more details.

This might be related to the MentorProvider refactoring patch. I'll take a look.

Urbanecm_WMF raised the priority of this task from High to Unbreak Now!.Feb 7 2022, 5:47 PM

Confirmed issue. Promoting to a train blocker, this will almost certainly bring some Wikipedia down with wmf.21 deployed. Thanks for reporting!

Change 760628 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/GrowthExperiments@master] WikitextMentorProvider: Unbreak weighted list for no mentor list wikis

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

This was indeed a side-effect of the MentorProvider refactoring (https://gerrit.wikimedia.org/r/c/mediawiki/extensions/GrowthExperiments/+/756130), I unintentionally deleted an important check. Added it back in the patch above. Should unbreak once merged.

Change 760628 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] WikitextMentorProvider: Unbreak weighted list for no mentor list wikis

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

Appears to work now.