Page MenuHomePhabricator

Fatal Error running update.php: Circular dependency when creating service in DBLoadBalancerFactory
Closed, ResolvedPublic

Description

This is the error that occurs when I run php /srv/www/htdocs/<wikiname>/maintenance/update.php in MediaWiki Version 1.35:

PHP Fatal error:  Uncaught RuntimeException: Circular dependency when creating service! DBLoadBalancerFactory -> MainObjectStash -> DBLoadBalancer -> DBLoadBalancerFactory in /srv/www/htdocs/testwiki/includes/libs/services/ServiceContainer.php:448
Stack trace:
#0 /srv/www/htdocs/testwiki/includes/libs/services/ServiceContainer.php(427): Wikimedia\Services\ServiceContainer->createService('DBLoadBalancerF...')
#1 /srv/www/htdocs/testwiki/includes/MediaWikiServices.php(679): Wikimedia\Services\ServiceContainer->getService('DBLoadBalancerF...')
#2 /srv/www/htdocs/testwiki/includes/ServiceWiring.php(282): MediaWiki\MediaWikiServices->getDBLoadBalancerFactory()
#3 /srv/www/htdocs/testwiki/includes/libs/services/ServiceContainer.php(458): Wikimedia\Services\ServiceContainer->{closure}(Object(MediaWiki\MediaWikiServices))
#4 /srv/www/htdocs/testwiki/includes/libs/services/ServiceContainer.php(427): Wikimedia\Services\ServiceContainer->createService('DBLoadBalancer')
#5 /srv/www/htdocs/testwiki/includes/MediaWikiServices.php(671): Wiki in /srv/www/htdocs/testwiki/includes/libs/services/ServiceContainer.php on line 448

Fatal error: Uncaught RuntimeException: Circular dependency when creating service! DBLoadBalancerFactory -> MainObjectStash -> DBLoadBalancer -> DBLoadBalancerFactory in /srv/www/htdocs/testwiki/includes/libs/services/ServiceContainer.php:448
Stack trace:
#0 /srv/www/htdocs/testwiki/includes/libs/services/ServiceContainer.php(427): Wikimedia\Services\ServiceContainer->createService('DBLoadBalancerF...')
#1 /srv/www/htdocs/testwiki/includes/MediaWikiServices.php(679): Wikimedia\Services\ServiceContainer->getService('DBLoadBalancerF...')
#2 /srv/www/htdocs/testwiki/includes/ServiceWiring.php(282): MediaWiki\MediaWikiServices->getDBLoadBalancerFactory()
#3 /srv/www/htdocs/testwiki/includes/libs/services/ServiceContainer.php(458): Wikimedia\Services\ServiceContainer->{closure}(Object(MediaWiki\MediaWikiServices))
#4 /srv/www/htdocs/testwiki/includes/libs/services/ServiceContainer.php(427): Wikimedia\Services\ServiceContainer->createService('DBLoadBalancer')
#5 /srv/www/htdocs/testwiki/includes/MediaWikiServices.php(671): Wiki in /srv/www/htdocs/testwiki/includes/libs/services/ServiceContainer.php on line 448

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 3 2020, 6:09 AM
Aklapper renamed this task from Fatal Error when running php /srv/www/htdocs/<wikiname>/maintenance/update.php to Fatal Error running update.php: Circular dependency when creating service in DBLoadBalancerFactory.Aug 3 2020, 8:52 AM
Aklapper edited projects, added Wikimedia-Rdbms; removed MW-1.35-release.
Restricted Application added a project: Platform Engineering. · View Herald TranscriptAug 3 2020, 8:52 AM
Reedy updated the task description. (Show Details)Aug 4 2020, 3:08 PM
Reedy added a project: MW-1.35-release.
BPirkle added a subscriber: BPirkle.EditedAug 5 2020, 6:23 PM

From the stack trace:

#0 /srv/www/htdocs/testwiki/includes/libs/services/ServiceContainer.php(427): Wikimedia\Services\ServiceContainer->createService('DBLoadBalancerF...')

I notice that this file was deleted (in master) in https://gerrit.wikimedia.org/r/c/mediawiki/core/+/608462

I tried a few things and was unable to reproduce this. @Ablum010777, can you update to the latest 1.35 code and see if this still occurs?

Legoktm changed the task status from Open to Stalled.Aug 5 2020, 10:41 PM
Legoktm added a subscriber: Legoktm.

I've been unable to reproduce this as well. I would have expected that rMW6a8943d8c53b: objectcache: dependency inject LoadBalancer into SqlBagOStuff fixed this.

@Ablum010777 can you please confirm you're running 1.35.0-rc.0? And provide any extensions you may have installed as well.

Ablum010777 added a comment.EditedAug 6 2020, 5:22 AM

Yes, I am running MediaWiki Version 1.35.0-rc.0. And these are the extensions that I'm running:

CategoryTree
Cite
CiteThisPage
CodeEditor
Collection
ConfirmEdit
DownloadBook
Gadgets
ImageMap
InputBox
Interwiki
LDAPAuthentication2
LDAPProvider
LDAPUserInfo
LocalisationUpdate
MultimediaViewer
Nuke
OATHAuth
PageImages
ParserFunctions
PdfHandler
PluggableAuth
Poem
Renameuser
ReplaceText
Scribunto
SecureLinkFixer
SpamBlacklist
SphinxSearch
SyntaxHighlight_GeSHi
TemplateData
TextExtracts
TitleBlacklist
VisualEditor
WikiEditor

And I'm running php Version 7.3.13.

Yes, I am running MediaWiki Version 1.35.0-rc.0.

How did you install this version? I'm asking because as @BPirkle mentioned earlier, the includes/libs/services/ServiceContainer.php file in your stacktrace doesn't exist in 1.35.0-rc.0.

I have just copied the new files over an old installation. But obviously this isn't possible.

Legoktm changed the task status from Stalled to Open.Aug 6 2020, 6:47 AM

Gotcha. Normally that works fine and is a supported upgrade method, so we'll have to figure something out...

My guess is that because the files use the exact same namespace, MediaWiki's PSR-4 autoloader is trying to load the old files in includes/libs/services rather than letting composer's autoloader pick them up from vendor/wikimedia/services

Change 618701 had a related patch set uploaded (by Legoktm; owner: Legoktm):
[mediawiki/core@master] AutoLoader: Remove entry for Wikimedia\Services

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

@Ablum010777 could you try applying the linked patch to your wiki and see if it fixes the issue?

That should do it. Thank you very much for your help.

Legoktm claimed this task.Aug 6 2020, 7:18 AM

Change 618701 merged by jenkins-bot:
[mediawiki/core@master] AutoLoader: Remove entry for Wikimedia\Services

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

Change 618577 had a related patch set uploaded (by Legoktm; owner: Legoktm):
[mediawiki/core@REL1_35] AutoLoader: Remove entry for Wikimedia\Services

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

Change 618577 merged by jenkins-bot:
[mediawiki/core@REL1_35] AutoLoader: Remove entry for Wikimedia\Services

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

Legoktm closed this task as Resolved.Aug 6 2020, 7:01 PM