Problem/Motivation

In a fresh Ddev instance using the eca_starterkit recipe, enabling the bpmn_io.module (3.0.5) leads to this error:

Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException: Circular reference detected for service "eca.token_browser", path: "eca.token_browser". in Drupal\Component\DependencyInjection\Container->get() (line 147 of /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php)

Steps to reproduce

  • composer require 'drupal/eca_starterkit'
  • drush recipe ../recipes/eca_starterkit
  • composer require 'drupal/bpmn_io:^3.0'
  • drush en bpmn_io

Issue fork eca-3579837

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:

Issue fork bpmn_io-3579837

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

bisonbleu created an issue. See original summary.

jurgenhaas’s picture

I can't reproduce this. May be a cache issue? Even for new installs, caches are sometimes surviving a re-install.

bisonbleu’s picture

It may be because versions of many modules are moving/changing very fast.
I'll rebuild my ddev eca-sandbox from scratch and report back…

bisonbleu’s picture

Confirming that the reported issue still occurs in a new fresh ddev instance.
Could this be similar to #3567623: Circular Dependency in Token Service during hook discovery ?
And AFAICT this is NOT a bpmn.io issue but rather an eca issue?

DDEV SETUP
% mkdir eca-sandbox && cd eca-sandbox
% ddev config --project-type=drupal11 --docroot=web
% ddev composer create "drupal/recommended-project:^11.0" --no-install
% ddev composer require drush/drush
% ddev composer install
% mkdir -p config/sync
% cp web/sites/example.settings.local.php web/sites/default/settings.local.php
% cp ../d11-sandbox/.gitignore .gitignore

- configure settings.php

% ddev start
% ddev drush site:install --locale=en --account-name=admin --account-pass=admin -y
% git init
% ddev composer config minimum-stability dev
% ddev composer require cweagans/composer-patches
% ddev composer require drupal/admin_toolbar drupal/asset_injector drupal/pathauto drupal/redirect drupal/token drupal/ctools
% ddev composer require 'drupal/eca_starterkit'
% ddev drush recipe ../recipes/eca_starterki
% ddev drush cr

Then, in the admin UI, uninstall for example eca_content and re-enable it.
That's when & where I get the reported error.

bisonbleu changed the visibility of the branch 3579837-circular-reference-detected to hidden.

jurgenhaas’s picture

Project: BPMN.iO » ECA: Event - Condition - Action
Version: 3.0.5 » 3.1.x-dev

OK, the missing piece to reproducing this was the uninstall/re-enable steps for eca_content. I can now reproduce this and hopefully fix it together with the patch that @bisonbleu provided in Slack.

jurgenhaas’s picture

Further clarification: this only happens in the UI. When disabling/re-enabling eca_content with drush, this doesn't happen. That makes me wonder if the rendering layer is calling something in the middle of a container rebuild or the likes.

