Clear Config Filter plugin cache to update from 2.x to 3.x

Created on 3 August 2021, about 3 years ago
Updated 17 May 2024, 4 months ago

Problem/Motivation

Plugin (config_ignore) instance class "Drupal\config_ignore\Plugin\ConfigFilter\IgnoreFilter" does not exist.

When updating from Config ignore 2.x to 3.x the filter plugin disappears. If a hook_cache_flush implementation wrongfully loads a service which depends (indirectly) on the config filter plugin manager before the plugin cache is cleared an exception is thrown which prevents the cache from being cleared.

Steps to reproduce

Upgrade from 2.x to 3.x and have some cache flush hook load the config filter plugin manager.

Proposed resolution

Add a update hook which force-clears the config filter plugin cache.

Remaining tasks

User interface changes

none

API changes

none

Data model changes

none

πŸ“Œ Task
Status

Fixed

Version

3.0

Component

Code

Created by

πŸ‡¨πŸ‡­Switzerland bircher πŸ‡¨πŸ‡Ώ

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States jasonawant New Orleans, USA

    I've encountered this issue when updating from 2.x to 3.x and using `drush deploy` as part of the deployment process.

    docker@cli:/var/www/docroot$ drush deploy -v -y
     [info] Starting bootstrap to full
     [info] Drush bootstrap phase 5
     [info] Try to validate bootstrap phase 5
     [info] Try to validate bootstrap phase 5
     [info] Try to bootstrap at phase 5
     [info] Drush bootstrap phase: bootstrapDrupalRoot()
     [info] Change working directory to /var/www/docroot
     [info] Initialized Drupal 10.2.4 root directory at /var/www/docroot
     [info] Try to validate bootstrap phase 5
     [info] Try to bootstrap at phase 5
     [info] Drush bootstrap phase: bootstrapDrupalSite()
     [info] Initialized Drupal site dxp-content.docksal.site at sites/default
     [info] Try to validate bootstrap phase 5
     [info] Try to bootstrap at phase 5
     [info] Drush bootstrap phase: bootstrapDrupalConfiguration()
     [info] Try to validate bootstrap phase 5
     [info] Try to bootstrap at phase 5
     [info] Drush bootstrap phase: bootstrapDrupalDatabase()
     [info] Successfully connected to the Drupal database.
     [info] Try to validate bootstrap phase 5
     [info] Try to bootstrap at phase 5
     [info] Drush bootstrap phase: bootstrapDrupalFull()
    
    In DefaultFactory.php line 97:
                                                                                                                     
      [Drupal\Component\Plugin\Exception\PluginException]                                                            
      Plugin (config_ignore) instance class "Drupal\config_ignore\Plugin\ConfigFilter\IgnoreFilter" does not exist.  
                                                                                                                     
    
    Exception trace:
      at /var/www/docroot/core/lib/Drupal/Component/Plugin/Factory/DefaultFactory.php:97
     Drupal\Component\Plugin\Factory\DefaultFactory::getPluginClass() at /var/www/docroot/core/lib/Drupal/Core/Plugin/Factory/ContainerFactory.php:17
     Drupal\Core\Plugin\Factory\ContainerFactory->createInstance() at /var/www/docroot/core/lib/Drupal/Component/Plugin/PluginManagerBase.php:83
     Drupal\Component\Plugin\PluginManagerBase->createInstance() at /var/www/docroot/modules/contrib/config_filter/src/Plugin/ConfigFilterPluginManager.php:41
     Drupal\config_filter\Plugin\ConfigFilterPluginManager->getFiltersForStorages() at /var/www/docroot/modules/contrib/config_filter/src/ConfigFilterStorageFactory.php:88
     Drupal\config_filter\ConfigFilterStorageFactory->getFilteredStorage() at /var/www/docroot/modules/contrib/config_filter/src/ConfigFilterStorageFactory.php:54
     Drupal\config_filter\ConfigFilterStorageFactory->getSync() at n/a:n/a
     call_user_func_array() at /var/www/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php:255
     Drupal\Component\DependencyInjection\Container->createService() at /var/www/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php:177
     Drupal\Component\DependencyInjection\Container->get() at /var/www/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php:440
     Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters() at /var/www/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php:237
     Drupal\Component\DependencyInjection\Container->createService() at /var/www/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php:177
     Drupal\Component\DependencyInjection\Container->get() at /var/www/vendor/drush/drush/src/Runtime/LegacyServiceInstantiator.php:288
     Drush\Runtime\LegacyServiceInstantiator->resolveFromContainer() at /var/www/vendor/drush/drush/src/Runtime/LegacyServiceInstantiator.php:253
     Drush\Runtime\LegacyServiceInstantiator->resolveArgument() at n/a:n/a
     array_map() at /var/www/vendor/drush/drush/src/Runtime/LegacyServiceInstantiator.php:223
     Drush\Runtime\LegacyServiceInstantiator->resolveArguments() at /var/www/vendor/drush/drush/src/Runtime/LegacyServiceInstantiator.php:193
     Drush\Runtime\LegacyServiceInstantiator->instantiateObject() at /var/www/vendor/drush/drush/src/Runtime/LegacyServiceInstantiator.php:174
     Drush\Runtime\LegacyServiceInstantiator->create() at /var/www/vendor/drush/drush/src/Runtime/LegacyServiceInstantiator.php:131
     Drush\Runtime\LegacyServiceInstantiator->instantiateServices() at /var/www/vendor/drush/drush/src/Runtime/LegacyServiceInstantiator.php:60
     Drush\Runtime\LegacyServiceInstantiator->loadServiceFiles() at /var/www/vendor/drush/drush/src/Boot/DrupalBoot8.php:257
     Drush\Boot\DrupalBoot8->addDrupalModuleDrushCommands() at /var/www/vendor/drush/drush/src/Boot/DrupalBoot8.php:233
     Drush\Boot\DrupalBoot8->bootstrapDrupalFull() at /var/www/vendor/drush/drush/src/Boot/BootstrapManager.php:236
     Drush\Boot\BootstrapManager->doBootstrap() at /var/www/vendor/drush/drush/src/Boot/BootstrapManager.php:377
     Drush\Boot\BootstrapManager->bootstrapToPhaseIndex() at /var/www/vendor/drush/drush/src/Boot/BootstrapManager.php:329
     Drush\Boot\BootstrapManager->bootstrapToPhase() at /var/www/vendor/drush/drush/src/Boot/BootstrapHook.php:36
     Drush\Boot\BootstrapHook->initialize() at /var/www/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php:44
     Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->doInitializeHook() at /var/www/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php:36
     Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->callInitializeHook() at /var/www/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php:29
     Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->initialize() at /var/www/vendor/consolidation/annotated-command/src/CommandProcessor.php:145
     Consolidation\AnnotatedCommand\CommandProcessor->initializeHook() at /var/www/vendor/consolidation/annotated-command/src/AnnotatedCommand.php:376
     Consolidation\AnnotatedCommand\AnnotatedCommand->initialize() at /var/www/vendor/symfony/console/Command/Command.php:292
     Symfony\Component\Console\Command\Command->run() at /var/www/vendor/symfony/console/Application.php:1096
     Symfony\Component\Console\Application->doRunCommand() at /var/www/vendor/symfony/console/Application.php:324
     Symfony\Component\Console\Application->doRun() at /var/www/vendor/symfony/console/Application.php:175
     Symfony\Component\Console\Application->run() at /var/www/vendor/drush/drush/src/Runtime/Runtime.php:110
     Drush\Runtime\Runtime->doRun() at /var/www/vendor/drush/drush/src/Runtime/Runtime.php:40
     Drush\Runtime\Runtime->run() at /var/www/vendor/drush/drush/drush.php:139
     require() at /var/www/vendor/drush/drush/drush:4
     include() at /var/www/vendor/bin/drush:119
    
  • πŸ‡ΊπŸ‡ΈUnited States jasonawant New Orleans, USA

    FWIW - using all of the drush commands behind drush deploy works without issue. This is a work around for those using drush deploy

    From https://www.drush.org/12.x/deploycommand/

    drush updatedb --no-cache-clear -y
    drush cache:rebuild
    drush config:import -y
    drush cache:rebuild
    drush deploy:hook
  • πŸ‡ΊπŸ‡ΈUnited States jasonawant New Orleans, USA

    I think this may be related πŸ“Œ Create a way to declare a plugin as deprecated Needs work and its draft change record: https://www.drupal.org/node/3198662 β†’

  • It is not necessary to apply any patch, because if you update the database (drush updb) before exporting the configuration (drush cex) it already launches the necessary hooks to force-clear the config_filter plugin cache.

Production build 0.71.5 2024