ServiceCircularReferenceException in context of logging between s3fsfileservice and logger.raven

Created on 26 June 2024, 12 months ago

Problem/Motivation

We are looking to use both raven β†’ and S3 File System β†’ .

When we enable both modules, there seems to be a conflict between the two:

2024-04-02T11:30:17.921703541Z In Container.php line 147:
2024-04-02T11:30:17.921713569Z                                                                                        
2024-04-02T11:30:17.921716545Z   [Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException]  
  Circular reference detected for service "s3fsfileservice", path: "asset.css          
  .collection_optimizer -> s3fsfileservice -> logger.channel.file -> logger.f          
2024-04-02T11:30:17.921724740Z   actory -> logger.raven".                                                             
2024-04-02T11:30:17.921727135Z      

How would one resolve such issue?

More logging:

$ ddev drush cr -vvv > log
 [preflight] Config paths: /var/www/html/vendor/drush/drush/drush.yml,/var/www/html/drush/drush.yml
 [preflight] Alias paths: /var/www/html/web/drush/sites,/var/www/html/drush/sites
 [preflight] Commandfile search paths: /var/www/html/vendor/drush/drush/src,/var/www/html/drush
 [info] Starting bootstrap to site [0.26 sec, 3.1 MB]
 [info] Drush bootstrap phase 2 [0.26 sec, 3.1 MB]
 [info] Try to validate bootstrap phase 2 [0.26 sec, 3.1 MB]
 [info] Try to validate bootstrap phase 2 [0.26 sec, 3.11 MB]
 [info] Try to bootstrap at phase 2 [0.26 sec, 3.11 MB]
 [info] Drush bootstrap phase: bootstrapDrupalRoot() [0.26 sec, 3.11 MB]
 [info] Change working directory to /var/www/html/web [0.26 sec, 3.11 MB]
 [info] Initialized Drupal 10.2.6 root directory at /var/www/html/web [0.26 sec, 3.11 MB]
 [info] Try to validate bootstrap phase 2 [0.26 sec, 3.11 MB]
 [info] Try to bootstrap at phase 2 [0.26 sec, 3.25 MB]
 [info] Drush bootstrap phase: bootstrapDrupalSite() [0.26 sec, 3.25 MB]
 [debug] Could not find a Drush config file at sites/default/drush.yml. [0.26 sec, 3.25 MB]
 [info] Initialized Drupal site publicatietool.ddev.site at sites/default [0.27 sec, 3.25 MB]

In Container.php line 147:
                                                                                                                                                                                  
  [Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException]                                                                                             
  Circular reference detected for service "s3fsfileservice", path: "asset.css.collection_optimizer -> s3fsfileservice -> logger.channel.file -> logger.factory -> logger.raven".  
                                                                                                                                                                                  

