Problem/Motivation

There is a circular reference issue:

Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException: Circular reference detected for service "workflow_participants.state_transition_validation", path: "workflow_participants.state_transition_validation". in Drupal\Component\DependencyInjection\Container->get() (line 141 of core/lib/Drupal/Component/DependencyInjection/Container.php).
Drupal\Component\DependencyInjection\Container->get('workflow_participants.state_transition_validation') (Line: 114)
Drupal\content_moderation\EntityTypeInfo::create(Object) (Line: 28)
Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition('Drupal\content_moderation\EntityTypeInfo') (Line: 63)
content_moderation_entity_type_alter(Array, NULL, NULL) (Line: 501)
Drupal\Core\Extension\ModuleHandler->alter('entity_type', Array) (Line: 332)
Drupal\Core\Plugin\DefaultPluginManager->alterDefinitions(Array) (Line: 117)
Drupal\Core\Entity\EntityTypeManager->findDefinitions() (Line: 174)
Drupal\Core\Plugin\DefaultPluginManager->getDefinitions() (Line: 22)
Drupal\Core\Plugin\DefaultPluginManager->getDefinition('workflow_participants', ) (Line: 126)
Drupal\Core\Entity\EntityTypeManager->getDefinition('workflow_participants') (Line: 233)
Drupal\Core\Entity\EntityTypeManager->getHandler('workflow_participants', 'storage') (Line: 169)
Drupal\Core\Entity\EntityTypeManager->getStorage('workflow_participants') (Line: 43)
Drupal\workflow_participants\StateTransitionValidation->__construct(Object, Object) (Line: 266)
Drupal\Component\DependencyInjection\Container->createService(Array, 'workflow_participants.state_transition_validation') (Line: 171)
Drupal\Component\DependencyInjection\Container->get('workflow_participants.state_transition_validation') (Line: 114)
Drupal\content_moderation\EntityTypeInfo::create(Object) (Line: 28)
Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition('Drupal\content_moderation\EntityTypeInfo') (Line: 63)
content_moderation_entity_type_alter(Array, NULL, NULL) (Line: 501)
Drupal\Core\Extension\ModuleHandler->alter('entity_type', Array) (Line: 332)
Drupal\Core\Plugin\DefaultPluginManager->alterDefinitions(Array) (Line: 117)
Drupal\Core\Entity\EntityTypeManager->findDefinitions() (Line: 174)
Drupal\Core\Plugin\DefaultPluginManager->getDefinitions() (Line: 22)
Drupal\Core\Plugin\DefaultPluginManager->getDefinition('user_role', ) (Line: 126)
Drupal\Core\Entity\EntityTypeManager->getDefinition('user_role') (Line: 233)
Drupal\Core\Entity\EntityTypeManager->getHandler('user_role', 'storage') (Line: 169)
Drupal\Core\Entity\EntityTypeManager->getStorage('user_role') (Line: 79)
Drupal\Core\Entity\EntityManager->getStorage('user_role') (Line: 205)
Drupal\Core\Session\UserSession->getRoleStorage() (Line: 111)
Drupal\Core\Session\UserSession->hasPermission('access site in maintenance mode') (Line: 92)
Drupal\Core\Session\AccountProxy->hasPermission('access site in maintenance mode') (Line: 52)
Drupal\Core\Site\MaintenanceMode->exempt(Object) (Line: 99)
Drupal\Core\EventSubscriber\MaintenanceModeSubscriber->onKernelRequestMaintenance(Object, 'kernel.exception', Object) (Line: 108)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.exception', Object) (Line: 230)
Symfony\Component\HttpKernel\HttpKernel->handleException(Object, Object, 1) (Line: 79)
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: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 656)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#2 2896536-02.patch1.78 KBjhedstrom

Comments

jhedstrom created an issue. See original summary.

jhedstrom’s picture

Status: Active » Needs review
StatusFileSize
new1.78 KB

The issue was that the service was loading participant storage too early. The fix is to just store the entity type manager and load the storage only when needed.

  • jhedstrom committed 5610f72 on 8.x-2.x
    Issue #2896536 by jhedstrom: Circular reference detected for service...
jhedstrom’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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