Problem/Motivation
There's an infinite loop if wse_config gets enabled on a site that already has the pathauto and/or media modules enabled. Here a backtrace of the loop:
WseConfigCachedStorage.php:49, Drupal\wse_config\WseConfigCachedStorage->readMultiple()
ConfigFactory.php:165, Drupal\Core\Config\ConfigFactory->doLoadMultiple()
ConfigFactory.php:104, Drupal\Core\Config\ConfigFactory->doGet()
ConfigFactory.php:89, Drupal\Core\Config\ConfigFactory->get()
Drupal.php:412, Drupal::config()
media.module:365, media_entity_type_alter()
ModuleHandler.php:539, Drupal\Core\Extension\ModuleHandler->alter()
DefaultPluginManager.php:333, Drupal\Core\Plugin\DefaultPluginManager->alterDefinitions()
EntityTypeManager.php:127, Drupal\Core\Entity\EntityTypeManager->findDefinitions()
DefaultPluginManager.php:175, Drupal\Core\Plugin\DefaultPluginManager->getDefinitions()
DiscoveryCachedTrait.php:22, Drupal\Core\Plugin\DefaultPluginManager->getDefinition()
EntityTypeManager.php:136, Drupal\Core\Entity\EntityTypeManager->getDefinition()
WseConfigDatabaseStorage.php:426, Drupal\wse_config\WseConfigDatabaseStorage->wseConfigStorageIsActive()
WseConfigDatabaseStorage.php:142, Drupal\wse_config\WseConfigDatabaseStorage->readMultiple()
WseConfigCachedStorage.php:49, Drupal\wse_config\WseConfigCachedStorage->readMultiple()
ConfigFactory.php:165, Drupal\Core\Config\ConfigFactory->doLoadMultiple()
ConfigFactory.php:104, Drupal\Core\Config\ConfigFactory->doGet()
ConfigFactory.php:89, Drupal\Core\Config\ConfigFactory->get()
Drupal.php:412, Drupal::config()
media.module:365, media_entity_type_alter()
ModuleHandler.php:539, Drupal\Core\Extension\ModuleHandler->alter()
DefaultPluginManager.php:333, Drupal\Core\Plugin\DefaultPluginManager->alterDefinitions()
EntityTypeManager.php:127, Drupal\Core\Entity\EntityTypeManager->findDefinitions()
DefaultPluginManager.php:175, Drupal\Core\Plugin\DefaultPluginManager->getDefinitions()
DiscoveryCachedTrait.php:22, Drupal\Core\Plugin\DefaultPluginManager->getDefinition()
EntityTypeManager.php:136, Drupal\Core\Entity\EntityTypeManager->getDefinition()
WseConfigDatabaseStorage.php:426, Drupal\wse_config\WseConfigDatabaseStorage->wseConfigStorageIsActive()
WseConfigDatabaseStorage.php:142, Drupal\wse_config\WseConfigDatabaseStorage->readMultiple()
WseConfigCachedStorage.php:49, Drupal\wse_config\WseConfigCachedStorage->readMultiple()
ConfigFactory.php:165, Drupal\Core\Config\ConfigFactory->doLoadMultiple()
ConfigFactory.php:104, Drupal\Core\Config\ConfigFactory->doGet()
ConfigFactory.php:89, Drupal\Core\Config\ConfigFactory->get()
Drupal.php:412, Drupal::config()
media.module:365, media_entity_type_alter()
ModuleHandler.php:539, Drupal\Core\Extension\ModuleHandler->alter()
DefaultPluginManager.php:333, Drupal\Core\Plugin\DefaultPluginManager->alterDefinitions()
EntityTypeManager.php:127, Drupal\Core\Entity\EntityTypeManager->findDefinitions()
DefaultPluginManager.php:175, Drupal\Core\Plugin\DefaultPluginManager->getDefinitions()
DiscoveryCachedTrait.php:22, Drupal\Core\Plugin\DefaultPluginManager->getDefinition()
EntityTypeManager.php:136, Drupal\Core\Entity\EntityTypeManager->getDefinition()
WseConfigDatabaseStorage.php:426, Drupal\wse_config\WseConfigDatabaseStorage->wseConfigStorageIsActive()
WseConfigDatabaseStorage.php:142, Drupal\wse_config\WseConfigDatabaseStorage->readMultiple()
WseConfigCachedStorage.php:49, Drupal\wse_config\WseConfigCachedStorage->readMultiple()
ConfigFactory.php:165, Drupal\Core\Config\ConfigFactory->doLoadMultiple()
ConfigFactory.php:104, Drupal\Core\Config\ConfigFactory->doGet()
ConfigFactory.php:89, Drupal\Core\Config\ConfigFactory->get()
Drupal.php:412, Drupal::config()
media.module:365, media_entity_type_alter()
ModuleHandler.php:539, Drupal\Core\Extension\ModuleHandler->alter()
DefaultPluginManager.php:333, Drupal\Core\Plugin\DefaultPluginManager->alterDefinitions()
EntityTypeManager.php:127, Drupal\Core\Entity\EntityTypeManager->findDefinitions()
DefaultPluginManager.php:175, Drupal\Core\Plugin\DefaultPluginManager->getDefinitions()
ModuleInstaller.php:267, Drupal\Core\Extension\ModuleInstaller->install()
ModuleInstaller.php:83, Drupal\Core\ProxyClass\Extension\ModuleInstaller->install()
ModulesListForm.php:473, Drupal\system\Form\ModulesListForm->submitForm()
FormSubmitter.php:113, call_user_func_array:{/var/www/html/web/core/lib/Drupal/Core/Form/FormSubmitter.php:113}()
FormSubmitter.php:113, Drupal\Core\Form\FormSubmitter->executeSubmitHandlers()
FormSubmitter.php:51, Drupal\Core\Form\FormSubmitter->doSubmitForm()
FormBuilder.php:593, Drupal\Core\Form\FormBuilder->processForm()
AutosaveFormBuilder.php:144, Drupal\autosave_form\Form\AutosaveFormBuilder->processForm()
FormBuilder.php:321, Drupal\Core\Form\FormBuilder->buildForm()
AutosaveFormBuilder.php:97, Drupal\autosave_form\Form\AutosaveFormBuilder->buildForm()
FormController.php:73, Drupal\Core\Controller\FormController->getContentResult()
EarlyRenderingControllerWrapperSubscriber.php:123, call_user_func_array:{/var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php:123}()
EarlyRenderingControllerWrapperSubscriber.php:123, Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure:/var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php:121-124}()
Renderer.php:578, Drupal\Core\Render\Renderer->executeInRenderContext()
EarlyRenderingControllerWrapperSubscriber.php:124, Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
EarlyRenderingControllerWrapperSubscriber.php:97, Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure:/var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php:96-98}()
HttpKernel.php:158, Symfony\Component\HttpKernel\HttpKernel->handleRaw()
HttpKernel.php:80, Symfony\Component\HttpKernel\HttpKernel->handle()
Session.php:57, Drupal\Core\StackMiddleware\Session->handle()
KernelPreHandle.php:47, Drupal\Core\StackMiddleware\KernelPreHandle->handle()
PageCache.php:106, Drupal\page_cache\StackMiddleware\PageCache->pass()
PageCache.php:85, Drupal\page_cache\StackMiddleware\PageCache->handle()
ReverseProxyMiddleware.php:47, Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
NegotiationMiddleware.php:52, Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
StackedHttpKernel.php:23, Stack\StackedHttpKernel->handle()
DrupalKernel.php:717, Drupal\Core\DrupalKernel->handle()
index.php:19, {main}()
Steps to reproduce
On a vanilla Drupal (tested on 9.4.x)
- Enable the following modules: media, pathauto, wse
- Then enable wse_config via drush or ui
- Observe the infinite loop
Proposed resolution
- Drop the check for the entity definition in
WseConfigDatabaseStorage::wseConfigStorageIsActive() as this will lead to an infinite loop if a module implements hook_entity_type_alter() and reads config within that hook
- Ignore pathauto and media related configs in wse_config
Comments
Comment #3
s_leu commentedComment #4
s_leu commentedComment #6
amateescu commentedMerged into 1.0.x, thanks!