Page MenuHomePhabricator

Circular dependency when creating service! GrowthExperimentsConfigurationLoader -> GrowthExperimentsConfigurationLoader
Closed, ResolvedPublic

Description

Wikimedia\Services\RecursiveServiceDependencyException from line 437 of /vagrant/mediawiki/vendor/wikimedia/services/src/ServiceContainer.php: Recursive service instantiation: Circular dependency when creating service! GrowthExperimentsConfigurationLoader -> GrowthExperimentsConfigurationLoader
#0 /vagrant/mediawiki/vendor/wikimedia/services/src/ServiceContainer.php(416): Wikimedia\Services\ServiceContainer->createService('GrowthExperimen...')
#1 /vagrant/mediawiki/vendor/wikimedia/services/src/ServiceContainer.php(424): Wikimedia\Services\ServiceContainer->getService('GrowthExperimen...')
#2 /vagrant/mediawiki/vendor/wikimedia/object-factory/src/ObjectFactory.php(161): Wikimedia\Services\ServiceContainer->get('GrowthExperimen...')
#3 /vagrant/mediawiki/vendor/wikimedia/object-factory/src/ObjectFactory.php(102): Wikimedia\ObjectFactory::getObjectFromSpec(Array, Array)
#4 /vagrant/mediawiki/includes/HookContainer/HookContainer.php(397): Wikimedia\ObjectFactory->createObject(Array)
#5 /vagrant/mediawiki/includes/HookContainer/HookContainer.php(150): MediaWiki\HookContainer\HookContainer->getHandlers('MessageCache::g...')
#6 /vagrant/mediawiki/includes/HookContainer/HookRunner.php(2592): MediaWiki\HookContainer\HookContainer->run('MessageCache::g...', Array)
#7 /vagrant/mediawiki/includes/cache/MessageCache.php(924): MediaWiki\HookContainer\HookRunner->onMessageCache__get('conversion-ns-2')
#8 /vagrant/mediawiki/includes/language/Message.php(1304): MessageCache->get('conversion-ns-2', true, Object(LanguageZh_hans))
#9 /vagrant/mediawiki/includes/language/Message.php(1002): Message->fetchMessage()
#10 /vagrant/mediawiki/languages/LanguageConverter.php(665): Message->exists()
#11 /vagrant/mediawiki/languages/Language.php(775): LanguageConverter->convertNamespace(-2, 'zh-hans')
#12 /vagrant/mediawiki/languages/Language.php(811): Language->getNamespaceAliases()
#13 /vagrant/mediawiki/languages/Language.php(832): Language->getNamespaceIds()
#14 /vagrant/mediawiki/includes/title/MediaWikiTitleCodec.php(355): Language->getNsIndex('mw')
#15 /vagrant/mediawiki/includes/Title.php(3413): MediaWikiTitleCodec->splitTitleString('mw:Growth/Perso...', 0)
#16 /vagrant/mediawiki/includes/Title.php(392): Title->secureAndSplit('mw:Growth/Perso...', 0)
#17 /vagrant/mediawiki/includes/Title.php(339): Title::newFromTextThrow('mw:Growth/Perso...', 0)
#18 /vagrant/mediawiki/extensions/GrowthExperiments/ServiceWiring.php(29): Title::newFromText('mw:Growth/Perso...')
#19 /vagrant/mediawiki/vendor/wikimedia/services/src/ServiceContainer.php(447): Wikimedia\Services\ServiceContainer->{closure}(Object(MediaWiki\MediaWikiServices))
#20 /vagrant/mediawiki/vendor/wikimedia/services/src/ServiceContainer.php(416): Wikimedia\Services\ServiceContainer->createService('GrowthExperimen...')
#21 /vagrant/mediawiki/vendor/wikimedia/services/src/ServiceContainer.php(424): Wikimedia\Services\ServiceContainer->getService('GrowthExperimen...')
#22 /vagrant/mediawiki/vendor/wikimedia/object-factory/src/ObjectFactory.php(161): Wikimedia\Services\ServiceContainer->get('GrowthExperimen...')
#23 /vagrant/mediawiki/vendor/wikimedia/object-factory/src/ObjectFactory.php(102): Wikimedia\ObjectFactory::getObjectFromSpec(Array, Array)
#24 /vagrant/mediawiki/includes/HookContainer/HookContainer.php(397): Wikimedia\ObjectFactory->createObject(Array)
#25 /vagrant/mediawiki/includes/HookContainer/HookContainer.php(150): MediaWiki\HookContainer\HookContainer->getHandlers('MessageCache::g...')
#26 /vagrant/mediawiki/includes/HookContainer/HookRunner.php(2592): MediaWiki\HookContainer\HookContainer->run('MessageCache::g...', Array)
#27 /vagrant/mediawiki/includes/cache/MessageCache.php(924): MediaWiki\HookContainer\HookRunner->onMessageCache__get('seconds-abbrev')
#28 /vagrant/mediawiki/includes/language/Message.php(1304): MessageCache->get('seconds-abbrev', true, Object(LanguageEn))
#29 /vagrant/mediawiki/includes/language/Message.php(862): Message->fetchMessage()
#30 /vagrant/mediawiki/includes/language/Message.php(954): Message->toString('text')
#31 /vagrant/mediawiki/languages/Language.php(4639): Message->text()
#32 /vagrant/mediawiki/maintenance/update.php(208): Language->formatTimePeriod(0.84515190124512)
#33 /vagrant/mediawiki/maintenance/doMaintenance.php(107): UpdateMediaWiki->execute()
#34 /vagrant/mediawiki/maintenance/update.php(255): require_once('/vagrant/mediaw...')
#35 /var/www/w/MWScript.php(98): require_once('/vagrant/mediaw...')
#36 {main}

