Key config overrides queries mapping every config override each time

Created on 2 October 2023, over 1 year ago
Updated 18 April 2025, about 2 months ago

Problem/Motivation

Whenever a config override is run, the mapping is queried. If there is a mapping, it is cached in the service instance. If there is no mapping, the next time a config override is run, the mapping is queried again, resulting in an empty array again. Etc.

Steps to reproduce

Use the module without a key.config override, and check the queries being run.

Proposed resolution

Make the check in getMapping more strict.

Remaining tasks

Code review.

User interface changes

-

API changes

-

Data model changes

-

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇳🇱Netherlands spadxiii

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @spadxiii
  • Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    Not currently mergeable.
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    8 pass
  • First commit to issue fork.
  • Pipeline finished with Failed
    about 2 months ago
    Total: 180s
    #476547
  • 🇮🇳India vipin.mittal18 Greater Noida

    Hello Caspar,

    Could you please provide the exact steps to reproduce the issue? I want to ensure I'm not missing anything, as I haven't been able to replicate the problem on my end. Thanks!

  • 🇮🇳India vishalkhode

    Not able to reproduce issue as well. Verified that getMapping() method is called multiple times, but, due to the condition i.e if (!$this->mapping) {, it only executes once. Please add steps to reproduce and re-open, if we still see this issue. Hence, closing.

  • 🇺🇸United States japerry KVUO

    \Drupal\Core\Config\ConfigFactory::doGet will invoke \Drupal\Core\Config\ConfigFactory::loadOverrides over each with instances of \Drupal\Core\Config\ConfigFactoryOverrideInterface

    When config factory service is created \Drupal\Core\Config\ConfigFactory::addOverride adds each override, cannot guarantee they are re-used

    There is a bug here, but the proposed fix is not it. Will look into it further later.

Production build 0.71.5 2024