File Log causes recursion error when cache is cleared via the UI if Token module is also present

Created on 15 July 2024, 5 months ago

Problem/Motivation

When attempting to clear all caches via the Drupal UI, the module throws a recursion error involving tokens. Here is the error from the watchdog log:

Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException: Circular reference detected for service "token", path: "webform.email_provider -> plugin.manager.mail -> logger.factory -> logger.filelog -> token -> cache_tags.invalidator -> cache.pantheon". in Drupal\Component\DependencyInjection\Container->get() (line 149 of /code/web/core/lib/Drupal/Component/DependencyInjection/Container.php).

Here is the entire stack trace:

Backtrace	
#0 /code/web/core/lib/Drupal.php(567): Drupal\Component\DependencyInjection\Container->get('token')
#1 /code/web/modules/contrib/file_entity/file_entity.module(396): Drupal::token()
#2 /code/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(867): file_entity_entity_storage_load(Array, 'user')
#3 /code/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(396): Drupal\Core\Entity\ContentEntityStorageBase->Drupal\Core\Entity\{closure}(Object(Closure), 'file_entity')
#4 /code/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(868): Drupal\Core\Extension\ModuleHandler->invokeAllWith('entity_storage_...', Object(Closure))
#5 /code/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(395): Drupal\Core\Entity\ContentEntityStorageBase->invokeStorageLoadHook(Array)
#6 /code/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(312): Drupal\Core\Entity\Sql\SqlContentEntityStorage->doLoadMultiple(Array)
#7 /code/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(262): Drupal\Core\Entity\EntityStorageBase->loadMultiple(Array)
#8 /code/web/core/lib/Drupal/Core/Session/AccountProxy.php(218): Drupal\Core\Entity\EntityStorageBase->load('1')
#9 /code/web/core/lib/Drupal/Core/Session/AccountProxy.php(77): Drupal\Core\Session\AccountProxy->loadUserEntity('1')
#10 /code/web/core/lib/Drupal/Core/Session/AccountProxy.php(121): Drupal\Core\Session\AccountProxy->getAccount()
#11 /code/web/modules/contrib/devel/devel.module(200): Drupal\Core\Session\AccountProxy->hasPermission('access devel in...')
#12 [internal function]: backtrace_error_handler(16384, 'Calling Drupal\\...', '/code/web/core/...', 38)
#13 /code/web/core/lib/Drupal/Core/Cache/MemoryBackend.php(38): trigger_error('Calling Drupal\\...', 16384)
#14 /code/web/core/lib/Drupal/Component/DependencyInjection/Container.php(261): Drupal\Core\Cache\MemoryBackend->__construct()
#15 /code/web/core/lib/Drupal/Component/DependencyInjection/Container.php(179): Drupal\Component\DependencyInjection\Container->createService(Array, 'cache.pantheon')
#16 /code/web/core/lib/Drupal/Component/DependencyInjection/Container.php(438): Drupal\Component\DependencyInjection\Container->get('cache.pantheon', 1)
#17 /code/web/core/lib/Drupal/Component/DependencyInjection/Container.php(275): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array)
#18 /code/web/core/lib/Drupal/Component/DependencyInjection/Container.php(179): Drupal\Component\DependencyInjection\Container->createService(Array, 'cache_tags.inva...')
#19 /code/web/core/lib/Drupal/Component/DependencyInjection/Container.php(438): Drupal\Component\DependencyInjection\Container->get('cache_tags.inva...', 1)
#20 /code/web/core/lib/Drupal/Component/DependencyInjection/Container.php(239): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array)
#21 /code/web/core/lib/Drupal/Component/DependencyInjection/Container.php(179): Drupal\Component\DependencyInjection\Container->createService(Array, 'token')
#22 /code/web/core/lib/Drupal/Component/DependencyInjection/Container.php(438): Drupal\Component\DependencyInjection\Container->get('token', 1)
#23 /code/web/core/lib/Drupal/Component/DependencyInjection/Container.php(239): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array)
#24 /code/web/core/lib/Drupal/Component/DependencyInjection/Container.php(179): Drupal\Component\DependencyInjection\Container->createService(Array, 'logger.filelog')
#25 /code/web/core/lib/Drupal/Component/DependencyInjection/Container.php(438): Drupal\Component\DependencyInjection\Container->get('logger.filelog', 1)
#26 /code/web/core/lib/Drupal/Component/DependencyInjection/Container.php(275): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array)
#27 /code/web/core/lib/Drupal/Component/DependencyInjection/Container.php(179): Drupal\Component\DependencyInjection\Container->createService(Array, 'logger.factory')
#28 /code/web/core/lib/Drupal/Component/DependencyInjection/Container.php(438): Drupal\Component\DependencyInjection\Container->get('logger.factory', 1)
#29 /code/web/core/lib/Drupal/Component/DependencyInjection/Container.php(239): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array)
#30 /code/web/core/lib/Drupal/Component/DependencyInjection/Container.php(179): Drupal\Component\DependencyInjection\Container->createService(Array, 'plugin.manager....')
#31 /code/web/core/lib/Drupal/Component/DependencyInjection/Container.php(438): Drupal\Component\DependencyInjection\Container->get('plugin.manager....', 1)
#32 /code/web/core/lib/Drupal/Component/DependencyInjection/Container.php(239): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array)
#33 /code/web/core/lib/Drupal/Component/DependencyInjection/Container.php(179): Drupal\Component\DependencyInjection\Container->createService(Array, 'webform.email_p...')
#34 /code/web/core/lib/Drupal.php(197): Drupal\Component\DependencyInjection\Container->get('webform.email_p...')
#35 /code/web/modules/contrib/webform/webform.module(210): Drupal::service('webform.email_p...')
#36 [internal function]: webform_rebuild()
#37 /code/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(417): call_user_func_array(Object(Closure), Array)
#38 /code/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(396): Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object(Closure), 'webform')
#39 /code/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(424): Drupal\Core\Extension\ModuleHandler->invokeAllWith('rebuild', Object(Closure))
#40 /code/web/core/includes/common.inc(477): Drupal\Core\Extension\ModuleHandler->invokeAll('rebuild')
#41 /code/web/modules/contrib/admin_toolbar/admin_toolbar_tools/src/Controller/ToolbarController.php(205): drupal_flush_all_caches()
#42 [internal function]: Drupal\admin_toolbar_tools\Controller\ToolbarController->flushAll()
#43 /code/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#44 /code/web/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#45 /code/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#46 /code/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#47 /code/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#48 /code/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#49 /code/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#50 /code/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#51 /code/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#52 /code/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#53 /code/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#54 /code/web/modules/contrib/services/src/StackMiddleware/FormatSetter.php(45): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#55 /code/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\services\StackMiddleware\FormatSetter->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#56 /code/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#57 /code/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#58 /code/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#59 /code/web/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#60 /code/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#61 {main}

