Problem/Motivation
* With current 8.6.10 core, go to admin/config/development/configuration/distro and submit
Exception:
The website encountered an unexpected error. Please try again later.</br></br><em class="placeholder">LogicException</em>: The database connection is not serializable. This probably means you are serializing an object that has an indirect reference to the database connection. Adjust your code so that is not necessary. Alternatively, look at DependencySerializationTrait as a temporary solution. in <em class="placeholder">Drupal\Core\Database\Connection->__sleep()</em> (line <em class="placeholder">1481</em> of <em class="placeholder">core/lib/Drupal/Core/Database/Connection.php</em>). <pre class="backtrace">serialize(Array) (Line: 355)
Drupal\config\Form\ConfigSync->submitForm(Array, Object) (Line: 411)
Drupal\config_sync\Form\ConfigSyncImportForm->submitForm(Array, Object)
call_user_func_array(Array, Array) (Line: 111)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 51)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 589)
Drupal\Core\Form\FormBuilder->processForm('config_distro_import_form', Array, Object) (Line: 318)
Drupal\Core\Form\FormBuilder->buildForm('config_distro_import_form', Object) (Line: 93)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 693)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
</pre>
Proposed resolution
???
Comments
Comment #2
geek-merlinThere are a lot of objects involved, and all seem to correctly use DependencySerializationTrait.
I could track it down to this:
which is FilteredStorage(GhostStorage(CachedStorage(...)))
Comment #3
geek-merlinWow what a debugging. Tracked down to #3035988: ConfigNormalizerManager not serializable, postponing on this..
Comment #4
bircherThank you very much for digging through this.
Config Distro needs automated tests to make sure it continues to work future core versions. We simply extend an @internal class from core so we are not covered by any API promise. I was already afraid that this came to bite us already.
Comment #5
geek-merlinNO, it was not the other issue.
Ran again into this and it looks like the storages are not serializable in the batch. Like so (compatible with #2):
Unserializable class (✓=DependencySerializationTrait): Drupal\Core\Database\Driver\mysql\Connection => *connection => Drupal\Core\Cache\DatabaseBackend => *consistentBackend => Drupal\Core\Cache\ChainedFastBackend => *cache => Drupal\Core\Config\CachedStorage✓ => *storage => Drupal\config_filter\Config\GhostStorage => *storage => Drupal\config_filter\Config\FilteredStorage => *storage => Drupal\Core\Config\CachedStorage✓ => *sourceStorage => Drupal\Core\Config\StorageComparer✓ => *storageComparer => Drupal\Core\Config\ConfigImporter✓ => 0 => array => 1 =>I guess, in \Drupal\config\Form\ConfigSync the storages are plain services that DependencySerializationTrait can grip:
while FilteredStorage and GhostStorage in (from config_filter) are not serializable. They need to be.
I'll leave this issue open here for now, as people will look first here, and will add a companion issue in the respective projects that need fixes.
EDIT: I'm not sure what i wrote makes sense. Must think about it.
Comment #6
geek-merlinSO: What on earth is hapening in the language.de source storage that is not in the default storage...
Comment #7
geek-merlinOK debugged further.
In the StorageComparer's cached source storage
* for the default collection, we have serviceId = config_distro.storage.distro
* for the other (language.*) collections, we have no serviceId
Comment #8
geek-merlinComment #9
geek-merlinBanzai!
Finally hunted that down and fixed via #3054084: StorageComparer WSODs on serialization. Any help there with tests and getting that in is appreciated.
Comment #10
geek-merlinDon't know if this is related: After the sync i get a lot of errors like "The entity does not have an ID." and "Unable to determine class for field type '' found in the 'core.base_field_override.0' configuration". Maybe a broken storage after unserializing?
EDIT: looks like unrelated.
Comment #11
nedjoIs this on a site where Config Actions is in the mix? If so, see this potentially related issue and #3052289: Don't execute config actions during config import.
Comment #12
geek-merlinThanks @nedjo for the pointer.
Although the message is the same, this still happens with current
composer require drupal/config_actions:1.x-dev#0260559including the fix.Can you look into #3054245: Config distro update with translation only shows "last" language?
Comment #13
geek-merlinStill an issue.
Comment #14
trackleft2@geek-merlin please provide steps to reproduce, I would like to write a PHPUnit test for https://www.drupal.org/project/drupal/issues/3054084 but am unable to reproduce because the instructions are vague.
1. admin/config/development/configuration/distro does not exist See https://git.drupalcode.org/project/config_distro/-/blob/2.0.x/config_dis...
2. There is no submit button ( you probably mean import which I believe comes from config_sync)
3. Which language modules do you have installed. There are four in core (
language,locale,content_translation,config_translation)4. What meaningful configuration do I need to add in order to reproduce this?
5. Is this still an issue in Drupal 10.2 or the current version of Drupal?
Comment #16
joegraduateComment #17
rachel_norfolkCorrecting the issue tag for DrupalCon
Comment #18
joegraduate