Page MenuHomePhabricator

Session destructor can trigger RecursiveServiceDependencyException on CI
Closed, ResolvedPublic

Description

On https://gerrit.wikimedia.org/r/c/mediawiki/extensions/ContentTranslation/+/1174592 an unrelated RecursiveServiceDependencyException failure happens
https://integration.wikimedia.org/ci/job/quibble-vendor-mysql-php81/22623/console

05:53:50 There was 1 error:
05:53:50 
05:53:50 1) GlobalPreferences\Tests\Integration\ApiOptionsGlobalIntegrationTest::testApiOptionsWhenGlobalSetToCreate
05:53:50 Wikimedia\Services\RecursiveServiceDependencyException: Recursive service instantiation: Circular dependency when creating service! JobQueueGroupFactory -> MainConfig -> ConfigFactory -> MainConfig
05:53:50 
05:53:50 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:430
05:53:50 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:406
05:53:50 /workspace/src/includes/MediaWikiServices.php:370
05:53:50 /workspace/src/includes/MediaWikiServices.php:1450
05:53:50 /workspace/src/includes/user/User.php:1846
05:53:50 /workspace/src/includes/session/SessionBackend.php:719
05:53:50 /workspace/src/includes/session/SessionBackend.php:233
05:53:50 /workspace/src/includes/session/Session.php:78
05:53:50 /workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php:504
05:53:50 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:442
05:53:50 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:406
05:53:50 /workspace/src/includes/MediaWikiServices.php:370
05:53:50 /workspace/src/includes/MediaWikiServices.php:955
05:53:50 /workspace/src/includes/ServiceWiring.php:1279
05:53:50 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:442
05:53:50 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:406
05:53:50 /workspace/src/includes/MediaWikiServices.php:370
05:53:50 /workspace/src/includes/MediaWikiServices.php:1450
05:53:50 /workspace/src/includes/ServiceWiring.php:1081
05:53:50 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:442
05:53:50 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:406
05:53:50 /workspace/src/includes/MediaWikiServices.php:370
05:53:50 /workspace/src/includes/MediaWikiServices.php:1306
05:53:50 /workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php:528
05:53:50 /workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php:669
05:53:50 
05:53:50 Caused by
05:53:50 Wikimedia\Services\RecursiveServiceDependencyException: Recursive service instantiation: Circular dependency when creating service! JobQueueGroupFactory -> MainConfig -> ConfigFactory -> MainConfig
05:53:50 
05:53:50 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:430
05:53:50 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:406
05:53:50 /workspace/src/includes/MediaWikiServices.php:370
05:53:50 /workspace/src/includes/MediaWikiServices.php:1450
05:53:50 /workspace/src/includes/user/User.php:1846
05:53:50 /workspace/src/includes/session/SessionBackend.php:719
05:53:50 /workspace/src/includes/session/SessionBackend.php:233
05:53:50 /workspace/src/includes/session/Session.php:78
05:53:50 /workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php:504
05:53:50 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:442
05:53:50 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:406
05:53:50 /workspace/src/includes/MediaWikiServices.php:370
05:53:50 /workspace/src/includes/MediaWikiServices.php:955
05:53:50 /workspace/src/includes/ServiceWiring.php:1279
05:53:50 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:442
05:53:50 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:406
05:53:50 /workspace/src/includes/MediaWikiServices.php:370
05:53:50 /workspace/src/includes/MediaWikiServices.php:1450
05:53:50 /workspace/src/includes/ServiceWiring.php:1081
05:53:50 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:442
05:53:50 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:406
05:53:50 /workspace/src/includes/MediaWikiServices.php:370
05:53:50 /workspace/src/includes/MediaWikiServices.php:1306
05:53:50 /workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php:528
05:53:50 /workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php:669

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change #1174835 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/extensions/GlobalPreferences@master] tests: Replace User with Authority in api tests

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

Change #1174843 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/core@master] user: Reset WebRequest in User::clearInstanceCache

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

Change #1174843 abandoned by Umherirrender:

[mediawiki/core@master] user: Reset WebRequest in User::clearInstanceCache

Reason:

Function clearInstanceCache() is called very often, there are side effects (as seen due to failed tests), not sure about this change in production.
As not expecting this as the general fix for the task, abandon the patch set.

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

Change #1174835 merged by jenkins-bot:

[mediawiki/extensions/GlobalPreferences@master] tests: Replace User with Authority in api tests

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

Umherirrender claimed this task.

Not sure if really fixed, but situation should be better.

T400113 was a similiar issue with circular dependency

