Use lightweight module handler implementation for plugin manager

Created on 11 February 2024, 4 months ago
Updated 17 April 2024, 2 months ago

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

📌 Task
Status

Fixed

Version

4.0

Component

Code

Created by

🇮🇩Indonesia el7cosmos 🇮🇩 GMT+7

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

Merge Requests

Comments & Activities

  • Issue created by @el7cosmos
  • Merge request !126Resolve #3420686 "Use lightweight module" → (Merged) created by el7cosmos
  • Pipeline finished with Skipped
    4 months ago
    #107630
  • Status changed to Fixed 4 months ago
  • 🇮🇩Indonesia el7cosmos 🇮🇩 GMT+7
  • 🇮🇳India sapna_123 Hyderabad

    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

  • 🇮🇳India gaurav_manerkar Vasco Da Gama, Goa

    @sapna_123 can you share steps to reproduce?

  • 🇺🇸United States cruno NJ

    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}
    
  • Assigned to gaurav_manerkar
  • Status changed to Needs work 3 months ago
  • 🇮🇳India gaurav_manerkar Vasco Da Gama, Goa

    Need to fix the error.

  • 🇮🇳India gaurav_manerkar Vasco Da Gama, Goa

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

  • Status changed to Needs review 3 months ago
  • 🇮🇳India gaurav_manerkar Vasco Da Gama, Goa
  • Status changed to Needs work 3 months ago
  • 🇮🇳India gaurav_manerkar Vasco Da Gama, Goa

    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

  • Status changed to Fixed 3 months ago
  • 🇮🇳India gaurav_manerkar Vasco Da Gama, Goa

    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 🐛 Changes to service definitions can cause fatal errors until services cache is cleared Active
    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

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

Production build 0.69.0 2024