Problem/Motivation
Follow up from #3572171-16: Persist is_syncing across container rebuilds:
Looks the following code path might have an issue:
ModuleInstaller::install(),with the$module_listpassed to it having count > 1- This calls
ModuleInstaller::doInstall(), then if the$module_listpassed todoInstall()has count > 1, this callsModuleInstaller::updateKernel([])- Which calls
$this->kernel->resetContainer(), and resetContainer does not persist the config installer sync status
Implementations of hook_modules_installed are invoked after this, so the sync status is incorrectly FALSE.
Steps to reproduce
- Install a module that has a
hook_modules_installed()implementation, with some way to track the value of the $is_syncing boolean value passed in. - Export configuration (e.g. drush cex)
- Edit core.extension.yml in the config export and add multiple modules so that they will be installed on config import. For testing, it's easiest to find simple modules that don't install any configuration of their own, so that core.extension.yml is the only needed change.
- Example of change in core.extension.yml
module: // ... new_module_1: 0 new_module_2: 0 // .. - Import configuration (e.g. drush cim)
- Note that the is_syncing value in the hook_modules_installed() function is FALSE, when it should be TRUE
Also seen in #3584145: Call to member function removeComponent error after updating to 11.3.6.
Proposed resolution
in DrupalKernel::resetContainer(), save the config installer syncing value before the container is rebuilt, then set the saved value on the new container.
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
#3584812: ConfigInstaller isSyncing does not persist to hook_modules_installed() when multiple modules are installed fixes a critical regression in configuration import present in 11.3.6 and 11.3.7. If you've not imported configuration during this time there is nothing you need to do. If you have, after updating it is recommended to follow your site's usual method of deploying configuration change, for example, by running drush deploy.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | 3584812-7.diff | 8.65 KB | herved |
Issue fork drupal-3584812
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:
- 3584812-configinstaller-issyncing-does
changes, plain diff MR !15456
Comments
Comment #3
godotislateMR 15456 ready for review.
Test only failure: https://git.drupalcode.org/project/drupal/-/jobs/9366252
Comment #4
herved commentedThank you for looking into this @godotislate !
I've closed #3584145: Call to member function removeComponent error after updating to 11.3.6 which was reported in the paragraphs module as duplicate. The patch here works for me and the reporter.
I don't think I'm the best person to review this, but +1 LGTM
Comment #5
smustgrave commentedLeft 1 comment on the MR, rest looks good
Comment #6
smustgrave commentedFair enough, no other objections to the code.
FYI I found this from view filtering for Needs Review Queue Initiative so glad to see others tag it!
Comment #7
herved commentedStatic MR diff for composer
Comment #8
alexpottThis is a critical bug - this might have broken recipes too as they use this functionality to override config during module install.
Comment #9
apso commentedAfter upgrading from 11.3.5 to 11.3.7 due to the new security update, local installation failed.
Field {field} is unknown.
The patched fixed the issue +1 RTBC.
Comment #10
catchCommitted/pushed to main, 11.x and 11.3.x, thanks!
Comment #13
xjmCan we get a release note snippet for this?
Comment #14
xjmSpecifically, is there anything sites who ran into this on 11.3.6 or 11.3.7 need to do?
Comment #15
alexpottI think the answer is to re-import configuration. But to be honest hopefully they didn't do a deploy because this could very easily end up deleting data on your site - for example if a field was removed. It's really hard to predict all the possibilities here because it will depend on site configuration.
I've had a go at writing a release note.
Comment #16
xjmAlright, moved stuff around a little and this is what I have in the 11.3.8 draft now:
Comment #17
quietone commentedComment #18
xjmNote: This issue was committed with the wrong commit message, but is present in all three branches, per @catch.
Comment #19
catchCommit hashes: