Problem/Motivation

The plugin.manager.hook_event is dependent on module_handler service, which is already decorated by our own implementation. This imposes two problems, the first is circular dependencies as our module handler is dependent on plugin.manager.hook_event, and the second is the plugin manager does not really require the module handler to work.

Steps to reproduce

Proposed resolution

There are two options:

  • Not extend default_plugin_manager so it does not depend on the module handler, but needs to duplicate a bunch of methods from the default plugin manager.
  • Implement lightweight module handler and pass it to the default_plugin_manager constructor.

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

el7cosmos created an issue. See original summary.

  • el7cosmos committed c2c26c28 on 4.x
    Issue #3420686 by el7cosmos: Use lightweight module handler...
el7cosmos’s picture

Status: Active » Fixed
sapna_123’s picture

After this fix, getting this error
Uncaught PHP Exception TypeError: "Drupal\\hook_event_dispatcher\\HookEventPluginManager::__construct(): Argument #3 ($moduleList) must be of type array, Drupal\\hook_event_dispatcher\\HookEventDispatcherModuleHandler given.
Please check

gaurav_manerkar’s picture

@sapna_123 can you share steps to reproduce?

cruno’s picture

We're getting the same issue as #5 when running drush config:import in image builds.

TypeError: Drupal\hook_event_dispatcher\HookEventPluginManager::__construct(): Argument #3 ($moduleList) must be of type array, Drupal\hook_event_dispatcher\HookEventDispatcherModuleHandler given, called in /app/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 in /app/web/modules/contrib/hook_event_dispatcher/src/HookEventPluginManager.php on line 35 #0 /app/web/core/lib/Drupal/Component/DependencyInjection/Container.php(259): Drupal\hook_event_dispatcher\HookEventPluginManager->__construct()
#1 /app/web/core/lib/Drupal/Component/DependencyInjection/Container.php(177): Drupal\Component\DependencyInjection\Container->createService()
#2 /app/web/modules/contrib/hook_event_dispatcher/src/ProxyClass/HookEventPluginManager.php(64): Drupal\Component\DependencyInjection\Container->get()
#3 /app/web/modules/contrib/hook_event_dispatcher/src/ProxyClass/HookEventPluginManager.php(83): Drupal\hook_event_dispatcher\ProxyClass\HookEventPluginManager->lazyLoadItself()
#4 /app/web/modules/contrib/hook_event_dispatcher/src/HookEventDispatcherModuleHandler.php(93): Drupal\hook_event_dispatcher\ProxyClass\HookEventPluginManager->getAlterEventFactories()
#5 /app/web/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php(340): Drupal\hook_event_dispatcher\HookEventDispatcherModuleHandler->alter()
#6 /app/web/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php(295): Drupal\Core\Plugin\DefaultPluginManager->alterDefinitions()
#7 /app/web/modules/contrib/config_filter/src/Plugin/ConfigFilterPluginManager.php(70): Drupal\Core\Plugin\DefaultPluginManager->findDefinitions()
#8 /app/web/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php(181): Drupal\config_filter\Plugin\ConfigFilterPluginManager->findDefinitions()
#9 /app/web/modules/contrib/config_filter/src/Plugin/ConfigFilterPluginManager.php(37): Drupal\Core\Plugin\DefaultPluginManager->getDefinitions()
#10 /app/web/modules/contrib/config_filter/src/ConfigFilterStorageFactory.php(88): Drupal\config_filter\Plugin\ConfigFilterPluginManager->getFiltersForStorages()
#11 /app/web/modules/contrib/config_filter/src/ConfigFilterEventSubscriber.php(56): Drupal\config_filter\ConfigFilterStorageFactory->getFilteredStorage()
#12 [internal function]: Drupal\config_filter\ConfigFilterEventSubscriber->onImportTransform()
#13 /app/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func()
#14 /app/web/core/lib/Drupal/Core/Config/ImportStorageTransformer.php(120): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
#15 /app/vendor/drush/drush/src/Drupal/Commands/config/ConfigImportCommands.php(243): Drupal\Core\Config\ImportStorageTransformer->transform()
#16 [internal function]: Drush\Drupal\Commands\config\ConfigImportCommands->import()
#17 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array()
#18 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback()
#19 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter()
#20 /app/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(391): Consolidation\AnnotatedCommand\CommandProcessor->process()
#21 /app/vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute()
#22 /app/vendor/symfony/console/Application.php(1081): Symfony\Component\Console\Command\Command->run()
#23 /app/vendor/symfony/console/Application.php(320): Symfony\Component\Console\Application->doRunCommand()
#24 /app/vendor/symfony/console/Application.php(174): Symfony\Component\Console\Application->doRun()
#25 /app/vendor/drush/drush/src/Runtime/Runtime.php(124): Symfony\Component\Console\Application->run()
#26 /app/vendor/drush/drush/src/Runtime/Runtime.php(51): Drush\Runtime\Runtime->doRun()
#27 /app/vendor/drush/drush/drush.php(79): Drush\Runtime\Runtime->run()
#28 /app/vendor/drush/drush/includes/preflight.inc(18): require('...')
#29 phar:///usr/local/bin/drush/bin/drush.php(143): drush_main()
#30 /usr/local/bin/drush(14): require('...')
#31 {main}
gaurav_manerkar’s picture

Assigned: Unassigned » gaurav_manerkar
Status: Fixed » Needs work

Need to fix the error.

gaurav_manerkar’s picture

For me after running drush cr the error goes away.
@sapna_123 @cruno can you try flushing cache?

gaurav_manerkar’s picture

Status: Needs work » Needs review
gaurav_manerkar’s picture

Status: Needs review » Needs work

I am facing the error after upgrading module from 4.0.0-rc1 to 4.0.1 in CD pipeline.
Looks like service cache related

gaurav_manerkar’s picture

Status: Needs work » Fixed

After investigation, i found that this error is related to container cache and not related to this module.

For pipelines:
https://www.drupal.org/project/drupal/issues/2918906
https://www.drupal.org/project/drupal/issues/3153335
$settings['deployment_identifier'] = 'something different'; - it should mark container cache as invalid.

On local setup, run drush cr first to rebuild caches. That should solve the problem

Status: Fixed » Closed (fixed)

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