Another case
https://integration.wikimedia.org/ci/job/quibble-vendor-mysql-php81/22607/console

00:58:10 1) Kartographer\Tests\ApiQueryMapDataTest::testQueryFromOldRevision
00:58:10 Wikimedia\Services\RecursiveServiceDependencyException: Recursive service instantiation: Circular dependency when creating service! JobQueueGroupFactory -> MainConfig -> ConfigFactory -> MainConfig
00:58:10 
00:58:10 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:430
00:58:10 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:406
00:58:10 /workspace/src/includes/MediaWikiServices.php:370
00:58:10 /workspace/src/includes/MediaWikiServices.php:1450
00:58:10 /workspace/src/includes/user/User.php:1846
00:58:10 /workspace/src/includes/session/SessionBackend.php:719
00:58:10 /workspace/src/includes/session/SessionBackend.php:233
00:58:10 /workspace/src/includes/session/Session.php:78
00:58:10 /workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php:504
00:58:10 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:442
00:58:10 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:406
00:58:10 /workspace/src/includes/MediaWikiServices.php:370
00:58:10 /workspace/src/includes/MediaWikiServices.php:955
00:58:10 /workspace/src/includes/ServiceWiring.php:1279
00:58:10 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:442
00:58:10 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:406
00:58:10 /workspace/src/includes/MediaWikiServices.php:370
00:58:10 /workspace/src/includes/MediaWikiServices.php:1450
00:58:10 /workspace/src/includes/ServiceWiring.php:1081
00:58:10 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:442
00:58:10 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:406
00:58:10 /workspace/src/includes/MediaWikiServices.php:370
00:58:10 /workspace/src/includes/MediaWikiServices.php:1306
00:58:10 /workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php:528
00:58:10 /workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php:669

Another case:
https://integration.wikimedia.org/ci/job/mediawiki-quibble-vendor-sqlite-php81/996/consoleFull

19:48:06 1) MediaWiki\Tests\Api\ApiClearHasMsgTest::testClearFlag
19:48:06 Wikimedia\Services\RecursiveServiceDependencyException: Recursive service instantiation: Circular dependency when creating service! MessageCache -> MessageParser -> ParserFactory -> LinkRendererFactory -> TitleFormatter -> GenderCache -> UserOptionsLookup -> UserOptionsManager -> _DefaultOptionsLookup -> UserIdentityLookup -> ActorStoreFactory -> UserNameUtils -> TitleParser -> InterwikiLookup -> ConnectionProvider -> UserNameUtils
19:48:06 
19:48:06 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:430
19:48:06 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:406
19:48:06 /workspace/src/includes/MediaWikiServices.php:370
19:48:06 /workspace/src/includes/MediaWikiServices.php:2188
19:48:06 /workspace/src/includes/user/User.php:1556
19:48:06 /workspace/src/includes/user/User.php:2135
19:48:06 /workspace/src/includes/user/User.php:2143
19:48:06 /workspace/src/includes/session/SessionBackend.php:699
19:48:06 /workspace/src/includes/session/SessionBackend.php:233
19:48:06 /workspace/src/includes/session/Session.php:78
19:48:06 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:438
19:48:06 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:406
19:48:06 /workspace/src/includes/MediaWikiServices.php:370
19:48:06 /workspace/src/includes/MediaWikiServices.php:991
19:48:06 /workspace/src/includes/ServiceWiring.php:1043
19:48:06 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:442
19:48:06 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:406
19:48:06 /workspace/src/includes/MediaWikiServices.php:370
19:48:06 /workspace/src/includes/MediaWikiServices.php:1278
19:48:06 /workspace/src/includes/ServiceWiring.php:2452
19:48:06 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:442
19:48:06 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:406
19:48:06 /workspace/src/includes/MediaWikiServices.php:370
19:48:06 /workspace/src/includes/MediaWikiServices.php:2078
19:48:06 /workspace/src/includes/ServiceWiring.php:2613
19:48:06 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:442
19:48:06 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:406
19:48:06 /workspace/src/includes/MediaWikiServices.php:370
19:48:06 /workspace/src/includes/MediaWikiServices.php:2188
19:48:06 /workspace/src/includes/ServiceWiring.php:349
19:48:06 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:442
19:48:06 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:406
19:48:06 /workspace/src/includes/MediaWikiServices.php:370
19:48:06 /workspace/src/includes/MediaWikiServices.php:739
19:48:06 /workspace/src/includes/ServiceWiring.php:2577
19:48:06 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:442
19:48:06 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:406
19:48:06 /workspace/src/includes/MediaWikiServices.php:370
19:48:06 /workspace/src/includes/MediaWikiServices.php:2160
19:48:06 /workspace/src/includes/ServiceWiring.php:2780
19:48:06 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:442
19:48:06 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:406
19:48:06 /workspace/src/includes/MediaWikiServices.php:370
19:48:06 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:414
19:48:06 /workspace/src/includes/ServiceWiring.php:2629
19:48:06 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:442
19:48:06 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:406
19:48:06 /workspace/src/includes/MediaWikiServices.php:370
19:48:06 /workspace/src/includes/MediaWikiServices.php:2202
19:48:06 /workspace/src/includes/ServiceWiring.php:2623
19:48:06 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:442
19:48:06 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:406
19:48:06 /workspace/src/includes/MediaWikiServices.php:370
19:48:06 /workspace/src/includes/MediaWikiServices.php:2195
19:48:06 /workspace/src/includes/ServiceWiring.php:934
19:48:06 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:442
19:48:06 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:406
19:48:06 /workspace/src/includes/MediaWikiServices.php:370
19:48:06 /workspace/src/includes/MediaWikiServices.php:1207
19:48:06 /workspace/src/includes/ServiceWiring.php:2428
19:48:06 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:442
19:48:06 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:406
19:48:06 /workspace/src/includes/MediaWikiServices.php:370
19:48:06 /workspace/src/includes/MediaWikiServices.php:2064
19:48:06 /workspace/src/includes/ServiceWiring.php:1180
19:48:06 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:442
19:48:06 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:406
19:48:06 /workspace/src/includes/MediaWikiServices.php:370
19:48:06 /workspace/src/includes/MediaWikiServices.php:1379
19:48:06 /workspace/src/includes/ServiceWiring.php:1661
19:48:06 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:442
19:48:06 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:406
19:48:06 /workspace/src/includes/MediaWikiServices.php:370
19:48:06 /workspace/src/includes/MediaWikiServices.php:1656
19:48:06 /workspace/src/includes/ServiceWiring.php:1365
19:48:06 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:442
19:48:06 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:406
19:48:06 /workspace/src/includes/MediaWikiServices.php:370
19:48:06 /workspace/src/includes/MediaWikiServices.php:1507
19:48:06 /workspace/src/includes/ServiceWiring.php:1355
19:48:06 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:442
19:48:06 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php:406
19:48:06 /workspace/src/includes/MediaWikiServices.php:370
19:48:06 /workspace/src/includes/MediaWikiServices.php:1493
19:48:06 /workspace/src/tests/phpunit/MediaWikiLangTestCase.php:27
Umherirrender triaged this task as High priority.

