Circular reference detected for service "logger.factory"

Created on 30 January 2023, almost 2 years ago
Updated 1 December 2023, about 1 year ago

After updating to 2.0.6, I got this error when running drush commands:

Circular reference detected for service "logger.factory", path: "asset.css.collection_optimizer -> asset.css.dumper -> file_system ->
  logger.channel.file -> logger.factory -> logger.watchdog_mailer -> plugin.manager.mail".

Reverting to 2.0.3 resolved the error.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇺🇸United States cameron prince

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

Merge Requests

Comments & Activities

  • Issue created by @cameron prince
  • 🇮🇳India sarguna raj M

    I too encountered a website down issue when clearing the cache on the website. After updating to 2.0.6

    Error Log:
    Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException: Circular reference detected for service "plugin.manager.mail", path: "webform.email_provider -> plugin.manager.mail -> logger.factory -> logger.watchdog_mailer". in Drupal\Component\DependencyInjection\Container->get() (line 147 of /code/web/core/lib/Drupal/Component/DependencyInjection/Container.php).

    Reverting to 2.0.3 resolved the error.

  • 🇭🇺Hungary nevergone Nyíregyháza, Hungary, Europe

    @sarguna-raj-m: Why Drupal core version?

  • Status changed to Postponed: needs info over 1 year ago
  • 🇭🇺Hungary nevergone Nyíregyháza, Hungary, Europe

    Please describe your website environment and configuration. I tested, but cannot reproduce (Drupal core 9.5.9 and Drush 11.5.1)

  • 🇺🇸United States smillerLA

    @nevergone I'm getting the same error as sarguna when clearing cache on Drupal 10.0.9.

  • Status changed to Active over 1 year ago
  • 🇭🇺Hungary nevergone Nyíregyháza, Hungary, Europe

    @smillerLA

    Ok, please describe step-by-step reproducing. Thanks.

  • 🇺🇸United States kirksolar

    @nevergone I'm getting the same error as the others in this thread. I believe it has something to do with the Webform module being enabled along with the Watchdog Mailer. I guess the repro steps would simply be to enable Webform and Watchdog Mailer and clear cache.

    PHP: 8.1.17
    Drupal: 10.0.9
    Watchdog Mailer: 2.0.6
    Webform: dev-6.2.x

  • 🇭🇺Hungary nevergone Nyíregyháza, Hungary, Europe

    @kirksolar
    Thanks, Which webform submodules are in use?

  • 🇺🇸United States cameron prince

    I'm seeing this too. Backing down to 2.0.5 resolves it.

    It looks like something to do with the injection of \Drupal\Core\Mail\MailManager.

  • 🇨🇴Colombia sebasgd

    I'm having the same issue in a website.

    Drupal 10.1.0
    Enabled modules: webform (6.2.0-beta6) and watchdog mailer (2.0.6). I have some webform submodules, but I also tried disabling all the others and keeping only webform and the issue was still happening.

    The steps to recreate this is to install both modules and then try to clear cache.

  • 🇩🇪Germany Anybody Porta Westfalica

    @LRWebks could you please install watchdog mailer and webform and test if this can be reproduced? See the comments above to track this down then.

  • 🇺🇦Ukraine i-trokhanenko Lutsk 🇺🇦

    I'm getting the same error.
    Drupal core - 10.1.6
    Webform - 6.2.0
    Watchdog Mailer - 2.0.6

    Circular reference detected for service "Drupal\Core\Logger\LoggerChannelFa  
      ctoryInterface", path: "asset.css.collection_optimizer -> file_system -> lo  
      gger.channel.file -> Drupal\Core\Logger\LoggerChannelFactoryInterface -> lo  
      gger.watchdog_mailer -> plugin.manager.mail". 
    
  • Assigned to lrwebks
  • 🇩🇪Germany lrwebks Porta Westfalica
  • Issue was unassigned.
  • 🇩🇪Germany lrwebks Porta Westfalica

    I can confirm the steps to reproduce from #12

    Simply installing this module with Webform produces the error.
    @Anybody will take a look soon.

  • Assigned to Anybody
  • 🇩🇪Germany Anybody Porta Westfalica

    Thx! I'll have a look!

  • Assigned to nevergone
  • 🇩🇪Germany Anybody Porta Westfalica

    As of

    Backing down to 2.0.5 resolves it.

    there are the changes that potentially caused this:
    https://git.drupalcode.org/project/watchdog_mailer/-/compare/2.0.5...2.0...

    So I'm quite sure $mailManager DI causes this!

    As a quickfix we could revert this to \Drupal::service('plugin.manager.mail') and add comments for the reason. But indeed I'd like to understand if we really need to do that and why.

    Might also be a bug outside this module. Perhaps someone would like to prepare a quickfix for now, as described above?

    @nevergone any ideas?

  • Merge request !12Quickfix for Circular reference → (Merged) created by Anybody
  • Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 5.7
    last update about 1 year ago
    Waiting for branch to pass
  • Status changed to Needs review about 1 year ago
  • 🇩🇪Germany Anybody Porta Westfalica

    Please have a look and try the quickfix I created. If it solves the issue, we should perhaps merge it and create a follow-up to find the deeper reasons?

  • 🇭🇺Hungary nevergone Nyíregyháza, Hungary, Europe

    @LRWebks Please write step-by-step reproduce descriptions. I have some ideas.

  • 🇩🇪Germany Anybody Porta Westfalica

    @nevergone the steps are simple, as written above:

    1. Install watchdog_mailer (>= 2.0.6)
    2. Install webform (base module is enough)
    3. Clear the cache
    4. BOOM ;)

    <= 2.0.5 is fine (as written above, this DI was introduced in 2.0.6)

  • 🇭🇺Hungary nevergone Nyíregyháza, Hungary, Europe

    The thing is, I could never cause this error. I tried with several versions of Drupal, Webform and Watchdog mailer, but the error never occurred, even though I spent many hours dealing with it. I have some ideas to fix it correctly, but I think something else is triggering the error. That's why I need help to create it.

    Here is PHP 8.2.8, Drupal 10.1.6, Webform 6.2.0, Watchdog mailer 2.0.6
    I install it, turn on the modules, cache clear, the error does not appear, the page can be used. I will activate additional modules, the page can be used.
    See attached video: https://www.drupal.org/files/issues/2023-11-30/Peek%202023-11-30%2008-49...

  • 🇩🇪Germany Anybody Porta Westfalica

    @nevergone okay strange, thank you for the feedback, I didn't know that!

    I'll try some combinations at simplytest.me. Another idea might be, that this only happens when debug / developer tools are enabled. I remember a similar case from the past. @LRWebks and me use https://github.com/webksde/ddev-vscode-devcontainer-drupal-template to spin up our dev environments quickly with dev tools and settings enabled.

  • 🇩🇪Germany Anybody Porta Westfalica

    @nevergone: I was now able to reproduce the issue easily on simplytest.me!

    Just like described (watchdog_mailer 2.0.6 and webform)
    The important step was to clear caches, e.g. /admin/config/development/performance

  • 🇭🇺Hungary nevergone Nyíregyháza, Hungary, Europe

    @Anybody:
    In the video, I delete the cache several times using drush, but I also try it from the web interface.

  • Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 5.7
    last update about 1 year ago
    Waiting for branch to pass
  • 🇭🇺Hungary nevergone Nyíregyháza, Hungary, Europe

    Please test merge request.

  • Issue was unassigned.
  • 🇩🇪Germany Anybody Porta Westfalica

    Thanks @nevergone the lazy loading solution from the container looks good to me! I'll test and review it asap!
    What about the others here? Any feedback?

  • Status changed to RTBC about 1 year ago
  • 🇩🇪Germany lrwebks Porta Westfalica

    Just tested this with @Anybody! Works as expected, errors are still logged and the error is gone on cache clear.

    RTBC!

    • nevergone committed cfbaa8fd on 2.0.x
      Issue #3337719 by Anybody, nevergone, LRWebks: Circular reference...
  • Status changed to Fixed about 1 year ago
  • 🇭🇺Hungary nevergone Nyíregyháza, Hungary, Europe

    Thanks, coming soon 2.0.7 release! :)

  • 🇩🇪Germany Anybody Porta Westfalica

    Crazy. In my dev environment with stage_file_proxy module I now / still experience:

    Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException: Circular reference detected for service "stage_file_proxy.proxy_subscriber", path: "stage_file_proxy.proxy_subscriber -> stage_file_proxy.download_manager -> file_system -> logger.channel.file -> logger.factory -> logger.watchdog_mailer". in Drupal\Component\DependencyInjection\Container->get() (line 147 of core/lib/Drupal/Component/DependencyInjection/Container.php).

    Not sure if this is still something this module should fix and where it comes from... So just FYI for now.

  • 🇭🇺Hungary nevergone Nyíregyháza, Hungary, Europe

    @Anybody:
    Which watchdog_mailer version?

  • 🇩🇪Germany Anybody Porta Westfalica

    Latest 2.0.x-dev, but don't invest time yet, might be something different. At least only have a short try, if you want to check it. Issue might be on my side!

  • 🇩🇪Germany Anybody Porta Westfalica

    I guess there was something wrong on my side. Let's not invest more time here until someone else reports issues with version >= 2.0.7 or dev.

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

Production build 0.71.5 2024