Exception trace:
  at /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php:147
 Drupal\Component\DependencyInjection\Container->get() at /var/www/html/web/modules/custom/pt_common/src/TranslationInfo.php:51
 Drupal\pt_common\TranslationInfo::create() at /var/www/html/web/core/lib/Drupal/Core/DependencyInjection/ClassResolver.php:28
 Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition() at /var/www/html/web/modules/custom/pt_common/pt_common.module:73
 pt_common_system_info_alter() at /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php:545
 Drupal\Core\Extension\ModuleHandler->alter() at /var/www/html/web/core/lib/Drupal/Core/Extension/ExtensionList.php:322
 Drupal\Core\Extension\ExtensionList->doList() at /var/www/html/web/core/lib/Drupal/Core/Extension/ExtensionList.php:284
 Drupal\Core\Extension\ExtensionList->getList() at /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleExtensionList.php:126
 Drupal\Core\Extension\ModuleExtensionList->getActiveProfile() at /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleExtensionList.php:91
 Drupal\Core\Extension\ModuleExtensionList->getExtensionDiscovery() at /var/www/html/web/core/lib/Drupal/Core/Extension/ExtensionList.php:300
 Drupal\Core\Extension\ExtensionList->doScanExtensions() at /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleExtensionList.php:138
 Drupal\Core\Extension\ModuleExtensionList->doScanExtensions() at /var/www/html/web/core/lib/Drupal/Core/Extension/ExtensionList.php:314
 Drupal\Core\Extension\ExtensionList->doList() at /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleExtensionList.php:155
 Drupal\Core\Extension\ModuleExtensionList->doList() at /var/www/html/web/core/lib/Drupal/Core/Extension/ExtensionList.php:284
 Drupal\Core\Extension\ExtensionList->getList() at /var/www/html/web/core/lib/Drupal/Core/Extension/ExtensionList.php:262
 Drupal\Core\Extension\ExtensionList->get() at /var/www/html/web/core/lib/Drupal/Core/Extension/ExtensionList.php:245
 Drupal\Core\Extension\ExtensionList->getName() at /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php:720
 Drupal\Core\Extension\ModuleHandler->getName() at /var/www/html/web/modules/contrib/symfony_mailer/src/Processor/EmailBuilderManager.php:93
 Drupal\symfony_mailer\Processor\EmailBuilderManager->processDefinition() at /var/www/html/web/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php:325
 Drupal\Core\Plugin\DefaultPluginManager->findDefinitions() at /var/www/html/web/modules/contrib/symfony_mailer/src/Processor/EmailBuilderManager.php:204
 Drupal\symfony_mailer\Processor\EmailBuilderManager->findDefinitions() at /var/www/html/web/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php:205
 Drupal\Core\Plugin\DefaultPluginManager->getDefinitions() at /var/www/html/web/modules/contrib/symfony_mailer/src/Processor/MailerConfigOverride.php:92
 Drupal\symfony_mailer\Processor\MailerConfigOverride->buildCache() at /var/www/html/web/modules/contrib/symfony_mailer/src/Processor/MailerConfigOverride.php:52
 Drupal\symfony_mailer\Processor\MailerConfigOverride->loadOverrides() at /var/www/html/web/core/lib/Drupal/Core/Config/ConfigFactory.php:209
 Drupal\Core\Config\ConfigFactory->loadOverrides() at /var/www/html/web/core/lib/Drupal/Core/Config/ConfigFactory.php:169
 Drupal\Core\Config\ConfigFactory->doLoadMultiple() at /var/www/html/web/core/lib/Drupal/Core/Config/ConfigFactory.php:104
 Drupal\Core\Config\ConfigFactory->doGet() at /var/www/html/web/core/lib/Drupal/Core/Config/ConfigFactory.php:89
 Drupal\Core\Config\ConfigFactory->get() at /var/www/html/web/modules/contrib/raven/src/Logger/Raven.php:64
 Drupal\raven\Logger\Raven->__construct() at /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php:259
 Drupal\Component\DependencyInjection\Container->createService() at /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php:177
 Drupal\Component\DependencyInjection\Container->get() at /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php:440
 Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters() at /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php:273
 Drupal\Component\DependencyInjection\Container->createService() at /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php:177
 Drupal\Component\DependencyInjection\Container->get() at /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php:440
 Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters() at /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php:249
 Drupal\Component\DependencyInjection\Container->createService() at /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php:177
 Drupal\Component\DependencyInjection\Container->get() at /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php:440
 Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters() at /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php:237
 Drupal\Component\DependencyInjection\Container->createService() at /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php:455
 Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters() at /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php:237
 Drupal\Component\DependencyInjection\Container->createService() at /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php:177
 Drupal\Component\DependencyInjection\Container->get() at /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php:440
 Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters() at /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php:237
 Drupal\Component\DependencyInjection\Container->createService() at /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php:177
 Drupal\Component\DependencyInjection\Container->get() at /var/www/html/web/core/lib/Drupal.php:197
 Drupal::service() at /var/www/html/web/core/includes/common.inc:449
 drupal_flush_all_caches() at /var/www/html/web/core/includes/utility.inc:41
 drupal_rebuild() at /var/www/html/vendor/drush/drush/src/Commands/core/CacheRebuildCommands.php:70
 Drush\Commands\core\CacheRebuildCommands->rebuild() at n/a:n/a
 call_user_func_array() at /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php:276
 Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback() at /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php:212
 Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter() at /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php:175
 Consolidation\AnnotatedCommand\CommandProcessor->process() at /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php:387
 Consolidation\AnnotatedCommand\AnnotatedCommand->execute() at /var/www/html/vendor/symfony/console/Command/Command.php:326
 Symfony\Component\Console\Command\Command->run() at /var/www/html/vendor/symfony/console/Application.php:1096
 Symfony\Component\Console\Application->doRunCommand() at /var/www/html/vendor/symfony/console/Application.php:324
 Symfony\Component\Console\Application->doRun() at /var/www/html/vendor/symfony/console/Application.php:175
 Symfony\Component\Console\Application->run() at /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php:110
 Drush\Runtime\Runtime->doRun() at /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php:40
 Drush\Runtime\Runtime->run() at /var/www/html/vendor/drush/drush/drush.php:139
 require() at /var/www/html/vendor/drush/drush/drush:4
 include() at /var/www/html/vendor/bin/drush:119