There a still issues (flaky tests)
https://integration.wikimedia.org/ci/job/mediawiki-quibble-vendor-sqlite-php81/1004/consoleFull
Same as comment before

12:28:28 1) MediaWiki\Tests\Api\ApiClearHasMsgTest::testClearFlag
12:28:28 Wikimedia\Services\RecursiveServiceDependencyException: Recursive service instantiation: Circular dependency when creating service! MessageCache -> MessageParser -> ParserFactory -> LinkRendererFactory -> TitleFormatter -> GenderCache -> UserOptionsLookup -> UserOptionsManager -> _DefaultOptionsLookup -> UserIdentityLookup -> ActorStoreFactory -> UserNameUtils -> TitleParser -> InterwikiLookup -> ConnectionProvider -> UserNameUtils
Umherirrender renamed this task from Session can trigger RecursiveServiceDependencyException on CI via GlobalPreferences to Session destructor can trigger RecursiveServiceDependencyException on CI.Aug 2 2025, 8:14 PM

It's not clear to me why this happens. Presumably, some service is holding a reference to a User (maybe in some cache), which is holding a reference to a WebRequest, which is holding a reference to a Session, and if the cycle GC triggers while another service is being instantiated, the whole chain is GC'd and the destructor tries to access other services?

T400249 would presumably resolve this by removing the destructor.

Another one of these due to SessionBackend::save() calling User::isAnon() calling MWS::getUserNameUtils().

It's not clear to me why this happens. Presumably, some service is holding a reference to a User (maybe in some cache), which is holding a reference to a WebRequest, which is holding a reference to a Session, and if the cycle GC triggers while another service is being instantiated, the whole chain is GC'd and the destructor tries to access other services?

It's Session destruction from the GC while ServiceContainer::createService() is in the stack somewhere. I don't think there are any special conditions to do with User and WebRequest references.

