Problem/Motivation
#2786355: Convert multiple provider plugin work from migrate into plugin dependencies in core made plugin discovery more rigorous wrt trait and interface dependencies.
As a result, plugins using a trait from a non-enabled module are considered non-existing.
This breaks ModuleInstaller's logic for EntityType installation (it should not live there, but that's another issue), which assumes that EntityTypes become available at the exact moment that their provider module is enabled, which is not true anymore. (Which means that the entity type is not installed at all, even when all its deps are there.)
This leads to situations where sites that worked before have hard to debug regressions on install, where the installation of a field breaks due to non-existing entity type (see original bug report and exception).
De-escalating to major as the MR makes the install great again for me.
Proposed resolution
- Update ModuleInstaller's EntityType creation logic to account for the new circumstances (see MR).
- Decoupling ModuleInstaller and Entity system is NOT in scope, there's an issue for that.
Remaining tasks
Review, consider tests, commit, profit.
Original report
After update to 11.3 i get the exception below in the config-install step.
A git bisect shows that the first breaking commit is the one from #2786355: Convert multiple provider plugin work from migrate into plugin dependencies in core.
Debugging shows that
- a field storage config is imported,
- then on creation of that field storage, in SqlContentEntityStorageSchema::getDedicatedTableSchema, the ID field of that entity is looked up (string|int) via $id_definition = $this->fieldStorageDefinitions[$entity_type->getKey('id')];, but that id definition is NOT in fieldStorageDefinitions.
I can imagine that there is something going on w/ the field, its entity type regarding dependencies, but i can not see what may be missing here.
Setting critical as install-blocking regression w/ no workaround.
Additional info
Backtrace>
[Symfony\Component\Process\Exception\ProcessFailedException]
The command "ddev exec drush si --existing-config -y" failed.
Exit Code: 1(General error)
Working directory: /home/merlin/Code/geeks4change/sites/site-cp-digital
Output:
================
You are about to:
* DROP all tables in your 'db' database.
// Do you want to continue?: yes.
Error: Call to a member function getType() on null in Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema->getDedicatedTableSchema() (line
2255 of /var/www/html/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php).
Error Output:
================
[notice] Starting Drupal installation. This takes a while.
[notice] Performed install task: install_select_language
[notice] Performed install task: install_select_profile
[notice] Performed install task: install_load_profile
[notice] Performed install task: install_verify_requirements
[notice] Performed install task: install_verify_database_ready
[notice] Performed install task: install_base_system
[notice] Performed install task: install_bootstrap_full
[warning] Undefined array key "id" SqlContentEntityStorageSchema.php:2254
[error] Error: Call to a member function getType() on null in Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema->getDedicatedTableSchem
a() (line 2255 of /var/www/html/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php) #0 /var/www/html/web/core/lib/Drupal/
Core/Entity/Sql/SqlContentEntityStorageSchema.php(1558): Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema->getDedicatedTableSchema()
#1 /var/www/html/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php(1539): Drupal\Core\Entity\Sql\SqlContentEntityStorage
Schema->createDedicatedTableSchema()
#2 /var/www/html/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php(696): Drupal\Core\Entity\Sql\SqlContentEntityStorageS
chema->performFieldSchemaOperation()
#3 /var/www/html/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(1531): Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema
->onFieldStorageDefinitionCreate()
#4 /var/www/html/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(1587): Drupal\Core\Entity\Sql\SqlContentEntityStorage->Drup
al\Core\Entity\Sql\{closure}()
#5 /var/www/html/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(1530): Drupal\Core\Entity\Sql\SqlContentEntityStorage->wrap
SchemaException()
#6 /var/www/html/web/core/lib/Drupal/Core/Field/FieldStorageDefinitionListener.php(85): Drupal\Core\Entity\Sql\SqlContentEntityStorage->onFi
eldStorageDefinitionCreate()
#7 /var/www/html/web/core/modules/field/src/Entity/FieldStorageConfig.php(370): Drupal\Core\Field\FieldStorageDefinitionListener->onFieldSto
rageDefinitionCreate()
#8 /var/www/html/web/core/modules/field/src/Entity/FieldStorageConfig.php(332): Drupal\field\Entity\FieldStorageConfig->preSaveNew()
#9 /var/www/html/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(562): Drupal\field\Entity\FieldStorageConfig->preSave()
#10 /var/www/html/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(517): Drupal\Core\Entity\EntityStorageBase->doPreSave()
#11 /var/www/html/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(239): Drupal\Core\Entity\EntityStorageBase->save()
#12 /var/www/html/web/core/lib/Drupal/Core/Entity/EntityBase.php(370): Drupal\Core\Config\Entity\ConfigEntityStorage->save()
#13 /var/www/html/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php(618): Drupal\Core\Entity\EntityBase->save()
#14 /var/www/html/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(351): Drupal\Core\Config\Entity\ConfigEntityBase->save()
#15 /var/www/html/web/core/lib/Drupal/Core/Config/ConfigImporter.php(1096): Drupal\Core\Config\Entity\ConfigEntityStorage->importCreate()
#16 /var/www/html/web/core/lib/Drupal/Core/Config/ConfigImporter.php(875): Drupal\Core\Config\ConfigImporter->importInvokeOwner()
#17 /var/www/html/web/core/lib/Drupal/Core/Config/ConfigImporter.php(675): Drupal\Core\Config\ConfigImporter->processConfiguration()
#18 /var/www/html/web/core/lib/Drupal/Core/Config/ConfigImporter.php(569): Drupal\Core\Config\ConfigImporter->processConfigurations()
#19 /var/www/html/web/core/lib/Drupal/Core/Config/Importer/ConfigImporterBatch.php(31): Drupal\Core\Config\ConfigImporter->doSyncStep()
#20 /var/www/html/web/core/includes/batch.inc(297): Drupal\Core\Config\Importer\ConfigImporterBatch::process()
#21 /var/www/html/web/core/includes/form.inc(831): _batch_process()
#22 /var/www/html/web/core/includes/install.core.inc(646): batch_process()
#23 /var/www/html/web/core/includes/install.core.inc(564): install_run_task()
#24 /var/www/html/web/core/includes/install.core.inc(122): install_run_tasks()
#25 /var/www/html/vendor/drush/drush/includes/drush.inc(69): install_drupal()
#26 /var/www/html/vendor/drush/drush/includes/drush.inc(53): drush_call_user_func_array()
#27 /var/www/html/vendor/drush/drush/src/Commands/core/SiteInstallCommands.php(174): drush_op()
#28 [internal function]: Drush\Commands\core\SiteInstallCommands->install()
#29 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array()
#30 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->run
CommandCallback()
#31 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(175): Consolidation\AnnotatedCommand\CommandProcessor->val
idateRunAndAlter()
#32 /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(389): Consolidation\AnnotatedCommand\CommandProcessor->pro
cess()
#33 /var/www/html/vendor/symfony/console/Command/Command.php(341): Consolidation\AnnotatedCommand\AnnotatedCommand->execute()
#34 /var/www/html/vendor/symfony/console/Application.php(1102): Symfony\Component\Console\Command\Command->run()
#35 /var/www/html/vendor/drush/drush/src/Application.php(201): Symfony\Component\Console\Application->doRunCommand()
#36 /var/www/html/vendor/symfony/console/Application.php(356): Drush\Application->doRunCommand()
#37 /var/www/html/vendor/symfony/console/Application.php(195): Symfony\Component\Console\Application->doRun()
#38 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(113): Symfony\Component\Console\Application->run()
#39 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun()
#40 /var/www/html/vendor/drush/drush/drush.php(140): Drush\Runtime\Runtime->run()
#41 /var/www/html/vendor/bin/drush.php(119): include('...')
#42 {main}.
Error: Call to a member function getType() on null in /var/www/html/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php on
line 2255 #0 /var/www/html/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php(1558): Drupal\Core\Entity\Sql\SqlContentEn
tityStorageSchema->getDedicatedTableSchema()
#1 /var/www/html/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php(1539): Drupal\Core\Entity\Sql\SqlContentEntityStorage
Schema->createDedicatedTableSchema()
#2 /var/www/html/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php(696): Drupal\Core\Entity\Sql\SqlContentEntityStorageS
chema->performFieldSchemaOperation()
#3 /var/www/html/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(1531): Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema
->onFieldStorageDefinitionCreate()
#4 /var/www/html/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(1587): Drupal\Core\Entity\Sql\SqlContentEntityStorage->Drup
al\Core\Entity\Sql\{closure}()
#5 /var/www/html/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(1530): Drupal\Core\Entity\Sql\SqlContentEntityStorage->wrap
SchemaException()
#6 /var/www/html/web/core/lib/Drupal/Core/Field/FieldStorageDefinitionListener.php(85): Drupal\Core\Entity\Sql\SqlContentEntityStorage->onFi
eldStorageDefinitionCreate()
#7 /var/www/html/web/core/modules/field/src/Entity/FieldStorageConfig.php(370): Drupal\Core\Field\FieldStorageDefinitionListener->onFieldSto
rageDefinitionCreate()
#8 /var/www/html/web/core/modules/field/src/Entity/FieldStorageConfig.php(332): Drupal\field\Entity\FieldStorageConfig->preSaveNew()
#9 /var/www/html/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(562): Drupal\field\Entity\FieldStorageConfig->preSave()
#10 /var/www/html/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(517): Drupal\Core\Entity\EntityStorageBase->doPreSave()
#11 /var/www/html/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(239): Drupal\Core\Entity\EntityStorageBase->save()
#12 /var/www/html/web/core/lib/Drupal/Core/Entity/EntityBase.php(370): Drupal\Core\Config\Entity\ConfigEntityStorage->save()
#13 /var/www/html/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php(618): Drupal\Core\Entity\EntityBase->save()
#14 /var/www/html/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(351): Drupal\Core\Config\Entity\ConfigEntityBase->save()
#15 /var/www/html/web/core/lib/Drupal/Core/Config/ConfigImporter.php(1096): Drupal\Core\Config\Entity\ConfigEntityStorage->importCreate()
#16 /var/www/html/web/core/lib/Drupal/Core/Config/ConfigImporter.php(875): Drupal\Core\Config\ConfigImporter->importInvokeOwner()
#17 /var/www/html/web/core/lib/Drupal/Core/Config/ConfigImporter.php(675): Drupal\Core\Config\ConfigImporter->processConfiguration()
#18 /var/www/html/web/core/lib/Drupal/Core/Config/ConfigImporter.php(569): Drupal\Core\Config\ConfigImporter->processConfigurations()
#19 /var/www/html/web/core/lib/Drupal/Core/Config/Importer/ConfigImporterBatch.php(31): Drupal\Core\Config\ConfigImporter->doSyncStep()
#20 /var/www/html/web/core/includes/batch.inc(297): Drupal\Core\Config\Importer\ConfigImporterBatch::process()
#21 /var/www/html/web/core/includes/form.inc(831): _batch_process()
#22 /var/www/html/web/core/includes/install.core.inc(646): batch_process()
#23 /var/www/html/web/core/includes/install.core.inc(564): install_run_task()
#24 /var/www/html/web/core/includes/install.core.inc(122): install_run_tasks()
#25 /var/www/html/vendor/drush/drush/includes/drush.inc(69): install_drupal()
#26 /var/www/html/vendor/drush/drush/includes/drush.inc(53): drush_call_user_func_array()
#27 /var/www/html/vendor/drush/drush/src/Commands/core/SiteInstallCommands.php(174): drush_op()
#28 [internal function]: Drush\Commands\core\SiteInstallCommands->install()
#29 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array()
#30 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->run
CommandCallback()
#31 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(175): Consolidation\AnnotatedCommand\CommandProcessor->val
idateRunAndAlter()
#32 /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(389): Consolidation\AnnotatedCommand\CommandProcessor->pro
cess()
#33 /var/www/html/vendor/symfony/console/Command/Command.php(341): Consolidation\AnnotatedCommand\AnnotatedCommand->execute()
#34 /var/www/html/vendor/symfony/console/Application.php(1102): Symfony\Component\Console\Command\Command->run()
#35 /var/www/html/vendor/drush/drush/src/Application.php(201): Symfony\Component\Console\Application->doRunCommand()
#36 /var/www/html/vendor/symfony/console/Application.php(356): Drush\Application->doRunCommand()
#37 /var/www/html/vendor/symfony/console/Application.php(195): Symfony\Component\Console\Application->doRun()
#38 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(113): Symfony\Component\Console\Application->run()
#39 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun()
#40 /var/www/html/vendor/drush/drush/drush.php(140): Drush\Runtime\Runtime->run()
#41 /var/www/html/vendor/bin/drush.php(119): include('...')
#42 {main}
[warning] Drush command terminated abnormally.
Failed to execute command `drush si --existing-config -y`: exit status 1
Issue fork drupal-3569676
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
Comment #2
geek-merlinComment #3
geek-merlinGot some insights. Working on it.
Comment #5
geek-merlinComment #6
geek-merlinOK, this breaks some tests.
Comment #7
geek-merlinIt's the menu entity type that coughs, seems like there is a definition for it even before the module defines it. Anyone knows what that's about? (EDIT: Facepalm, it's provided by core so needs no module installed.)
But no problem, we can fallback to the provider condition.
Comment #8
geek-merlinYup, now we're green.
Comment #9
geek-merlinSo...
Comment #10
nicxvan commentedI think this belongs in extension system since it's only touching the ModuleInstaller.
I think we'd need a test for this since it sounds like a painful bug to uncover.
Can we also update the title? I had to read it a few times to understand it.
I have a minor comment on the MR too.
Comment #11
geek-merlinI also thought "what a confuding title", just to realize that /me is guilty of it. Fixed. (Exception botfood is already in the IS.)
Comment #12
geek-merlinAlso NW for the test.