Problem/Motivation
- After an update things will have changed, new things will be added, and existing things will be removed in core and modules(when we support them)
Among those things are- global functions in .module files and .inc files
- routes
- any classes
- services definitions
- plugins
- etc
- Certain of those things, especially if they were loaded before the update occurred, will be cached in some way.
- Any code that has changed may be immediately accessed by subscribers of
PostApply, in later parts of the Drupal request, or in the next http request - if we don't clear or rebuild caches properly code that runs after the update may still be accessing the cached version of code from before the update
Proposed resolution
Solving all of this will likely take a few issues.
#3269097: Add test coverage to determine if global functions are reloaded when updates are applied starts with testing if global functions in .module files are reloaded(they are not). That also creates an Update Checker module that will check what has been reload.
After #3269097, is committed we will be able check if other things are reloaded by:
- Added a new thing item and/or change an existing item in
updated_module - Add the check in
update_checker(currently\Drupal\updater_checker\UpdateChecker::runChecks) - Added a new expected result in
<code>\Drupal\Tests\package_manager\Build\PackageUpdateTest::testPackageUpdate
Remaining tasks
Create individual issues for
- #3268363: Load new services after staged changes are applied
- #3269097: Add test coverage to determine if global functions are reloaded when updates are applied - Update checker module for other issue in this issue
- Plugins
- Routes
- .inc file loaded by \Drupal\Core\Extension\ModuleHandler::loadInclude(). Test a case where the file is loaded in Pre Apply and one that isn't
- New permission, removed permission
- Entity types
Other follow-ups
- Determine if there are any types of things, like classes or global, functions that can't be reloaded immediately after an update and where a PostApply subscriber will always be loading the pre-update version. If there are any of these things document them and suggest ways around this.
- Determine if we should ensure our cron implementation runs last to ensure other cron implementations are not accessing cached things
Comments
Comment #2
tedbowcreated #3267632: Ensure new, changed or deleted routes are in the correct state after an update as the first issue
Comment #3
phenaproximaWe might be able to do a lot of this stuff, and possibly all of it, by modifying our existing StagedUpdateTest and its fixtures.
Comment #4
phenaproximaComment #5
tedbowComment #6
tedbowfixed #3279527: Ensure plugins are reloaded after an update
I would say this is done as for as stable blocker. Of course there probably 100s of specific things we could check for but I think we got the main ones
Comment #7
phenaproxima