Objects with a destructor are garbage collected as soon as nothing references them anymore (not sure PHP actually guarantees this, but seems to hold in practice), and the most likely way a reference survives the end of a test is via the User -> Request -> Session reference chain. So resetting that during teardown seems like the simplest fix, although it only treats the symptom.

I think https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1174843 tried to do too much (User::$mRequest is not guaranteed to be regenerated if missing, it depends on where the user came from) but clearing the Session object there should work.

But maybe we could just flip around the way sessions are referenced? Right now there's a normal reference in WebRequest and what's essentially (a PHP5 manual implementation of) a WeakMap in SessionManager. We could use a WeakRef in WebRequest and a proper map (holding Sessions rather than SessionBackends) in SessionManager, now that it's a proper service? And rather than using the destructor, just save the sessions when SessionManager is destroyed (can be done without a destructor if we make it a DestructibleService) and in the various MediaWikiEntryPoint end points?

All failing tests are api tests.
Looking at the mw-debug-cli.log there is:

[session] SessionBackend "padimfohv7f8u1lpdfd3a6k8upe63ecr" data dirty due to dirty(): PHPUnit\Framework\TestResult->run/PHPUnit\Framework\TestCase->runBare/MediaWiki\Tests\Api\ApiTestCase->tearDown/MediaWiki\Session\Session->clear/MediaWiki\Session\SessionBackend->dirty
[PHPUnit] ERROR in test MediaWiki\Tests\Api\ApiClearHasMsgTest::testClearFlag: Recursive service instantiation: Circular dependency when creating service! MessageCache -> MessageParser -> ParserFactory -> LinkRendererFactory -> TitleFormatter -> GenderCache -> UserOptionsLookup -> UserOptionsManager -> _DefaultOptionsLookup -> UserIdentityLookup -> ActorStoreFactory -> UserNameUtils -> TitleParser -> InterwikiLookup -> ConnectionProvider -> UserNameUtils

Going to remove the Session::clear from api teardown as SessionManager is a service and clears itself, but that does not help, it shows different stack traces (done in https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1175906)

16:39:14 1) MediaWiki\Tests\Api\ApiBaseTest::testGetTitleOrPageIdInvalidTitle
16:39:14 Wikimedia\Services\RecursiveServiceDependencyException: Recursive service instantiation: Circular dependency when creating service! MessageCache -> ContentLanguage -> LanguageFactory -> LocalisationCache -> UserNameUtils -> ContentLanguage
16:35:39 1) MediaWiki\Tests\Api\ApiMainTest::testAssert with data set #1 ('registered', 'user', false)
16:35:39 Wikimedia\Services\RecursiveServiceDependencyException: Recursive service instantiation: Circular dependency when creating service! MessageCache -> ContentLanguage -> LanguageFactory -> LocalisationCache -> UserNameUtils -> ContentLanguage

But all have UserNameUtils involved from User::getId.

SessionManager::__construct calls register_shutdown_function with a reference to $this, holding the session manager object until shutdown. For tests the shutdown is the end of phpunit (as far I have understand it).

This complicates the session teardown for each test as sessions object are still in memory with some of the its backends hold by session managers created for each test.

Change #1175941 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/core@master] session: Register shutdown for SessionManager in Setup.php

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

I would just wait for T400249, we can probably do that this week.

Objects with a destructor are garbage collected as soon as nothing references them anymore (not sure PHP actually guarantees this, but seems to hold in practice),

I'm pretty familiar with how GC works in PHP since I've debugged segfaults in it, which included reading the paper and discussing the details with Dmitry Stogov.

PHP uses a hybrid model with both reference counting and a garbage collector. Yes the destructor will be called and the object will be freed when the number of references falls to zero. That's not called garbage collection.

When an object is involved in a reference loop, the object can't be freed by normal reference counting. The garbage collector is periodically called, which traverses the reference graph in order to mark and free objects that are only reachable via circular references.

and the most likely way a reference survives the end of a test is via the User -> Request -> Session reference chain. So resetting that during teardown seems like the simplest fix, although it only treats the symptom.

Could be, although it requires a call to User::newFromSession() since that's the only thing that sets User::$mRequest, and that's rare in tests. Note that it's not necessary for Session to actually be part of the circular reference, it's enough for an object with a circular reference to have a reference to a Session.

Could be, although it requires a call to User::newFromSession() since that's the only thing that sets User::$mRequest, and that's rare in tests.

Unfortunately it is common, not in test code itself, but in cleanup code. It's called from here: https://gerrit.wikimedia.org/g/mediawiki/core/+/70d5b2a02cbb913f8b6ad970cb1fea271309563d/tests/phpunit/MediaWikiIntegrationTestCase.php#816

