Circular reference detected for service "business_rules.processor"

Created on 3 September 2024, 3 months ago

It appears I'm getting the following error after having upgraded to version 3.0.0-beta1.

Circular reference detected for service "business_rules.processor", path: "business_rules.processor -> business_rules.util -> token -> business_rules.processor".

Oddly, it only seems to show up when I upgrade config_ignore to the latest version although I have been able to reproduce the error without upgrading config_ignore however I'm not sure of the steps for this to happen.

Is there anything worth investigating with this error? Can it be ignored or is it likely to have an impact on site behaviour?

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇬🇧United Kingdom welly

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

Comments & Activities

  • Issue created by @welly
  • I have encountered the same issue, the attached patch fixes it for me. Although the patch is logically correct as it prevents `hook_entity_view()` from running on non content entities (like form modes), I think the actual root cause for the circular reference should also be resolved.

    Steps to reproduce:

    1. Clear the plugin cache drush cc plugin.
    2. Visit any page.
    3. hook_entity_type_alter() will get invoked and will reach to a point where hook_entity_view() is invoked as well, resulting in the mentioned error.

    Full stack trace:

    The website encountered an unexpected error. Please try again later.
    
    Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException: Circular reference detected for service "business_rules.processor", path: "business_rules.event_listener -> business_rules.processor -> business_rules.util -> eca.service.token -> eca.token_data.current_user". in Drupal\Component\DependencyInjection\Container->get() (line 146 of core/lib/Drupal/Component/DependencyInjection/Container.php).
    Drupal::service('business_rules.processor') (Line: 347)
    business_rules_entity_load(Array, 'entity_form_mode') (Line: 431)
    Drupal\Core\Entity\EntityStorageBase->Drupal\Core\Entity\{closure}(Object, 'business_rules') (Line: 405)
    Drupal\Core\Extension\ModuleHandler->invokeAllWith('entity_load', Object) (Line: 432)
    Drupal\Core\Entity\EntityStorageBase->postLoad(Array) (Line: 353)
    Drupal\Core\Entity\EntityStorageBase->loadMultiple() (Line: 114)
    Drupal\Core\Entity\EntityDisplayRepository->getAllDisplayModesByEntityType('form_mode') (Line: 85)
    Drupal\Core\Entity\EntityDisplayRepository->getAllFormModes() (Line: 516)
    business_rules_entity_type_alter(Array, NULL, NULL) (Line: 562)
    Drupal\Core\Extension\ModuleHandler->alter('entity_type', Array) (Line: 334)
    Drupal\Core\Plugin\DefaultPluginManager->alterDefinitions(Array) (Line: 123)
    Drupal\Core\Entity\EntityTypeManager->findDefinitions() (Line: 175)
    Drupal\Core\Plugin\DefaultPluginManager->getDefinitions() (Line: 22)
    Drupal\Core\Plugin\DefaultPluginManager->getDefinition('user', ) (Line: 132)
    Drupal\Core\Entity\EntityTypeManager->getDefinition('user') (Line: 253)
    Drupal\Core\Entity\EntityTypeManager->getHandler('user', 'storage') (Line: 192)
    Drupal\Core\Entity\EntityTypeManager->getStorage('user') (Line: 41)
    Drupal\eca\Token\CurrentUserDataProvider->__construct(Object, Object) (Line: 262)
    Drupal\Component\DependencyInjection\Container->createService(Array, 'eca.token_data.current_user') (Line: 176)
    Drupal\Component\DependencyInjection\Container->get('eca.token_data.current_user', 1) (Line: 437)
    Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array) (Line: 276)
    Drupal\Component\DependencyInjection\Container->createService(Array, 'eca.service.token') (Line: 176)
    Drupal\Component\DependencyInjection\Container->get('eca.service.token') (Line: 176)
    Drupal\business_rules\Util\BusinessRulesUtil->__construct(Object) (Line: 262)
    Drupal\Component\DependencyInjection\Container->createService(Array, 'business_rules.util') (Line: 176)
    Drupal\Component\DependencyInjection\Container->get('business_rules.util') (Line: 159)
    Drupal\business_rules\Util\BusinessRulesProcessor->__construct(Object) (Line: 262)
    Drupal\Component\DependencyInjection\Container->createService(Array, 'business_rules.processor') (Line: 176)
    Drupal\Component\DependencyInjection\Container->get('business_rules.processor', 1) (Line: 437)
    Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array) (Line: 240)
    Drupal\Component\DependencyInjection\Container->createService(Array, 'business_rules.event_listener') (Line: 176)
    Drupal\Component\DependencyInjection\Container->get('business_rules.event_listener') (Line: 136)
    Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, Object) (Line: 52)
    Drupal\business_rules\EventSubscriber\KernelRequestListener->onKernelRequest(Object, 'kernel.request', Object)
    call_user_func(Array, Object, 'kernel.request', Object) (Line: 142)
    Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.request') (Line: 135)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
    Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
    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: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
    Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 709)
    Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
    
  • Please ignore the patch in #2.

  • Patch #3 fixed issue for me

Production build 0.71.5 2024