Here is the full stack trace:

Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException: Circular reference detected for service "eca.token_browser", path: "eca.token_browser". in Drupal\Component\DependencyInjection\Container->get() (line 147 of core/lib/Drupal/Component/DependencyInjection/Container.php).
Drupal\eca\Plugin\ECA\Event\EventBase::create(Object, Array, 'content_entity:preload', Array) (Line: 89)
Drupal\eca_content\Plugin\ECA\Event\ContentEntityEvent::create(Object, Array, 'content_entity:preload', Array) (Line: 21)
Drupal\Core\Plugin\Factory\ContainerFactory->createInstance('content_entity:preload', Array) (Line: 85)
Drupal\Component\Plugin\PluginManagerBase->createInstance('content_entity:preload') (Line: 58)
Drupal\eca\Event\TriggerEvent->dispatchFromPlugin('content_entity:preload', Array, 'user') (Line: 98)
Drupal\eca_content\Hook\ContentHooks->entityPreload(Array, 'user')
call_user_func_array(Array, Array) (Line: 389)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Array, 'eca_content') (Line: 340)
Drupal\Core\Extension\ModuleHandler->invokeAllWith('entity_preload', Object) (Line: 388)
Drupal\Core\Extension\ModuleHandler->invokeAll('entity_preload', Array) (Line: 621)
Drupal\Core\Entity\ContentEntityStorageBase->preLoad(Array) (Line: 323)
Drupal\Core\Entity\EntityStorageBase->loadMultiple(Array) (Line: 267)
Drupal\Core\Entity\EntityStorageBase->load('2') (Line: 216)
Drupal\Core\Session\AccountProxy->loadUserEntity('2') (Line: 77)
Drupal\Core\Session\AccountProxy->getAccount() (Line: 135)
Drupal\Core\Session\AccountProxy->isAnonymous() (Line: 221)
Drupal\Core\TempStore\PrivateTempStore->getOwner() (Line: 210)
Drupal\Core\TempStore\PrivateTempStore->createKey('testing::') (Line: 182)
Drupal\Core\TempStore\PrivateTempStore->delete('testing::') (Line: 116)
Drupal\eca\Token\Browser->__construct(Object, Object, Object, Object, Object, Object, Object, Object, Object) (Line: 259)
Drupal\Component\DependencyInjection\Container->createService(Array, 'eca.token_browser') (Line: 177)
Drupal\Component\DependencyInjection\Container->get('eca.token_browser') (Line: 74)
Drupal\eca\Plugin\ECA\Event\EventBase::create(Object, Array, 'content_entity:preload', Array) (Line: 89)
Drupal\eca_content\Plugin\ECA\Event\ContentEntityEvent::create(Object, Array, 'content_entity:preload', Array) (Line: 21)
Drupal\Core\Plugin\Factory\ContainerFactory->createInstance('content_entity:preload', Array) (Line: 85)
Drupal\Component\Plugin\PluginManagerBase->createInstance('content_entity:preload') (Line: 58)
Drupal\eca\Event\TriggerEvent->dispatchFromPlugin('content_entity:preload', Array, 'user') (Line: 98)
Drupal\eca_content\Hook\ContentHooks->entityPreload(Array, 'user')
call_user_func_array(Array, Array) (Line: 389)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Array, 'eca_content') (Line: 340)
Drupal\Core\Extension\ModuleHandler->invokeAllWith('entity_preload', Object) (Line: 388)
Drupal\Core\Extension\ModuleHandler->invokeAll('entity_preload', Array) (Line: 621)
Drupal\Core\Entity\ContentEntityStorageBase->preLoad(Array) (Line: 323)
Drupal\Core\Entity\EntityStorageBase->loadMultiple(Array) (Line: 267)
Drupal\Core\Entity\EntityStorageBase->load('2') (Line: 216)
Drupal\Core\Session\AccountProxy->loadUserEntity('2') (Line: 77)
Drupal\Core\Session\AccountProxy->getAccount() (Line: 121)
Drupal\Core\Session\AccountProxy->hasPermission('administer permissions') (Line: 154)
Drupal\Core\Access\AccessResult::allowedIfHasPermissions(Object, Array, 'OR') (Line: 43)
Drupal\user\Access\PermissionAccessCheck->access(Object, Object)
call_user_func_array(Array, Array) (Line: 160)
Drupal\Core\Access\AccessManager->performCheck('access_check.permission', Object) (Line: 136)
Drupal\Core\Access\AccessManager->check(Object, Object, NULL, ) (Line: 93)
Drupal\Core\Access\AccessManager->checkNamedRoute('user.admin_permissions.module', Array, Object, ) (Line: 817)
Drupal\Core\Url->access(Object) (Line: 44)
Drupal\system\Form\ModulesListForm->modulesEnabledConfirmationMessage(Array) (Line: 505)
Drupal\system\Form\ModulesListForm->submitForm(Array, Object) (Line: 108)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 45)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 615)
Drupal\Core\Form\FormBuilder->processForm('system_modules', Array, Object) (Line: 347)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 634)
Drupal\Core\Render\Renderer::Drupal\Core\Render\{closure}()
Fiber->resume() (Line: 649)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 183)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 118)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 92)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 82)
Drupal\crowdsec\Middleware->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: 53)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 54)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 745)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

jurgenhaas’s picture

Status: Active » Needs review

Fortunately, the solution was to remove a bad habit that I used in the constructor of the Browser service: doing initialization work there. This is always asking for trouble.

That class is now declared final, as there really isn't any need to extend that. Everything inside is now private, and the initialization work is done in getters.

The problem seems to be resolved by this. Please test and set to RTBC if you can confirm.

bisonbleu’s picture

I tested the issue’s patch and the circular reference error is gone. FYI - I was also seeing it when flushing all caches from the admin UI; now this is also fine.

One thing though: after uninstalling and re-enabling eca_content, I’m seeing these 4 other errors in the watchdog:

Preconfigured action with a missing plugin found. You should delete that action with "drush config:delete system.action.node_unpromote_action". The "node_unpromote_action" plugin does not exist. 
Preconfigured action with a missing plugin found. You should delete that action with "drush config:delete system.action.node_promote_action". The "node_promote_action" plugin does not exist.
Preconfigured action with a missing plugin found. You should delete that action with "drush config:delete system.action.node_make_unsticky_action". The "node_make_unsticky_action" plugin does not exist.
Preconfigured action with a missing plugin found. You should delete that action with "drush config:delete system.action.node_make_sticky_action". The "node_make_sticky_action" plugin does not exist.
jurgenhaas’s picture

Those follow-up messages are unrelated to ECA, I'm convinced. Those are action plugins from Drupal core that are missing something. Following the instructions on how to delete them, should resolve that for you.

Glad to see that the real issue is resolved, though. Thanks for finding and reporting it.

  • jurgenhaas committed b8e7c0f2 on 3.1.x
    #3579837 Refactor Token Browser to use lazy initialization and prevent...
jurgenhaas’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.

chris matthews’s picture

Interestingly, I'm also getting this when installing a new module via the admin UI.

The website encountered an unexpected error. Try again later.

Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException: Circular reference detected for service "eca.token_browser", path: "eca.token_browser". in Drupal\Component\DependencyInjection\Container->get() (line 147 of core/lib/Drupal/Component/DependencyInjection/Container.php).

