-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Cache] Always require symfony/polyfill-apcu to provide APCuIterator everywhere #24011
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This updates the |
@chalasr : fixed |
If we are OK to make Cache requires polyfill-apcu (a bit weird to me since it can be used without apcu), a test case would be nice to prevent future regressions. |
@chalasr : symfony/polyfill-apcu is used to provide APCuIterator for both PHP 5.5 + apcu 4.x and PHP 7.0. Will add a test ;) |
Test added, but Travis does not report it as the tests are run with the require-dev dependencies, e.g. with symfony/polyfill-apcu. |
the root composer file also needs to be patched as you did before |
@nicolas-grekas : you mean both composer.json files ? |
yes, both need the patch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(note to mergers: polyfill-apcu should be removed when merging into master)
Thank you @guillaumelecerf. |
…CuIterator everywhere (guillaumelecerf) This PR was merged into the 3.3 branch. Discussion ---------- [Cache] Always require symfony/polyfill-apcu to provide APCuIterator everywhere | Q | A | ------------- | --- | Branch? | 3.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | License | MIT **TL;DR: when APCuIterator is not available (i.e. PHP 5.6 + APCu 4.0.7), the APC cache handling is broken.** When [the app initializes](https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml#L31) one of [the APC caches](https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml#L14-L28), it tries to [retrieve its namespace flag key](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Cache/Traits/ApcuTrait.php#L42). If it can't, [it clears its namespaced cache](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Cache/Traits/ApcuTrait.php#L43) and [adds its flag key back](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Cache/Traits/ApcuTrait.php#L44). But [when APCuIterator is not usable](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Cache/Traits/ApcuTrait.php#L74), **the app [flushes the whole cache each time](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Cache/Traits/ApcuTrait.php#L76)**, preventing all the APC caches to retrieve their own flag key, resulting in a **perpetual full APC cache flush**. TODO: - [x] add test => https://travis-ci.org/symfony/symfony/jobs/269383629#L3334 See #24008 Commits ------- 9d44442 Always require symfony/polyfill-apcu to provide APCuIterator everywhere
TL;DR: when APCuIterator is not available (i.e. PHP 5.6 + APCu 4.0.7), the APC cache handling is broken.
When the app initializes one of the APC caches, it tries to retrieve its namespace flag key. If it can't, it clears its namespaced cache and adds its flag key back.
But when APCuIterator is not usable, the app flushes the whole cache each time, preventing all the APC caches to retrieve their own flag key, resulting in a perpetual full APC cache flush.
TODO:
See #24008