Closed (fixed)
Project:
Scheduler
Version:
2.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
24 Jan 2023 at 11:37 UTC
Updated:
2 Aug 2023 at 10:39 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
chr.fritschHere is a patch that fixes our problems.
Comment #3
alexpottI think there are a few more things to do here.
1. Add $is_syncing to scheduler_install() too.
2. Add $is_syncing to scheduler_uninstall() too.
Comment #4
alexpottHad a good look at what schedule_modules_installed() is doing and I think that some of it might need to be run on config import. I think that the SchedulerManager::entityUpdate() is important. But I don't think it should run during a module install. We can add an extra step to config import to sort this out after all the config is imported. See field_config_import_steps_alter() for an example. Note we might not be able to work out if we need to do anything prior to the import so the step might have to always run.
Comment #5
alexpottGiven #4 and the complexity here we're going to need some tests.
Comment #6
jonathan1055 commentedThanks @chr.fritsch and @alexpott. Scheduler 2.0 is planned for release very soon, the last RC has been out in the wild, just coming up to two months, and has 2,321 downloads and I've not had to fix anything so far. Do you think this problem is important enough that it should be done for 2.0 i.e. delay the release? Or if we open a MR here, then you can use the patch from it in your imports and test it properly.
Another alternative would be to commit the simple patch in #2, to be included in release 2.0 but keep the issue open for the rest of the work.
Comment #8
alexpott@jonathan1055 yes this is important enough in my mind to delay 2.0 - it makes sites that use scheduler really hard to install from configuration. The behaviour of affecting config during module install and uninstall has to be very carefully considered during a config sync. It's easy to get wrong and have unexpected effects that cause data loss as you can overwrite intended change.
Comment #9
neclimdulRunning an install with this code just returns an endless log of this:
Seems to be because the new sync step doesn't tell the context that the step finished.
Needs this line added
Comment #10
jonathan1055 commentedHi neclimdul,
That's a coincidence because I was just looking at this right now. Can you list the steps to reproduce, right from the start, so that I can try to see this for myself.
Comment #11
neclimduljust run the install with config import. Specifically for me
drush si -y --existing-configYou can see how the context is suppose to work in the sync step in this test:
https://git.drupalcode.org/project/drupal/-/blob/10.1.x/core/modules/con...
Comment #12
jonathan1055 commentedThanks @neclimdul yes I can replicate the problem of never-ending log message using
drush site-install -y --existing-config. The change you suggested does fix this, so I have added that to the PR. Also some other minor changes to comments and coding standards.Regarding the new hook
scheduler_config_import_steps_alter()this is running$scheduler_manager->entityUpdate()and avoids running$scheduler_manager->viewsUpdate(). It also runs$scheduler_manager->entityRevert()but that was never done in the original hook_modules_installed(). So I'd like to know why @alexpott added that. There could be a good reason, or it could be a mistake. It almost certainly will do nothing anyway, but its confusing to call something if never required.Comment #13
jonathan1055 commentedThree months with no reply. I'm going to commit this as-is, and then release Scheduler 2.0.0
Comment #15
jonathan1055 commentedThank you @chr.fritsch for the initial report and @alexpott and @neclimdul for your help.
Comment #16
neclimdulThanks you! Sorry if you needed additional feedback, we'd been running a version of this patch since the discussion so I expect all is well.
Comment #17
jonathan1055 commentedIt was only the question in #12 about why scheduler_manager->entityRevert() was added to the process when it was not called in the original hook_modules_installed(). But I'm fairly sure it will do nothing and won't cause any harm, so I decided to commit as-is. Good to hear you've been using the patch and all is OK.
Comment #18
jonathan1055 commentedSeems that this fix still broke config import when the entity does not have a bundle.
#3373860: entityRevert breaks config:import if there are entity types that do not have a bundle class
But the fix is simple enough.
Comment #19
jonathan1055 commented@neclimdul @alexpott @chr.fritsch I decided to remove the added call to
scheduler_manager->entityRevert(). I do not think it is correct to add it there, and can actually cause problems when upgrading from 8.x-1.x to 2.0.0.There is a simple fix on #3373860: entityRevert breaks config:import if there are entity types that do not have a bundle class - does this look OK to you?
https://git.drupalcode.org/project/scheduler/-/merge_requests/94
If so I will commit and then release 2.0.1 to prevent further sites having the same difficulties.
Comment #20
jonathan1055 commentedI have released Scheduler 2.0.1 with the necessary fix.
Comment #21
neclimdulCool. Not sure why it wasn't a problem for us or why it was there in the first place but it does seem like its probably not needed. Thanks!
Comment #22
jonathan1055 commentedI think it wasn't a problem for you because you didn't have any pending entity updates, or if there were you ran them before the import.
The call should not have been there in the first place. As I said in #12 above I was dubious about it being added.
All fixed now :-)