Steps to reproduce

  1. Have both File Log and Token modules installed
  2. In the admin toolbar, go to [Drupal logo] > Flush all caches
πŸ› Bug report
Status

Active

Version

2.1

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States joakland

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

Comments & Activities

  • Issue created by @joakland
  • Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException: Circular reference detected for service "plugin.manager.block", path: "plugin.cache_clearer -> plugin.manager.block -> logger.channel.default -> Drupal\Core\Logger\LoggerChannelFactoryInterface -> logger.filelog -> token -> cache_tags.invalidator". in Drupal\Component\DependencyInjection\Container->get() (line 149 of /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php).

    I was encountering a similar issue, and I found that the solution was to disable the Filelog module.

  • https://www.drupal.org/project/filelog/issues/3416342 πŸ› Circular reference detected for service Fixed I was able to activate the plugin and get rid of the error with the patch I found here. I'm using @gaele's patch.

  • πŸ‡¬πŸ‡§United Kingdom joachim

    Since upgrading to 10.3 I get this when doing 'drush cr':

    > Circular reference detected for service "logger.channel.default", path: "asset.js.collection_optimizer -> asset.js.optimizer -> logger.channel.default -> logger.factory -> logger.filelog -> token -> cache_tags.invalidator -> plugin.manager.block".

Production build 0.71.5 2024