Circular reference on multi-language sites

Created on 23 April 2023, over 1 year ago
Updated 12 July 2023, over 1 year ago

Problem/Motivation

I tried updating from 1.2.1 to the latest dev version (568495c194161b43a0a6941b7e1e5f31e6605ded). However, I'm getting the following error when I run drush cr:

Circular reference detected for service "entity_type.manager", path: "asset.css.collection_optimizer -> asset.css.
dumper -> file_system -> entity_type.manager -> string_translation -> string_translator.locale.lookup -> config.fa
ctory -> plugin.manager.email_builder".

If I revert to 1.2.1, I can clear the cache normally.

I have a multilingual site with two languages installed; I'm only using core i18n modules for translation. I can provide more detailed config if needed.

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇯🇵Japan ptmkenny

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

Comments & Activities

  • Issue created by @ptmkenny
  • 🇬🇧United Kingdom adamps

    Thanks for the report. I was getting a lot of similar errors and I believe I fixed them with this commit. Please can you check if you still see the error with the latest dev version?

  • Status changed to Closed: outdated over 1 year ago
  • 🇬🇧United Kingdom adamps

    Should be fixed as described in #2. Please re-open if you still hit the bug with the latest release

  • 🇯🇵Japan ptmkenny

    Thanks, I can confirm this is fixed in the current dev version!

  • 🇨🇭Switzerland megadesk3000

    Don't know exactly if this is the same issue, but when i am trying to enable the symfony_mailer module in its 1.x-dev version i get the following error:

    www-data@9da9a3bd1635:/app$ drush en symfony_mailer
    
    In Container.php line 147:
    
      Circular reference detected for service "language_manager", path: "language_request_subscriber -> language_manager -> config.factory -> plugin.manager.email_builder -> entity_type.manager -> string_translation -> strin
      g_translator.locale.lookup".
    
    
    PHP Fatal error:  Uncaught Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException: Circular reference detected for service "entity_type.manager", path: "user_last_access_subscriber -> entity_type.manager -> string_translation -> string_translator.locale.lookup -> config.factory -> plugin.manager.email_builder". in /app/web/core/lib/Drupal/Component/DependencyInjection/Container.php:147
  • Status changed to Needs work over 1 year ago
  • Status changed to Active over 1 year ago
  • 🇨🇭Switzerland titouille

    same problem as megadesk3000 on #5. After upgrading to 1.3.0-beta1, I can't add new modules if symfony_mailer is enabled, it cause a Circular reference detected error :

    PHP Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException: Circular reference detected for service "entity_type.manager", path: "user_last_access_subscriber -> entity_type.manager -> string_translation -> string_translator.locale.lookup -> config.factory -> plugin.manager.email_builder".

    downgrading to 1.2.1 resolve the problem.

  • 🇬🇧United Kingdom adamps

    Thanks for the reports. It's not exactly the same issue, because it's no longer related to drush. The cause seems to be multi-language sites - which my test sites are not, so I don't hit it. Strange how each error message is slightly different from the others.

  • 🇬🇧United Kingdom adamps

    This was caused by Allow full management of override plugins Fixed .

    Probably the fix is something like this, partly undoing some changes in the above issue:

    1. Create class MailerConfigOverride with tag config.factory.override, and remove that tag from EmailBuilderManager. Although this class uses EmailBuilderManager, it should not have it injected as that causes the loop.
    2. MailerConfigOverride::loadOverrides() has a hard-coded test to ignore certain entries that are used during initialisation and would cause a loop, probably "core.extension", "symfony_mailer.settings" (see earlier patch that was later revised to the current code). Then it calls \Drupal::service('plugin.manager.email_builder')->loadOverrides().
  • Status changed to Needs review over 1 year ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update over 1 year ago
    5 pass
  • 🇬🇧United Kingdom adamps

    Please can everyone seeing this bug please test this patch?

  • 🇭🇰Hong Kong hswong3i

    @AdamPS confirm #11 working for my DruStack, see https://github.com/drustack/composer-project-website-skeleton/commit/6dd...

    Once patch applied and `drush -y cr`, site up and running once again, able to enable other else modules with no issue.

    Thank you very much ;-)

  • Status changed to RTBC over 1 year ago
    • AdamPS committed 3fc41789 on 1.x
      Issue #3355846 by AdamPS, hswong3i: Circular reference on multi-language...
  • Status changed to Fixed over 1 year ago
  • 🇬🇧United Kingdom adamps

    Great thanks

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

  • Status changed to Fixed over 1 year ago
  • 🇮🇹Italy trickfun

    I get same error but I can't apply the patch with dev and 1.3.0-rc1 version.
    thank you

  • 🇸🇰Slovakia kaszarobert

    I met the same problem by installing 1.3.0-rc1 and running drush commands later.

  • 🇩🇪Germany kreatIL

    Same or similar issue here after upgrading to 1.3.0-rc1 on Drupal 9.5.10 and PHP 8.1.16

    Circular reference detected for service "entity_type.manager", path: "scheduler.manager -> date.formatter -> entity_type.manager -> string_translat  
      ion -> string_translator.locale.lookup -> config.factory -> symfony_mailer.config_override -> plugin.manager.email_builder".  
Production build 0.71.5 2024