Problem/Motivation

After upgrading from 2.0.0-beta2 to 2.0.0-beta5, I now receive the following error when I run `drush cr`:

Circular reference detected for service "logger.factory", path: "asset.css.collection_optimizer -> asset.css.dumper -> file_system -> logger.channel.file -> logger.factory -> config.factory -> config_split.status_override -> cache_tags.invalidator -> plugin.manager.block -> logger.channel.default".

Steps to reproduce

composer require 'drupal/config_split:^2.0@beta'
drush updb -y
drush cr

Comments

RichardDavies created an issue. See original summary.

bircher’s picture

Status: Active » Postponed (maintainer needs more info)

Hi
This seems like a strange bug. I can not reproduce it so more detailed steps are needed.

richarddavies’s picture

I maintain two Drupal sites and one of them has this issue after upgrading config split, whereas the other site did not, so this issue is somewhat dependent on other modules or site configuration. But it's not obvious to me how to identify exactly what the conflicting module or configuration is, but I've researched this error and found some similar bug reports with other modules:

https://www.drupal.org/project/domain/issues/3005048
https://www.drupal.org/project/s3fs/issues/3259065
https://www.drupal.org/project/drupal/issues/3155536

I don't claim to fully understand the problem here or how to fix it, but my understanding is that a circular reference can exist in the dependency injection system when multiple modules all have a dependency on the same service. The above issues provide more detailed information and some patches that apparently can be used to work around this issue.

FYI, I did experiment and on my broken site I was able to successfully run drush cr without the circular reference error by deleting the @cache_tags.invalidator argument from config_split.status_override in config_split.services.yml and deleting the $cacheInvalidator argument in the src/Config/StatusOverride.php constructor.

I hope perhaps reading through those issues above and looking at the patches might provide enough information to be able to implement a similar fix for this module. If you need me to do any specific troubleshooting or debug steps let me know and I can try and provide you with more information.

bircher’s picture

Thanks for the links and more details on this issue.

Could you debug how your cache_tags.invalidator service looks like? Or if you have any module that decorates it?

It looks very strange to me that the cache tags invalidator would depend on the block plugin manager...

richarddavies’s picture

I'm not exactly sure what you mean by debug how my service looks like. But I did search through the *.services.yml files in web/modules and none of them decorate the cache_tags.invalidator service.

While doing that, I noticed that we're using the redirect_404 module which does decorate the logger.factory service and uses the config.factory service. And I discovered that if I uninstall that redirect_404 module that the circular reference error with drush cr goes away, so that seems like an important clue to isolating the issue. If you install redirect_404 can you reproduce the error now? Hopefully that will allow you to further debug/troubleshoot the issue.

bircher’s picture

Hi, no, redirect_404 will alone will not trigger it...

Could you create a very basic site on github or something that recreates the problem?

I mean set up a new drupal site with composer, install the umami profile and all the contrib modules you need to trigger it. export the config. You can install all modules except for config split, so that when I clone the site and install config split I can reproduce the issue.

That would be a tremendous help.

I know we can use setter injection, but I am still a bit puzzled why the dependency I use is problematic.

richarddavies’s picture

I realized my earlier comment about using the redirect_404 module may have been confusing. To clarify, we are using https://www.drupal.org/project/issues/redirect which contains a submodule named redirect_404. (We are not using the D7 module https://www.drupal.org/project/redirect_404)

bircher’s picture

yes of course. I just composer required it and it took the correct module since the other one doesn't have any drupal 8 or 9 release.

I think it is more modules together. So please share your composer.json and the core.extensions.yml.
Or as I previously suggested: set up a new site with the umami profile and add all modules necessary to reproduce this issue.

jnicola’s picture

I'm now having a similar issue with:

Circular reference detected for service "color.theme_decorator", path: "color.theme_decorator -> config.factory -> config_split.status_override -> cache_tags.invalidator".

Removing all config split settings has no bearing on the issue persisting.

Yes, the color module is silly, but an install profile we're using requires it.

bircher’s picture

Thanks for another example. But unfortunately in order to debug this I still need what I described in #8

richarddavies’s picture

Sorry for the delay. Here is my composer.json and core.extensions.yml.

dimas11’s picture

  • bircher committed e75b495 on 2.0.x
    Issue #3263968 by bircher: separate state config override services to...
bircher’s picture

Status: Postponed (maintainer needs more info) » Fixed

I assume this is fixed by separating the services? if not please re-open the issue.

richarddavies’s picture

@bircher Can you please explain what exactly you mean by "separating the services"? An example of how to do that would be helpful too.

bircher’s picture

@RichardDavies This is what I mean by splitting the services: e75b495.
Just try the latest release and check if the problems persists. If it does you can re-open the issue and I will try to debug this some day...

Status: Fixed » Closed (fixed)

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