Skip to content

Conversation

@nicolas-grekas
Copy link
Member

@nicolas-grekas nicolas-grekas commented Feb 18, 2022

Q A
Branch? 4.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #40965
License MIT
Doc PR -

This fixes memory leaks caused by the container not being reset between requests made via KernelBrowser when not calling KernelBrowser::disableReboot();.

There is already a call to $container->reset() in KernelTestCase::ensureKernelShutdown(), but KernelBrowser creates new container instances for each requests, and those containers were never reset.

@fabpot
Copy link
Member

fabpot commented Feb 19, 2022

Thank you @nicolas-grekas.

@fabpot fabpot merged commit a3bceff into symfony:4.4 Feb 19, 2022
This was referenced Feb 28, 2022
@nicolas-grekas nicolas-grekas deleted the hk-browser-reset branch February 28, 2022 08:54
nicolas-grekas added a commit that referenced this pull request Mar 1, 2022
…icolas-grekas)

This PR was merged into the 4.4 branch.

Discussion
----------

[FrameworkBundle] Fix resetting container between tests

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #40965, fix #45580
| License       | MIT
| Doc PR        | -

Replaces #45479 and #45581, related to #34078.

Calling `boot()` on an already booted kernel does reset the container, so we don't need to care anymore about the state of kernel.

#45580 is fixed by removing `private static $kernelContainer`, which can be out of sync with `static::$kernel->getContainer()` since `KernelBrowser` creates new containers when shutting down the kernel between requests.

Commits
-------

4453bdb [FrameworkBundle] Fix resetting container between tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants