Working on #1872522: Compiled data in PHP storage is cleared too late in drupal_flush_all_caches(), I encountered a LocaleConfigOverride test failure that I was surprised wasn't also happening on HEAD. I discovered the reason was it was being masked by rebuildContainer() being called repeatedly rather than using the kernel's intended API of persisting across reboots. There's a @todo in HEAD's code about that, so this patch resolves that todo, which will surface at least that one failure for us to deal with.

Comments

Status: Needs review » Needs work

The last submitted patch, simpletest-kernel.patch, failed testing.

effulgentsia’s picture

Status: Needs work » Needs review
StatusFileSize
new1.2 KB
new6.64 KB

This doesn't fix the LocaleConfigOverride test, but it implements one additional cleanup to make sure $this->container gets updated within resetAll().

The reason for the LocaleConfigOverride test failure is this: as modules are enabled within WebTestBase::setUp(), module_enable() calls updateModules() on the kernel, causing it to reboot. The patch in #1187726-118: Add caching for configuration / rework config object loading (Was: Memory usage and i/o from config objects) introduced the concept of persisting service instances across kernel reboots. For now, the only service being persisted is 'config.factory'. That service has 'config.storage' and 'event_dispatcher' injected into it, but those services are not currently tagged to persist. So, what happens is that in a reboot, the persisted 'config.factory' service retains a local copy of the old 'config.storage' and 'event_dispatcher', while calling drupal_container()->get('event_dispatcher') on the new container instantiates a new event dispatcher.

So, locale_language_init() ends up adding LocaleConfigSubscriber to the new event dispatcher, not the one used by the persisted config factory.

Possible solutions:
- Tag event_dispatcher to persist.
- Make DrupalKernel automatically persist all service instances that are dependencies of a service tagged to persist.
- Change locale_language_init() to add LocaleConfigSubscriber to the config factory's event dispatcher rather than drupal_container()'s event dispatcher.
- Add LocaleConfigSubscriber statically within LocaleBundle rather than dynamically within locale_language_init(), and make LocaleConfigSubscriber itself dynamically check language_multilingual() for deciding whether to apply overrides or not.
- Add LocaleConfigSubscriber statically within LocaleBundle and decide that overrides should apply regardless of whether the site has only 1 language installed or not.

Thoughts?

Status: Needs review » Needs work

The last submitted patch, simpletest-kernel-2.patch, failed testing.

effulgentsia’s picture

Status: Needs work » Needs review
StatusFileSize
new666 bytes
new7.38 KB

The RDF failure in #2 was random. This implements the possible solution #2.1. I don't know if it's the most logical one, but just demonstrating that it works. One possible flaw with it is that the event dispatcher itself receives 'service_container' as a dependency, which means that will be the old container, not the rebuilt one, so any lazy loaded subscribers will be lazy loaded from the old container, not the new one.

effulgentsia’s picture

One possible flaw with it is that the event dispatcher itself receives 'service_container' as a dependency

A possible solution to this, and one that maybe overlaps with #2.3, is we can introduce a 'config.event_dispatcher' service that is different from the primary 'event_dispatcher', and make 'config.factory' use that one instead, and that one could use the base EventDispatcher class rather than ContainerAwareEventDispatcher.

effulgentsia’s picture

Status: Needs review » Needs work

Clicking the "view details" in #4 shows bot to be stuck in a loop on it: is there a way to kill it? I'll post something more along the lines of #5 when I get a chance.

effulgentsia’s picture

Assigned: Unassigned » effulgentsia

I'll come back to this soon, after figuring out #1885780: Remove persistence of config.factory across kernel reboots.

effulgentsia’s picture

Assigned: effulgentsia » Unassigned
Status: Needs work » Needs review
StatusFileSize
new8.28 KB

Status: Needs review » Needs work

The last submitted patch, simpletest-kernel-8.patch, failed testing.

effulgentsia’s picture

Status: Needs work » Needs review

#8: simpletest-kernel-8.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, simpletest-kernel-8.patch, failed testing.

effulgentsia’s picture

Status: Needs work » Needs review
StatusFileSize
new434 bytes
new8.85 KB
effulgentsia’s picture

sun’s picture

Status: Closed (duplicate) » Needs review
Issue tags: +Testing system

mmh, not sure whether merging these two issues makes sense. The testing environment handling is fairly specific to tests.

I think the two issues will be easier to tackle and discuss in isolation. Thus, un-duping for now.

That said, #1331486: Move module_invoke_*() and friends to an Extensions class introduces a range of new usages for rebuildContainer() across all tests — primarily as a mechanism to synchronize the ModuleHandler from the test process with that of the internal browser; e.g., after enabling modules through the UI/internal browser, the kernel needs to be rebuilt, so as to match the environment of the internal browser. Previously, all of that code used system_list_reset(), but with the new ModuleHandler, the system_list*() functions only remain to deal with themes.