I touched that code recently, but I only moved it from another part of cleanup to resolve some test failures: https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1172699/8/tests/phpunit/MediaWikiIntegrationTestCase.php

Maybe there is some better way to reset the global user.

Maybe there is some better way to reset the global user.

You can wrap it with if ( RequestContext::getMain()->hasUser() ) although that's not enough to fix the problem. I set a breakpoint in User::newFromSession() and it shows many calls from tests via RequestContext::getMain()->getUser(). Apologies for being very wrong about that.

I added a call to gc_collect_cycles() from MediaWikiIntegrationTestCase::mediaWikiTearDown and set a breakpoint in Session::__destruct(), and then ran ApiRevisionDeleteTest. The destructor was reliably called from this manual GC run.

By setting a breakpoint on User::__destruct(), I found that none of the User objects destroyed by garbage collection had mRequest set. However one did have User->mThisAsAuthority which loops back to the same User via the actor property. UserAuthority has a WebRequest reference which keeps the Session alive.

I also noticed a loop via SessionBackend::$requests.

By compiling PHP with ZEND_GC_DEBUG=2 I got the following list of objects destroyed in a single GC run. Unfortunately it doesn't tell you the reference relationships. There is a loop ParserFactory -> Parser -> ParserFactory which is apparently involved, and the User object was probably kept alive via the ParserOptions.

object(MediaWiki\Block\HideUserUtils)#1340
object(MediaWiki\Category\TrackingCategories)#1845
object(MediaWiki\CommentStore\CommentStore)#1962
object(MediaWiki\Config\ServiceOptions)#1604
object(MediaWiki\Config\ServiceOptions)#1915
object(MediaWiki\Content\ContentHandlerFactory)#1939
object(MediaWiki\FileRepo\RepoGroup)#1779
object(MediaWiki\Language\LanguageFactory)#1728
object(MediaWiki\Linker\LinkRendererFactory)#2093
object(MediaWiki\Linker\LinksMigration)#2019
object(MediaWiki\Page\File\BadFileLookup)#2055
object(MediaWiki\Page\LinkCache)#1639
object(MediaWiki\Parser\MagicWordFactory)#1709
object(MediaWiki\Parser\Parser)#2875
object(MediaWiki\Parser\Parser)#634
object(MediaWiki\Parser\ParserFactory)#1289
object(MediaWiki\Parser\ParserOptions)#2697
object(MediaWiki\Parser\ParserOutput)#2709
object(MediaWiki\Preferences\SignatureValidatorFactory)#1931
object(MediaWiki\Session\Session)#2838
object(MediaWiki\SpecialPage\SpecialPageFactory)#1079
object(MediaWiki\Tidy\RemexDriver)#1751
object(MediaWiki\Title\TitleFormatter)#1710
object(MediaWiki\User\ActorStore)#1388
object(MediaWiki\User\Options\UserOptionsManager)#1785
object(MediaWiki\User\User)#2113
object(MediaWiki\User\UserFactory)#1793
object(MediaWiki\User\UserIdentityUtils)#1858
object(MediaWiki\Utils\UrlUtils)#1681
object(NullHttpRequestFactory)#1807
object(Wikimedia\Rdbms\ReadOnlyMode)#2022
object(Wikimedia\UUID\GlobalIdGenerator)#1901

Parser::$factory is assigned but never used due to an incomplete cleanup in e2fd40cb775441e5e47a97ec626306d2bb56f9eb.

I just got the same error on a fresh patch I created this morning: https://gerrit.wikimedia.org/r/1176350

08:14:34 1) Kartographer\Tests\ApiQueryMapDataTest::testQueryFromOldRevision
08:14:34 Wikimedia\Services\RecursiveServiceDependencyException: Recursive service instantiation: Circular dependency when creating service! JobQueueGroupFactory -> MainConfig -> ConfigFactory -> MainConfig

As far as I understand this has not really anything to do with Maps (Kartographer), or does it?

I just got the same error on a fresh patch I created this morning: https://gerrit.wikimedia.org/r/1176350

08:14:34 1) Kartographer\Tests\ApiQueryMapDataTest::testQueryFromOldRevision
08:14:34 Wikimedia\Services\RecursiveServiceDependencyException: Recursive service instantiation: Circular dependency when creating service! JobQueueGroupFactory -> MainConfig -> ConfigFactory -> MainConfig

As far as I understand this has not really anything to do with Maps (Kartographer), or does it?

It is not related to any extension, looks like more a problem in core. This happens for that extensions already some days ago as well (T400950#11054603)