Failed to run drush cr -vvv: exit status 1

Steps to reproduce

Install and enable both modules.

Proposed resolution

Fix Dependency Injection in a way that they can both be used by users.

User interface changes

N/A.

API changes

N/A.

Data model changes

N/A.

πŸ› Bug report
Status

Active

Version

6.0

Component

Code

Created by

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

Comments & Activities

  • Issue created by @StephanMeijer
  • Status changed to Postponed: needs info 12 months ago
  • πŸ‡ΊπŸ‡ΈUnited States mfb San Francisco

    Your steps to reproduce say "Install and enable both modules" so I tried enabling the s3fs modules, but I didn't see any isssues. Maybe configuring and doing something with them is also required?

    Could you provide a complete list of steps to reproduce from a clean install of Drupal?

  • Status changed to Closed: cannot reproduce 10 months ago
  • πŸ‡ΊπŸ‡ΈUnited States mfb San Francisco

    I couldn't yet reproduce this, but feel free to re-open if you can provide more info

  • πŸ‡«πŸ‡·France Kgaut

    Hi,
    I'm facing this issue right now, disabling raven solved it, but it's not a solution :D

    When running drush cim :

    Circular reference detected for service "Drupal\Core\Logger\LoggerChannelFactoryInterface", path: "config_split.cli -> config_split.status_override -> cache_tags.invalidator -> plugin.manager.block -> logger.channel.default -> Drupal\Core\Logger\LoggerChannelFactoryInterface -> logger.raven -> Drupal\  
      anct\Hook\EntityTypeHooks -> s3fsfileservice -> logger.channel.file".
    

    I'll investigate on this during the following days

    Drupal version : 11.1.7
    PHP version : 8.3.15
    drupal/raven: 6.0.15
    drupal/s3fs: 3.7.0

  • πŸ‡«πŸ‡·France Kgaut
  • πŸ‡ΊπŸ‡ΈUnited States mfb San Francisco

    Please provide steps to reproduce from a clean install of Drupal so we can look into this. For example, install module X, enable Y on the settings page, add Z to the settings.php file, etc.

  • πŸ‡«πŸ‡·France Kgaut

    very strange """solution""", but maybe it will help someone.

    In my modules I had tow implementation for hook entity_type_build, merged in one fixed it... very odd...

  • πŸ‡ΊπŸ‡ΈUnited States mfb San Francisco

    I can't tell from your description exactly what happened. Maybe there was an error that lead to circular reference, and once you fixed it the circular reference disappeared? But it sounds like maybe there was no actual error, you were trying to do something totally valid which lead to the circular reference?

    Either situation is not good...

    Because of how the raven logger (unfortunately) has service dependencies, it's difficult to completely avoid the potential for circular references. But when they are found we do try to find a way to eliminate them.

Production build 0.71.5 2024