chx’s picture

Note that persist is broken: when I added an EntityBundle which added a config.save subscriber this was not added to the EventDispatcher that ConfigFactory holds. I filed #1893566: The persist facility is broken for this.

chx’s picture

Caution. Check the git.drupal.org:sandbox/chx/1857558.git configquery branch at 9eb99a606e2178c75e196e0b987755955f14b1d6 which had http://drupal.org/node/1885780#comment-6947798 applied and failed ~50% of the time.

effulgentsia’s picture

StatusFileSize
new13.98 KB

Starting over due to #14. This only contains the change of rebuildContainer() to prepareKernel(). And changes every caller of rebuildContainer() other than setup() to instead call resetAll(). The goal is for within a test, for the kernel to stay the same, and for only the container to get rebuilt.

This will fail since other fixes from earlier patches haven't been incorporated yet, because I want to see which of those fixes are still relevant.

The last submitted patch, simpletest-kernel-17.patch, failed testing.

alexpott’s picture

Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new8.8 KB
new692 bytes
new8.12 KB

Whilst working on another patch I discovered the the container during WebTestBase::setUp is not always consistent! A service can be constructed with a different container from \Drupal.

Patch attached adds a test for this situation, cleans up a lot of unnecessary calls to TestBase::rebuildContainer() and proposes a fix. At this point I'm not entirely sure why it works but I believe it has to do with kernel rebuilding in rebuildContainer().

No interdiff with previous patches on this issue as started afresh.

The last submitted patch, 19: 1878512.19.pass_.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 19: 1878512.19.will-fail.patch, failed testing.

alexpott’s picture

alexpott’s picture

Status: Needs work » Needs review
Related issues: -#2163795: Possible alternative to #2147451?
StatusFileSize
new2.21 KB
new11.64 KB

So there is something special about the kernel and language - hopefully #1862202: Objectify the language system will help resolve this.

Status: Needs review » Needs work

The last submitted patch, 23: 1878512.23.patch, failed testing.

berdir’s picture

Interesting, I was in fact able to confirm that LanguageConfigurationTest is green when combined with the other issue (yay!) but only when *not* calling rebuildContainer(). With it, it fails uglier than it does now. Fragile stuff :(

berdir’s picture

Something else that I noticed.

In rebuildContainer(), we use the testing environment and prevent the container from dumping. While that makes sense for DUBT, it is in a way weird for web tests because on the first request, they will build the container and dump it. But drupal_handle_request() uses the hardcoded 'prod' environment, so they're not consistent.

In #2165549: Reduce number of password hashing iterations in all tests to improve test performance, @pwolanin tried to change that to use the testing environment when we're actually testing. Would it help/make sense to use the same environment and dump the container in web tests in the assumption that it's very likely that we will have a page request (if not then they probably shouldn't be web tests..)

tstoeckler’s picture

Would it help/make sense to use the same environment and dump the container in web tests in the assumption that it's very likely that we will have a page request (if not then they probably shouldn't be web tests..)

As far as I'm aware a lot of tests still have to be web tests due to old-style coupling of systems, e.g. theme/ render tests.

berdir’s picture

Why shouldn't render tests work as DUBT tests? :)

sun’s picture

I'd rather do the reverse:

WebTestBase::curlExec() → $this->container = include PhpStorage->get('container');

For web/integration tests, the goal is not to implant the container of the parent site (test-runner) into the child site, but instead, to resemble the container/state of the child site in the parent site (test-runner).

In essence, we want the parent site (test-runner) environment to match the child site as close as possible.

At the same time, any kind of automation can easily result in unwanted/undesired side-effects for the test that is being executed.

Disclaimer: I didn't look at any patches here, and perhaps I misinterpreted the last comments.

sun’s picture

In light of #29 and #2171683: Remove all Simpletest overrides and rely on native multi-site functionality instead, I wonder:

Shouldn't we actually override the TestBase::rebuildContainer() method in WebTestBase to rather let it reload the already dumped container from the child site?

I.e., along the lines of this?

class TestBase {
  protected function rebuildContainer($environment = 'testing') {
...
    $this->kernel = new DrupalKernel($environment, drupal_classloader(), FALSE);
...
  }
}
class WebTestBase extends TestBase {
  /**
   * Overrides TestBase::rebuildContainer().
   *
   * Loads the already dumped production container from the site under test
   * instead of rebuilding it from scratch.
   */
  protected function rebuildContainer($environment = 'prod') {
    parent::rebuildContainer($environment);
  }
}

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

jibran’s picture

Can we mark this outdated now?

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

longwave’s picture

Component: simpletest.module » ajax system
Status: Needs work » Closed (outdated)

Simpletest is long gone, and we no longer rebuild the container again in installModulesFromClassProperty().

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.