Dear Community!
We have successfully upgraded our Acquia Lightning Project from 3.1.5 (Drupal 8.5.7) to the current newest version 3.200 (Drupal 8.6.1)
With that, we had to upgrade the Domain Site Settings Module to 1.3 with the patch from this issue
https://www.drupal.org/project/domain_site_settings/issues/2930391
Patch: https://www.drupal.org/files/issues/2018-08-16/2930391-16.patch
If we try to "drush cr" after this update we get the following error:
In Container.php line 141:
Circular reference detected for service "router.route_provider", path: "twig -> twig.extension -> url_generator -> router.route_provider -> path_processor_manager -> domain_source.path_processor -> domain.negotiator -> router -> router.no_access_checks".
But clearing cache in the backend fia the module "admin-toolbar" works fine though.
Versions:
Drush: 9.4
Domain: 1.0.0-alpha13
Domain Site Settings: 1.3
This functionality worked before the update.
Comments
Comment #2
giorgoskGet the same (no lightning distribution)
Drush 8.1.16 or Drupal Console 1.8.0 report same error when running Cache rebuild
everything else seems to be working fine
Comment #3
kevin.pfeifer commentedHave done following updates but this problem still persists for me:
Drupal => 8.6.2 (through Lightning 8.x-3.2)
Drush => 9.5.2
Comment #4
kevin.pfeifer commentedWe tried disabling one module after another and found out, that the issue is not the "domain_site_settings" module. The problem still persisted.
Instead the error was "fixed" when we disabled "Domain Source" which is a submodule of the "Domain Access" module.
With that i have changed the Project from this issue to "Domain Access".
We already updated the following packages:
Domain: 1.0.0-alpha14
Domain-Site-Settings: 1.3
Comment #5
agentrickard@kevin.pfeifer Thanks for validating that.
This isn't an error we run into in our automated testing, or that I can easily reproduce.
Granted, I'm using drush 8.1.12...
So do we think this is an issue that on ly occurs when using drush 9?
Comment #6
agentrickardTested with drush 9.5.2 and no error.
Looking for reliable steps to reproduce this issue.
Comment #7
criscomHi Ken,
thanks a lot for verifying this issue. We will try to give you reliable steps to reproduce this issue as soon as we can. The problem occurred after updating to Drupal 8.6.1 but this was not the issue. We'll get back to you when we have more information. Thanks.
Best,
Chris
Comment #8
kevin.pfeifer commentedWe created a separat host with the same composer.json, theme files and custom modules but without the current present config.
On this new host, we are able to perform a drush cr successfully.
Therefore, as far is I can tell, it has to be a problem with the config/DB.
I currently try to step through the drush cr command to find out where this "Circular reference" starts to appear.
But i have noticed a rather "strange" behaviour.
In my opinion, the "drush cr" command should do the same as if i would write "drush cache:clear" and then all the available cache options.
When clearing each cache option individually, this "Circular reference" does not appear.
The options available are:
Comment #9
kevin.pfeifer commentedI have added a debug output to the docroot/core/lib/Drupal/Component/DependencyInjection/Container.php file in the get function to output the current $id before it throws the ServiceCircularReferenceException.
See here: https://screenshot.sunlime.at/1193159ac5bd9036a4c60fda71776c74
I did this on both my local machine (where the drush cr doesn't work) and the remote machine (where the drush cr works)
On the left side is the remote machine and on the right the local
https://screenshot.sunlime.at/a53e14edfcbbaf193cbce62c37950470
https://screenshot.sunlime.at/744835838c37da1dd2117ebb1ee875b2
As you can see, the "language_manager" is loaded earlier on the remote then on the local.
I guess in there the $this->loading array (which tells the Dependency Injection which other Modules/Classes to load in the Drupal\Component\DependencyInjection\Container Class) will be cleaned up.
But i have no idea where or how the language_manager is loaded in there.
I guess it has something to do with the DB/Config but i don't know where to start.
Comment #10
idebr commentedClosed #3011661: Circular reference detected for service as a duplicate issue.
Comment #11
kevin.pfeifer commentedWe have found a solution to our problem!
First of all we created a patch to change all the "domain.negotiator" implementations from the "default" Dependency Injection way to this notation:
\Drupal::service('domain.negotiator')Patch is included down below (3005048-Domain_Source-circular_reference_for_router.route_provider.patch)
Now the error message has changed from
to
You see that the domain.negotiator is not present in the path anymore.
Now there is still the "strange" dependency from domain_source.path_processor -> router.
Through XDebug we found out, that domain_source.path_processor requires the LanguageNegotiationUserAdmin which therefore needs the router.
In the LanguageNegotiationUserAdmin Interface we configured, that we are detecting the interface language through the "Account administrator pages".
https://screenshot.sunlime.at/13dd8221074c7f08c691cd69fbb6a5e3
After applying the patch mentioned above and disabling this detection method the drush cr command worked again.
Special thanks to @drunken-monkey, who helped us debugging this problem and provided us this solution!
Comment #12
drunken monkeyI don’t think the patch in #11 should actually be needed once you disable the “Account administrator pages” language negotiation?
Anyways, to maybe provide a bit more information: The attached patch might be a “fix” that could actually be committed to this module. The current code is of course not actually a bug per se, but as we see, under some conditions (in addition to the “Account administrator pages” language negotiation, the key was also having a module with a
hook_entity_type_alter()implementation that requires\Drupal::config()– the Contact module (in Core) in this case) it can lead to a very-hard-to-debug problem that kills the whole site. So, adding this patch to the module should probably be considered – the code gets just a tiny bit “uglier”, perhaps, but functionality will be completely unchanged in normal cases, and it helps prevent this strange problem.Comment #13
kevin.pfeifer commented@drunken-monkey:
Indeed this patch with the mentioned deactivation of "Account administrator pages" in /admin/config/regional/language/detection solved this Circular reference problem for us.
Thank you!
Comment #14
criscomThanks drunken monkey. Great fix, very much appreciated!
Comment #15
agentrickardYeah, this is one of those bad edge cases where not using Dependency Injection might be proper. It will at least save us from having to hunt down hard to replicate bugs. We had to use the same approach in DomainConfigOverrider.
I'm just back from vacation. I'll try to spin up a test branch for this by end of week.
Comment #16
agentrickardRegenerated patch after #2976907: [Domain] Follow Drupal coding standards landed.
Tests at https://github.com/agentrickard/domain/pull/461
Comment #17
bijumon.ta commented@agentrickard
I have this issue
Uncaught PHP Exception Symfony\\Component\\DependencyInjection\\Exception\\ServiceCircularReferenceException: "Circular reference detected for service "domain.negotiator", path: "options_request_listener -> router.route_provider -> path_processor_manager -> domain_source.path_processor -> domain.negotiator"." at /var/www/htdocs/xxxxx/core/lib/Drupal/Component/DependencyInjection/Container.php line 141,
Let me know whether this patch fix this issue
Comment #18
Neodork commented#12 works for me, possibly also #16 but #16 does not apply to 1.0.0-alpha14, because the Drupal code style additions have not had a release yet.
Drush Version: 8.1.10
Drupal Core Version: 8.6.2
Domain Access version: 1.0.0-alpha14
Also when I revert drupal/core back to 8.5.6 there seems to be no exception thrown.
Comment #19
bijumon.ta commented@drunken monkey/ @agentrickard
I am getting this error regularly
Uncaught PHP Exception Symfony\\Compone
nt\\DependencyInjection\\Exception\\ServiceCircularReferenceException: "Circular reference detected for service "domain.negotiator", path: "options_request_listener -> router.route_provider -> path_processor_manager -> domain_source.path_processor -> domain.negotiator"." at /var/www/html/xxx/core/lib/Drupal/Component/DependencyInjection/Container.php line 141
Please let me know #12 or #16 will fix this error. Its very urgent.
Comment #20
agentrickardThe patch in #16 should work fine.
Comment #22
agentrickardCommitted.
https://github.com/agentrickard/domain/pull/461
Comment #23
agentrickardComment #25
mykola dolynskyiif comment 2 below then no error