Was getting this in the logs:

ServiceCircularReferenceException: Circular reference detected for service "domain_config_ui.factory", path: "options_request_listener -> 
router.route_provider -> path_processor_manager -> path_processor_language -> domain_config_ui.factory -> domain.config_factory_override -> exception.fast_404_html". in 
/var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 147

Issue fork domain-3554878

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mably created an issue. See original summary.

mably’s picture

Issue summary: View changes
mably’s picture

Issue summary: View changes

mably’s picture

Status: Active » Needs review

The implemented solution that fixed the problem was to remove the ACTIVE_DOMAIN_SET from the getSubscribedEvents() method and rather call addListener for the same event in the DomainConfigFactoryOverride constructor.

Looks like some very early call to domain negotiation was generating the ACTIVE_DOMAIN_SET event that was causing Drupal to instantiate the config overrider service, as it is a subscriber for that event, but as the service was already being loaded/initialized, it caused a fatal loop.

Sadly, I haven't been able to reproduce the problem since then.

I you have any idea of what could be the root cause of this problem, feel free to share.

mably’s picture

Posting another stack trace I was getting where we can see that the DomainConfigFactoryOverride service is looping on itself:

Symfony\\Component\\DependencyInjection\\Exception\\ServiceCircularReferenceException: Circular reference detected for service "domain.config_factory_override", path: "domain.config_factory_override". in /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 147 #0 /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php(454): Drupal\\Component\\DependencyInjection\\Container->get('domain.config_f...', 1)\n#1 /var/www/html/vendor/symfony/event-dispatcher/EventDispatcher.php(243): Drupal\\Component\\DependencyInjection\\Container->Drupal\\Component\\DependencyInjection\\{closure}()\n#2 /var/www/html/vendor/symfony/event-dispatcher/EventDispatcher.php(206): Symfony\\Component\\EventDispatcher\\EventDispatcher::Symfony\\Component\\EventDispatcher\\{closure}(Object(Drupal\\domain\\DomainEvent), 'domain.active_d...', Object(Symfony\\Component\\EventDispatcher\\EventDispatcher))\n#3 /var/www/html/vendor/symfony/event-dispatcher/EventDispatcher.php(56): Symfony\\Component\\EventDispatcher\\EventDispatcher->callListeners(Array, 'domain.active_d...', Object(Drupal\\domain\\DomainEvent))\n#4 /var/www/html/web/modules/contrib/domain/domain/src/DomainNegotiator.php(121): Symfony\\Component\\EventDispatcher\\EventDispatcher->dispatch(Object(Drupal\\domain\\DomainEvent), 'domain.active_d...')\n#5 /var/www/html/web/modules/contrib/domain/domain/src/DomainNegotiator.php(101): Drupal\\domain\\DomainNegotiator->setActiveDomain(Object(Drupal\\domain\\Entity\\Domain))\n#6 /var/www/html/web/modules/contrib/domain/domain/src/DomainNegotiator.php(137): Drupal\\domain\\DomainNegotiator->setRequestDomain('local-drupal11....')\n#7 /var/www/html/web/modules/contrib/domain/domain/src/DomainNegotiator.php(151): Drupal\\domain\\DomainNegotiator->negotiateActiveDomain()\n#8 /var/www/html/web/modules/contrib/domain/domain/src/DomainNegotiator.php(167): Drupal\\domain\\DomainNegotiator->getActiveDomain()\n#9 /var/www/html/web/modules/contrib/domain_extras/domain_maintenance/src/Service/DomainMaintenanceMode.php(47): Drupal\\domain\\DomainNegotiator->getActiveId()\n#10 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/MaintenanceModeSubscriber.php(117): Drupal\\domain_maintenance\\Service\\DomainMaintenanceMode->applies(Object(Drupal\\Core\\Routing\\NullRouteMatch))\n#11 /var/www/html/vendor/symfony/event-dispatcher/EventDispatcher.php(246): Drupal\\Core\\EventSubscriber\\MaintenanceModeSubscriber->onKernelRequestMaintenance(Object(Symfony\\Component\\HttpKernel\\Event\\ExceptionEvent), 'kernel.exceptio...', Object(Symfony\\Component\\EventDispatcher\\EventDispatcher))\n#12 /var/www/html/vendor/symfony/event-dispatcher/EventDispatcher.php(206): Symfony\\Component\\EventDispatcher\\EventDispatcher::Symfony\\Component\\EventDispatcher\\{closure}(Object(Symfony\\Component\\HttpKernel\\Event\\ExceptionEvent), 'kernel.exceptio...', Object(Symfony\\Component\\EventDispatcher\\EventDispatcher))\n#13 /var/www/html/vendor/symfony/event-dispatcher/EventDispatcher.php(56): Symfony\\Component\\EventDispatcher\\EventDispatcher->callListeners(Array, 'kernel.exceptio...', Object(Symfony\\Component\\HttpKernel\\Event\\ExceptionEvent))\n#14 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(241): Symfony\\Component\\EventDispatcher\\EventDispatcher->dispatch(Object(Symfony\\Component\\HttpKernel\\Event\\ExceptionEvent), 'kernel.exceptio...')\n#15 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(91): Symfony\\Component\\HttpKernel\\HttpKernel->handleThrowable(Object(Error), Object(Symfony\\Component\\HttpFoundation\\Request), 1)\n#16 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\\Component\\HttpKernel\\HttpKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#17 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\\Core\\StackMiddleware\\Session->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#18 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\\Core\\StackMiddleware\\KernelPreHandle->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#19 /var/www/html/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\\Core\\StackMiddleware\\ContentLength->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#20 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(116): Drupal\\big_pipe\\StackMiddleware\\ContentLength->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#21 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(90): Drupal\\page_cache\\StackMiddleware\\PageCache->pass(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#22 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\\page_cache\\StackMiddleware\\PageCache->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#23 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\\Core\\StackMiddleware\\ReverseProxyMiddleware->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#24 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(53): Drupal\\Core\\StackMiddleware\\NegotiationMiddleware->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#25 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\\Core\\StackMiddleware\\AjaxPageState->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#26 /var/www/html/web/core/lib/Drupal/Core/DrupalKernel.php(715): Drupal\\Core\\StackMiddleware\\StackedHttpKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#27 /var/www/html/web/index.php(19): Drupal\\Core\\DrupalKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request))\n#28 {main}

Most likely, an ACTIVE_DOMAIN_SET event is trying to instantiate the service while it is already being initialized.

mably’s picture

Assigned: mably » Unassigned
mably’s picture

This circular dependency error indicates the ACTIVE_DOMAIN_SET event is firing while the config overrider factory is still initializing. As a result, the service may never receive that event, preventing it from functioning as intended.

A more robust approach would be to remove the event subscription mechanism altogether and rely instead on a dedicated domain negotiation context service.

Created a new issue to work on that: #3554949: Use a domain negotiation context service instead of an event subscriber in config services

Any feedback will be greatly appreciated.

mably’s picture

Issue summary: View changes

  • mably committed 0ec565d1 on 3.x
    Issue #3554878 by mably: Fix circular dependency error
    
mably’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.