Drupal\eca\Plugin\ECA\Event\EventBase::create() (Line: 89)
Drupal\eca_content\Plugin\ECA\Event\ContentEntityEvent::create() (Line: 21)
Drupal\Core\Plugin\Factory\ContainerFactory->createInstance() (Line: 85)
Drupal\Component\Plugin\PluginManagerBase->createInstance() (Line: 58)
Drupal\eca\Event\TriggerEvent->dispatchFromPlugin() (Line: 98)
Drupal\eca_content\Hook\ContentHooks->entityPreload()
call_user_func_array() (Line: 389)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}() (Line: 340)
Drupal\Core\Extension\ModuleHandler->invokeAllWith() (Line: 388)
Drupal\Core\Extension\ModuleHandler->invokeAll() (Line: 621)
Drupal\Core\Entity\ContentEntityStorageBase->preLoad() (Line: 323)
Drupal\Core\Entity\EntityStorageBase->loadMultiple() (Line: 267)
Drupal\Core\Entity\EntityStorageBase->load() (Line: 216)
Drupal\Core\Session\AccountProxy->loadUserEntity() (Line: 77)
Drupal\Core\Session\AccountProxy->getAccount() (Line: 135)
Drupal\Core\Session\AccountProxy->isAnonymous() (Line: 221)
Drupal\Core\TempStore\PrivateTempStore->getOwner() (Line: 210)
Drupal\Core\TempStore\PrivateTempStore->createKey() (Line: 182)
Drupal\Core\TempStore\PrivateTempStore->delete() (Line: 116)
Drupal\eca\Token\Browser->__construct() (Line: 259)
Drupal\Component\DependencyInjection\Container->createService() (Line: 177)
Drupal\Component\DependencyInjection\Container->get() (Line: 74)
Drupal\eca\Plugin\ECA\Event\EventBase::create() (Line: 89)
Drupal\eca_content\Plugin\ECA\Event\ContentEntityEvent::create() (Line: 21)
Drupal\Core\Plugin\Factory\ContainerFactory->createInstance() (Line: 85)
Drupal\Component\Plugin\PluginManagerBase->createInstance() (Line: 58)
Drupal\eca\Event\TriggerEvent->dispatchFromPlugin() (Line: 98)
Drupal\eca_content\Hook\ContentHooks->entityPreload()
call_user_func_array() (Line: 389)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}() (Line: 340)
Drupal\Core\Extension\ModuleHandler->invokeAllWith() (Line: 388)
Drupal\Core\Extension\ModuleHandler->invokeAll() (Line: 621)
Drupal\Core\Entity\ContentEntityStorageBase->preLoad() (Line: 323)
Drupal\Core\Entity\EntityStorageBase->loadMultiple() (Line: 267)
Drupal\Core\Entity\EntityStorageBase->load() (Line: 216)
Drupal\Core\Session\AccountProxy->loadUserEntity() (Line: 77)
Drupal\Core\Session\AccountProxy->getAccount() (Line: 121)
Drupal\Core\Session\AccountProxy->hasPermission() (Line: 154)
Drupal\Core\Access\AccessResult::allowedIfHasPermissions() (Line: 43)
Drupal\user\Access\PermissionAccessCheck->access()
call_user_func_array() (Line: 160)
Drupal\Core\Access\AccessManager->performCheck() (Line: 136)
Drupal\Core\Access\AccessManager->check() (Line: 93)
Drupal\Core\Access\AccessManager->checkNamedRoute() (Line: 817)
Drupal\Core\Url->access() (Line: 44)
Drupal\system\Form\ModulesListForm->modulesEnabledConfirmationMessage() (Line: 505)
Drupal\system\Form\ModulesListForm->submitForm() (Line: 108)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers() (Line: 45)
Drupal\Core\Form\FormSubmitter->doSubmitForm() (Line: 615)
Drupal\Core\Form\FormBuilder->processForm() (Line: 347)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
Drupal\Core\Controller\FormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 634)
Drupal\Core\Render\Renderer::Drupal\Core\Render\{closure}()
Fiber->resume() (Line: 649)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 183)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 118)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 92)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 53)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 54)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 745)
Drupal\Core\DrupalKernel->handle() (Line: 19)
jurgenhaas’s picture

@chris matthews which version did that happen with? Note, this either required 3.1.x-dev or 3.1.0-rc1 which was tagged around the time when you sent that comment above.

chris matthews’s picture

I am on:

  • Drupal Core 11.3.5
  • ECA Core: 3.1.0-beta2
  • Modeler API: 1.1.0-beta3
  • BPMN.iO Modeler: 3.0.5

Note, on the project page, I see:

BPMN.iO is the recommended ECA modeller. It's a JavaScript-based implementation for building models as two-dimensional diagrams, integrated into the Drupal admin UI.

However, in the ECA docs (https://ecaguide.org/eca/install/), I see I should likely be using: Workflow Modeler, so I'll try switching to that.

jurgenhaas’s picture

So, the bug is resolved in the rc1 release.

The discrepancy of recommended modeler comes from the fact that the new modeler is a bit of the secret until Tuesday, at DrupalCon. Some parts like the eca guide have already been updated, but not all yet.

Status: Fixed » Closed (fixed)

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