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-&gt;__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-&gt;submitForm(Array, Object) (Line: 411)
Drupal\config_sync\Form\ConfigSyncImportForm-&gt;submitForm(Array, Object)
call_user_func_array(Array, Array) (Line: 111)
Drupal\Core\Form\FormSubmitter-&gt;executeSubmitHandlers(Array, Object) (Line: 51)
Drupal\Core\Form\FormSubmitter-&gt;doSubmitForm(Array, Object) (Line: 589)
Drupal\Core\Form\FormBuilder-&gt;processForm(&#039;config_distro_import_form&#039;, Array, Object) (Line: 318)
Drupal\Core\Form\FormBuilder-&gt;buildForm(&#039;config_distro_import_form&#039;, Object) (Line: 93)
Drupal\Core\Controller\FormController-&gt;getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber-&gt;Drupal\Core\EventSubscriber\{closure}() (Line: 582)
Drupal\Core\Render\Renderer-&gt;executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber-&gt;wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber-&gt;Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel-&gt;handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel-&gt;handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session-&gt;handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle-&gt;handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache-&gt;pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache-&gt;handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware-&gt;handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware-&gt;handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel-&gt;handle(Object, 1, 1) (Line: 693)
Drupal\Core\DrupalKernel-&gt;handle(Object) (Line: 19)
</pre>

Proposed resolution

???

Command icon 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:

Comments

axel.rutz created an issue. See original summary.

geek-merlin’s picture

Title: The database connection is not serializable » On update with translations: WSOD "The database connection is not serializable"
Issue summary: View changes

There are a lot of objects involved, and all seem to correctly use DependencySerializationTrait.

I could track it down to this:

        serialize($config_importer->getStorageComparer()->getSourceStorage('language.de'));

which is FilteredStorage(GhostStorage(CachedStorage(...)))

geek-merlin’s picture

Status: Active » Postponed

Wow what a debugging. Tracked down to #3035988: ConfigNormalizerManager not serializable, postponing on this..

bircher’s picture

Thank 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.

geek-merlin’s picture

Status: Postponed » Active

NO, 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:

  public static function create(ContainerInterface $container) {
    return new static(
      $container->get('config.storage.sync'),
      $container->get('config.storage'),
      $container->get('config.storage.snapshot'),

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.

geek-merlin’s picture

SO: What on earth is hapening in the language.de source storage that is not in the default storage...

geek-merlin’s picture

OK 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

geek-merlin’s picture

Title: On update with translations: WSOD "The database connection is not serializable" » On config distro update with translations: WSOD "The database connection is not serializable"
geek-merlin’s picture

Status: Active » Postponed
Related issues: +#3054084: StorageComparer WSODs on serialization

Banzai!

Finally hunted that down and fixed via #3054084: StorageComparer WSODs on serialization. Any help there with tests and getting that in is appreciated.

geek-merlin’s picture

Don'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.

nedjo’s picture

After the sync i get a lot of errors like "The entity does not have an ID."

Is 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.

geek-merlin’s picture

Thanks @nedjo for the pointer.

Although the message is the same, this still happens with current composer require drupal/config_actions:1.x-dev#0260559 including the fix.

Can you look into #3054245: Config distro update with translation only shows "last" language?

geek-merlin’s picture

Still an issue.

trackleft2’s picture

Status: Postponed » Needs work

@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?

joegraduate’s picture

Issue tags: +Chicago2026, +Drupalcon Chicago 2026
rachel_norfolk’s picture

Issue tags: -Drupalcon Chicago 2026

Correcting the issue tag for DrupalCon

joegraduate’s picture

Version: 8.x-1.x-dev » 3.0.x-dev