Problem/Motivation
Workaround: If you encounter this error, update to 8.2.7 first and then update to 8.3.0.
If old schema cache entries are left around during an update they can get in the way.
Steps to reproduce:
- git co 8.1.1
- composer install
- drush si minimal
- drush en hal config -y
- drush config-edit rest.settings and change the link_domain - it actually not important but it is what I did.
- git co 8.3.0
- composer install
- drush updatedb -y
- BOOM
Here's the backtrace:
Error: Call to undefined method Drupal\Core\Config\Schema\Undefined::get() in Drupal\Core\Config\StorableConfigBase->castValue() (line [error]
179 of /Volumes/devdisk/dev/sites/drupal8alt.dev/core/lib/Drupal/Core/Config/StorableConfigBase.php) #0
/Volumes/devdisk/dev/sites/drupal8alt.dev/core/lib/Drupal/Core/Config/Config.php(212):
Drupal\Core\Config\StorableConfigBase->castValue('uuid', '8da39019-21f6-4...')
#1 /Volumes/devdisk/dev/sites/drupal8alt.dev/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(280):
Drupal\Core\Config\Config->save(false)
#2 /Volumes/devdisk/dev/sites/drupal8alt.dev/core/lib/Drupal/Core/Entity/EntityStorageBase.php(392):
Drupal\Core\Config\Entity\ConfigEntityStorage->doSave('entity.node', Object(Drupal\rest\Entity\RestResourceConfig))
#3 /Volumes/devdisk/dev/sites/drupal8alt.dev/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(259):
Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\rest\Entity\RestResourceConfig))
#4 /Volumes/devdisk/dev/sites/drupal8alt.dev/core/lib/Drupal/Core/Entity/Entity.php(364):
Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object(Drupal\rest\Entity\RestResourceConfig))
#5 /Volumes/devdisk/dev/sites/drupal8alt.dev/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php(637):
Drupal\Core\Entity\Entity->save()
#6 /Volumes/devdisk/dev/sites/drupal8alt.dev/core/modules/rest/rest.post_update.php(25):
Drupal\Core\Config\Entity\ConfigEntityBase->save()
#7 /Volumes/devdisk/dev/sites/drupal8alt.dev/core/includes/update.inc(241):
rest_post_update_create_rest_resource_config_entities(Array)
#8 /Volumes/devdisk/dev/drush5/commands/core/drupal/batch.inc(163): update_invoke_post_update('rest_post_updat...',
Object(DrushBatchContext))
#9 /Volumes/devdisk/dev/drush5/commands/core/drupal/batch.inc(111): _drush_batch_worker()
#10 /Volumes/devdisk/dev/drush5/includes/batch.inc(98): _drush_batch_command('2')
#11 /Volumes/devdisk/dev/drush5/commands/core/drupal/update.inc(174): drush_batch_command('2')
#12 /Volumes/devdisk/dev/drush5/commands/core/core.drush.inc(1224): _update_batch_command('2')
#13 /Volumes/devdisk/dev/drush5/includes/command.inc(422): drush_core_updatedb_batch_process('2')
#14 /Volumes/devdisk/dev/drush5/includes/command.inc(231): _drush_invoke_hooks(Array, Array)
#15 /Volumes/devdisk/dev/drush5/includes/command.inc(199): drush_command('2')
#16 /Volumes/devdisk/dev/drush5/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#17 /Volumes/devdisk/dev/drush5/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#18 /Volumes/devdisk/dev/drush5/drush.php(12): drush_main()
#19 {main}.
Proposed resolution
If we're in update don't use schema.
This is appears to be a drush bug - you need to be on version ^8.1.10 to have the fix.
Remaining tasks
User interface changes
None
API changes
?
Data model changes
None
| Comment | File | Size | Author |
|---|---|---|---|
| #19 | 2867444-18.patch | 1.46 KB | alexpott |
| #9 | 2867444-9.patch | 478 bytes | catch |
| 2867444-9.patch | 460 bytes | catch | |
| #7 | 2867444-7.patch | 1.34 KB | alexpott |
Comments
Comment #2
alexpottComment #3
alexpottComment #4
alexpottInterestingly if you do:
There's no BOOM
Comment #5
wim leers#2867113-11: Fatal error in serialization_update_8302() when updating to 8.3.0-rc2 reported this first:
The IS/STR also confirm this exact fatal error.
#4 referred to editing
link_domaininrest.settingsprior to updating from 8.2.x to 8.3.0. So, looked into that a bit. A few observations:rest.settingsuntil before 8.3.0 has this:rest.schema.yml, in 8.3.0:i.e.
link_domainis still there, specifically to not break config schema during upgrades.hal.schema.yml, in 8.3.0:i.e. the same.
Since it says
Undefined::get()does not exist,getSchemaWrapper()must be returning an instance of\Drupal\Core\Config\Schema\Undefined, and that seems to be incorrect based on it being assigned thestringtype.I don't know configuration system/configuration schema system internals well enough to make any educated guesses.
Comment #6
xjmAdding the workaround alexpott found to the summary. Assuming this was not assigned to catch on purpose.
Comment #7
alexpottI think there are quire a few situations where this might bite - I agree with @Wim Leers's analysis of why this set of updates is biting.
I think the best solution is if the SchemaWrapper doesn't implement TypedConfigInterface don't call get() because that is where the get() method comes from. The patch attached passes the above steps to reproduce in the issue summary.
Comment #8
berdirApparently this happens when the whole config object itself has no type.
What I don't quite understand is that the call to this is wrapped in
if ($this->typedConfigManager->hasConfigSchema($this->name)) {
]
So if we have config schema then the type must always be a container and should always implement TypedConfigInterface.
It looks like we an inconsistency between that check and actually getting/creating a data definition? Are we clearing one cache but not the other?
Comment #9
catchIf this is a real unexpected error condition then while the fatal is bad I'm not sure we should be that defensive, it could result in bad data in different circumstances.
Should we not just trust the data when we save the rest config entities in the post update?
Comment #10
alexpott@catch I think my preference would be to disable schema during hook_update_N()
Comment #12
catchThis isn't hook_update_N() though, it's a post update that's supposed to have a full environment available. Not sure whether there's a use case to want schema in that case but maybe in the load and resave case to get things casted properly
Comment #13
alexpottMore info... if you do the above steps all via the UI it does not occur using the single import / export so there's something up with drush updates that makes this more likely.
Comment #14
alexpottThis is a drush bug - see https://github.com/drush-ops/drush/pull/2707 for drush 8.x and https://github.com/drush-ops/drush/pull/2706 for drush master
Comment #15
alexpottComment #16
catchIf this was fixed in February (in https://github.com/drush-ops/drush/issues/2617), what do we want to do here?
We could:
1. Commit this anyway since we trust the data
2. Re-purpose it to be a more useful error
Is it worth adding a note like 'If you're updating directly from 8.1.x to 8.3.x you should update drush first' to the release notes, on the other hand you're not really supposed to update from 8.1.x to 8.3.x directly.
Comment #17
berdirHm.
According to the report in #2867113: Fatal error in serialization_update_8302() when updating to 8.3.0-rc2, the person reporting that problem did not have drush installed at all. So it possibly isn't something *only* triggered by drush?
We probably need more info on previous version, installed modules, ..
Comment #18
catchThat was a hook_update_N(), this is a hook_post_update_FOO(), the important thing with this issue is the full cache clear/rebuild before the post updates run, which drush wasn't doing correctly. Enforcing schema in hook_update_N() needs to be ruled out possibly since we can't do a clean cache rebuild then so much.
Either way we do need to do something here about alternative code paths even if it's just better error handling.
Comment #19
alexpottHere's another idea I had - basically to completely disable schema in hook_update_N - unfortunately this current implement would affect post updates too and I'm not convinced about that. Plus there's https://github.com/drush-ops/drush/pull/2627
Comment #20
berdirI can't find anything in the comments from MmMnRr over there that he was running into a problem with the same update function as you did?
Comment #21
alexpott@Berdir me neither I just tried to recreate it an found this. The full backtrace from @MmMnRr would be helpful but we never got that.
Comment #22
alexpottCreated #2867570: Drupal 8.3.0 is not compatible with Drush <8.1.10 - lets declare that in composer.json to help with the drush situation.
Comment #23
xjm(From the other issue.)
So it's not only drush, then.
Comment #25
xjm#2861863: InvalidArgumentException "Field is unknown" in ContentEntityBase is another totally different fatal that goes away when running database updates multiple times. Hmm.
Comment #26
MmMnRr commentedHi all,
I was trying to update from Drupal 8.1.1 to Drupal 8.3.0.
I do not have the full trace because I do not have drush installed. The only error message I got appeared on Apache log:
I followed the official Drupal Core update instructions:
https://www.drupal.org/docs/8/update/update-procedure-in-drupal-8
I tried to run update.php several times and it always failed.
Then I navigated through the website pages and tried again. The update worked perfectly then. Maybe the navigation triggered something but I have no proof.
The specific line referenced in the trace is the following:
/.../core/lib/Drupal/Core/Config/StorableConfigBase.php
As the update has been done correctly now, I am unable to reproduce again the issue.
Comment #27
alexpott@MmMnRr thanks for commenting. I'm glad you got your site updated. I guess that navigating to some other pages caused a config schema rebuild and that fixed this. Is there any chance that your webserver logs contain the full stack trace that lead to
PHP Fatal error: Call to undefined method Drupal\Core\Config\Schema\Undefined::get().Comment #28
MmMnRr commented@alexpott The Apache log only included that message. Unfortunately, I do not have a more complete full stack trace.
Comment #29
alexpottDiscussed with @catch, @Cottser, @effulgentsia, and @xjm. We decided that because the only known steps to reproduce involve outdated Drush versions this is not critical. There might be value in filing a follow-up issue to improve hook_update_N documentation to detail what is allowed and that config should be saved using the flag to ignore schema.
Comment #35
quietone commentedThis issue concerns updating to a now non-supported Drupal version. I think that makes this outdated, closing as such.
Thanks folks!