After Drupal 8.8.4 upgrade, when I try to clear my caches I get the following error:

Circular reference detected for service "theme_handler", path: "twig -> twig.loader.filesystem -> theme_handler -> config.factory -> high_contrast.overrider -> theme.manager
-> theme.negotiator -> access_check.theme".

Uninstalling high_contrast fixes it.

This was on a vagrant dev box.

CommentFileSizeAuthor
#7 image.png27.11 KBchrbak

Comments

gobnat created an issue. See original summary.

neograph734’s picture

Status: Active » Fixed

Yes, I discovered that issue one or two weeks ago. It has already been resolved in the development version. I'll have a look at #3122685: Drupal 9 compatibility this weekend and attempt to push a new release.

Thanks for reporting though :)

chrbak’s picture

Hello,

I have Drupal 8.8.5 version installed and when i am trying to update the module from 8.x-1.0-beta2 to 8.x-1.0-beta4 it gives me the same error.

hkirsman’s picture

Hi!
Does the update process fail or beta4 doesn't work?

chrbak’s picture

Hello, and thank you for your response.

When i press the update button, right after, it throws the aforementioned exception.

neograph734’s picture

Could you post the contents of high_contrast.services.yml in the high contrast module folder (after downloading the update)? The config overrider no longer receives the theme_manager as a parameter and services should have been changed accordingly.

Alternatively could you try to change high contrast settings to use the default logo before attempting the update?
If you use the default logo it should not attempt to load the theme manger:

UPDATE: you should NOT use the default logo... but a temporary other file.

  private function getHighContrastLogo() {
    $logo = NULL;

    $config = $this->configFactory->get('high_contrast.settings');

    if ($config->get('default_logo')) {
      // If the default logo is desired, scan the theme dir for a logo-hg file.
      // Not using dependency injection to prevent circular references.
      $theme = \Drupal::theme()->getActiveTheme()->getName();
      $theme_path = drupal_get_path('theme', $theme);

      ... 
chrbak’s picture

StatusFileSize
new27.11 KB

The contents from the high_contrast.services.yml (from the default/temp/update-extraction-fcabdb3f forder) are:

services:
  cache_context.high_contrast:
    class: Drupal\high_contrast\Cache\Context\HighContrastCacheContext
    arguments: ['@request_stack']
    tags:
      - { name: cache.context }

  high_contrast.overrider:
    class: \Drupal\high_contrast\HighContrastConfigOverride
    arguments: ['@config.factory', '@file_system']
    tags:
      - { name: config.factory.override }

  high_contrast.event_susbscriber:
    class: \Drupal\high_contrast\EventSubscriber\ConfigEventSubscriber
    arguments: ['@file_system', '@config.factory']
    tags:
      - { name: 'event_subscriber' }

I used the default logo and as you recommended i changed it to another temporary file (screenshot) but the problem still occurs. The exact exception is :

Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException: Circular reference detected for service "theme.manager", path: "theme.manager -> theme.negotiator -> access_check.theme -> theme_handler -> config.factory -> high_contrast.overrider". in Drupal\Component\DependencyInjection\Container->get() (line 143 of /.../core/lib/Drupal/Component/DependencyInjection/Container.php)

This is has to do with the latest version of Drupal (8.8.5)? Because i have the exact same problem with latest version of Webform (Mail system, Simple XML sitemap, ...) but in another Drupal installation with 8.7.8 the Webform module finishes the update with no problem..

neograph734’s picture

Status: Fixed » Active

It appears that the issue is not with beta3, but has already been introduced in beta2 (Release notes) and only shows itself on a cache rebuild. (Any other module you install or update also causes the cache to be rebuilt and then high contrast breaks the site...)

I've just tried to update the module using composer (beta2 > beta4), then rebuilding the cache with drush drush cr, and then run the update script.
Are you in the possibility to try that?

If you are unfamiliar with drush you could also try to empty all cache_* tables from your database. Should have the same effect.

Setting this issue to active again so it remains visible.

chrbak’s picture

I have no access to command prompt (share server) so i did manually, i truncate all the cache tables and uploaded the latest beta4 version (replacing by hand the beta2 files). Finally i run the update.php script and it all works fine.

I can now update and the other modules that needs to be updated.

Thank you for your help.

neograph734’s picture

Status: Active » Fixed

Thank you for testing and confirming this helped solve the issue.
I have updated the module front page with a link to this issue to help others.

hkirsman’s picture

Couldn't we add cache clearing to high_contrast_update_8003()? Or does it break before update hooks are being run?

neograph734’s picture

Not sure... I've tried reading into the update script, but I got nowhere. You could try by installing beta2 and attempt an update.

Status: Fixed » Closed (fixed)

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

xaa’s picture

hi, I try to install beta4 on a fresh install D8.9.6 but I have the same issue. Any suggestion, please ?

neograph734’s picture

Hi xaa. May I recommend you not to reply to closed issues. Your question is almost invisible to maintainers, and you might never get a reply. Better to create a new issue and refer this one.

Anyway, I just tried installing Drupal 8.6.9 and high contrast beta4 as additional project on simplest.me and I had no issues.

orizonmedia’s picture

For those who get this drush CR error. I found a solution. You can simply get into the high contrast module config page, uncheck «use default logo setting». save config and re-check and save. This will solve the issue.
thanks for previous answer.