ServiceCircularReferenceException with various other modules.

Created on 28 January 2021, almost 4 years ago
Updated 24 June 2024, 5 months ago

So I've run into an issue with compatibility with various other modules triggering a ServiceCircularReferenceException when Domain is used. I initially had this problem with a combination of config_split and form_mode_manager and managed to trace the issue to something to do with accessing entity_type_manager service within the container. Specifically this line:
DomainNegotiator.php:226
$this->domainStorage = $this->entityTypeManager->getStorage('domain');

Below are details on how to replicate the issue using another module which triggers the issue on every page request. The same issue is triggered by any code which tries to use the entity_type_manager service during DomainNegotiator::domainStorage call. I suspect it could be somehow related to the container cache but I really dont have enough knowledge on how all that works to diagnose further.

DB: MySql 5.7.29
PHP Version: 7.3.15

Steps to reproduce;
- Install Drupal 8.9.13
- Install drupal/domain
- Install drupal/business_rules
- Enable business_rules
- Enable domain, domain_config
- Create a domain record
- Load any page

Stack Error:

Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException: Circular reference detected for service "business_rules.processor", path: "business_rules.event_listener -> business_rules.processor". in Drupal\Component\DependencyInjection\Container->get() (line 143 of core/lib/Drupal/Component/DependencyInjection/Container.php).
Drupal::service('business_rules.processor') (Line: 323)
business_rules_entity_load(Array, 'domain') (Line: 366)
Drupal\Core\Entity\EntityStorageBase->postLoad(Array) (Line: 307)
Drupal\Core\Entity\EntityStorageBase->loadMultiple(Array) (Line: 578)
Drupal\Core\Entity\EntityStorageBase->loadByProperties(Array) (Line: 107)
Drupal\domain\DomainStorage->loadByHostname('testsite.dd:8083') (Line: 100)
Drupal\domain\DomainNegotiator->setRequestDomain('testsite.dd:8083') (Line: 144)
Drupal\domain\DomainNegotiator->negotiateActiveDomain() (Line: 153)
Drupal\domain\DomainNegotiator->getActiveDomain(1) (Line: 225)
Drupal\domain_config\DomainConfigOverrider->initiateContext() (Line: 192)
Drupal\domain_config\DomainConfigOverrider->getCacheableMetadata('business_rules.settings') (Line: 125)
Drupal\Core\Config\ConfigFactory->doGet('business_rules.settings') (Line: 89)
Drupal\Core\Config\ConfigFactory->get('business_rules.settings') (Line: 145)
Drupal\business_rules\Util\BusinessRulesProcessor->__construct(Object) (Line: 259)
Drupal\Component\DependencyInjection\Container->createService(Array, 'business_rules.processor') (Line: 173)
Drupal\Component\DependencyInjection\Container->get('business_rules.processor', 1) (Line: 434)
Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array) (Line: 237)
Drupal\Component\DependencyInjection\Container->createService(Array, 'business_rules.event_listener') (Line: 173)
Drupal\Component\DependencyInjection\Container->get('business_rules.event_listener') (Line: 105)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('business_rules.kernel_request', Object) (Line: 52)
Drupal\business_rules\EventSubscriber\KernelRequestListener->onKernelRequest(Object, 'kernel.request', Object)
call_user_func(Array, Object, 'kernel.request', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.request', Object) (Line: 127)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
πŸ› Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom Coops_ London

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024