Seen on my local setup. Seems to be related to LanguageConverter somehow; of the wikis set up by the Vagrant langwiki role, it only affects zhwiki and zhwikivoyagewiki.

Event Timeline

Tgr created this task.Wed, Jul 22, 4:09 PM
Restricted Application added a project: Growth-Team. · View Herald TranscriptWed, Jul 22, 4:09 PM
Restricted Application added subscribers: Cosine02, Aklapper. · View Herald Transcript
Tgr added a comment.Wed, Jul 22, 4:36 PM

Beta srwiki (the only Growth wiki which uses LanguageConverter) is not affected. Either the issue is specific to vagrant or specific to the Chinese wikis' (significantly different) language conversion configuration.

brennen triaged this task as Unbreak Now! priority.Thu, Jul 30, 7:19 PM
brennen added a subscriber: brennen.

This (or something very similar) exploded when 1.36.0-wmf.2 moved to all wikis a few minutes ago.

Tgr claimed this task.Thu, Jul 30, 7:26 PM
Tgr edited projects, added Growth-Team (Current Sprint); removed Growth-Team.
Tgr moved this task from Incoming to In Progress on the Growth-Team (Current Sprint) board.
Tgr added a comment.Thu, Jul 30, 7:29 PM

Beta srwiki (the only Growth wiki which uses LanguageConverter) is not affected.

But production srwiki is, apparently. Do their language settings differ somehow?

brennen moved this task from Backlog to Logs/Train on the User-brennen board.Thu, Jul 30, 7:36 PM
Tgr added a comment.Thu, Jul 30, 7:57 PM

Probably the immediate trigger was rEGREb2bc51779bf1: HomepageHooks: Convert to HookHandler which converted a bunch of hooks to the new system (meaning the dependencies of all hooks are fetched when any hook is invoked). Some subsequent patches build on it so it's not trivial to revert but we can revert together with followups if we are in a rush.

So, various hooks (including some very common ones like MessageCache::get or UserGetDefaultOptions) cause HomepageHooks to be instantiated, with GrowthExperimentsConfigurationLoader as a service dependency. The configuration loader tries to create a Title (from which the configuration will be loaded); that involves a namespace check, which in turn involves LanguageConverter::convertNamespace, which is customizable via system messages, so MessageCache::get is invoked again. The triggering hook varies, but otherwise it seems to be the process for all logged errors.

Change 617534 had a related patch set uploaded (by Gergő Tisza; owner: Gergő Tisza):
[mediawiki/extensions/GrowthExperiments@master] Fast and ugly fix for T258609

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

Change 617437 had a related patch set uploaded (by Gergő Tisza; owner: Gergő Tisza):
[mediawiki/extensions/GrowthExperiments@wmf/1.36.0-wmf.2] Fast and ugly fix for T258609

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

Change 617534 merged by jenkins-bot:
[mediawiki/extensions/GrowthExperiments@master] Fast and ugly fix for T258609

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

Change 617437 merged by jenkins-bot:
[mediawiki/extensions/GrowthExperiments@wmf/1.36.0-wmf.2] Fast and ugly fix for T258609

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

Mentioned in SAL (#wikimedia-operations) [2020-07-30T21:40:53Z] <catrope@deploy1001> Synchronized php-1.36.0-wmf.2/extensions/GrowthExperiments/: T258609 (duration: 01m 06s)

Change 617552 had a related patch set uploaded (by Gergő Tisza; owner: Gergő Tisza):
[mediawiki/extensions/GrowthExperiments@master] Improve I0b10612

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

Shizhao moved this task from Backlog to Extensions on the Chinese-Sites board.Fri, Jul 31, 2:42 AM
VulpesVulpes825 added a subscriber: VulpesVulpes825.

Remove Chinese-Sites as the extension has not been deployed to any zh projects.

Tgr closed this task as Resolved.Mon, Aug 3, 3:23 PM

There is a code quality improvement patch waiting for review, but the actual bug was fixed, so let's close this.