Bug #65406
closedextbase_reflection cache not cleared with ApcBackend
Added by David Lemaitre over 9 years ago. Updated over 9 years ago.
0%
Description
I configured extbase_reflection to use ApcBackend cache. When i use "Clear all caches" button in Install Tool, all user cache entries are cleared in APC except extbase_reflection ones.
That's problematic when I made changes to Extbase models, I have to clear manually APC or use FileBackend for this cache.
TYPO3 6.2.10
PHP 5.4
Updated by Markus Klein over 9 years ago
How do you configure this? Can you post your code please?
Updated by David Lemaitre over 9 years ago
This is my cache configuration in AdditionalConfiguration.php :
//
// Cache configuration
//
function apc_for_cache_backend($cacheName){
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$cacheName]['backend'] = 'TYPO3\\CMS\\Core\\Cache\\Backend\\ApcBackend';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$cacheName]['options'] = array();
}
function file_for_cache_backend($cacheName){
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$cacheName]['backend'] = 'TYPO3\\CMS\\Core\\Cache\\Backend\\FileBackend';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$cacheName]['options'] = array();
}
// Do not use APC for development context and for CLI
if (PHP_SAPI === 'cli' || \TYPO3\CMS\Core\Utility\GeneralUtility::getApplicationContext() == 'Development') {
file_for_cache_backend('cache_pages');
file_for_cache_backend('cache_hash');
file_for_cache_backend('cache_pagesection');
file_for_cache_backend('cache_rootline');
file_for_cache_backend('extbase_reflection');
file_for_cache_backend('extbase_object');
}
else {
// causing blank pages
//apc_for_cache_backend('cache_classes');
apc_for_cache_backend('cache_pages');
apc_for_cache_backend('cache_hash');
apc_for_cache_backend('cache_pagesection');
apc_for_cache_backend('cache_rootline');
// cache not cleared
apc_for_cache_backend('extbase_reflection');
// APC already enabled for extbase_object (see Install Tool)
}
Updated by Markus Klein over 9 years ago
Thanks. So the issue seems to be that the cache definition happens in the AdditionalConfiguration. It works if APC is configured in LocalConfiguration.
Updated by Markus Klein over 9 years ago
I'm not able to reproduce this on current master.
I configured the extbase_object cache to use the DB in Install Tool and change this to APC in AdditionalConfiguration.
Still \TYPO3\CMS\Core\Cache\Backend\ApcBackend::flush() keeps getting called, when I click the "Clear all cache" button.
Can you please verify the issue still exists on the current master branch? (or on the 6.2 branch)
Updated by David Lemaitre over 9 years ago
I made further tests :
Firstly, I configured cache_classes, cache_pages, cache_hash, cache_pagesection, cache_rootline, extbase_object and extbase_reflection to use FileBackend in AdditionalConfiguration.php
I did these actions for each cache :
- Switch to ApcBackend
- Clear all cache + clear user entries in APC console
- Make FE calls
- Check if user entries exists in APC console
- Clear all cache again
- Check if user entries are cleared in APC console
- Revert to FileBackend
This are the results :
- cache_classes : entries are not cleared
- cache_pages : no user entries after making FE calls ?!
- cache_hash : entries are cleared
- cache_pagesection : entries are cleared
- cache_rootline : entries are cleared
- extbase_object : entries are not cleared
- extbase_reflection : entries are not cleared
Testing with TYPO3 6.2.10.
Updated by Markus Klein over 9 years ago
After talking to Christian Kuhn about this issue, I realized that I debugged that on current master above, but the implementation is already improved there.
He will give this one a shot.
Updated by Christian Kuhn over 9 years ago
Ok, I thought I had an idea, but that did not lead to the root of this issue.
This is either a problem in the install tool (the caches in 6.2 are set to nullBackend and maybe not correctly re-initialized in ClearCacheService - This would be an area to start debugging this issue). The underlying code and initialization was adapted by me for master already, so it would also be helpful to know if master is affected, too.
Or, you run into a systematic integrity problem in apc cache backend: To distinguish caches from each other, entries are tagged with an identifier that is unique for a specific cache (cache, not cache entry). If a cache is flushed, a flushByTag operation is fired that clears all entries tagged with this internal tag. The problem begins if the user cache is full: apc will then throw out "something" which kills the integrity and the flushByTag operation will then no longer find all related entries to drop them ... This is by the way the main reason why it is a bad idea to put stuff like cache_pages into apc: The cache integrity is harmed pretty quickly and your flush operations may not do what you want. Basically: Never put anything into APC (similar for memcache) that uses tagging. See http://docs.typo3.org/typo3cms/CoreApiReference/CachingFramework/FrontendsBackends/Index.html#cache-backends for more details on that (the warning for memcache applies to apc as well). This is also the reason why the install tool preset only configures the reflection cache to use apc - reflection does not tag at all.
It would be great if you could debug this a bit further. Basically, if the cache framework does NOT get the correct cache configuration (it should be possible to debug the apc backend flush method and see if it is called for the correct cache), then this is an issue in the install tool and it would be interesting if it is solved in master. If the apc cache backend is called correctly, then have a more detailed look at this class and the install tool is correct at this point.
Updated by Christian Kuhn over 9 years ago
Another detail on tagging: Flow adapted the cache framework a bit and introduced a "TaggableInterface" and changed some of the key-value backends ... I'm not 100% sure, but I think some parts of this still need to be backported / adapted. Maybe we find some time to do this before 7 LTS, would be neat. In contrast to flow, we however probably need some backwards compatibility layer, I think that was the main reason why I did not yet backport everything.
Updated by Christian Kuhn over 9 years ago
A simple test: Please raise the amount of maximum "user" data for APC and see if the issue is gone.
Updated by Christian Kuhn over 9 years ago
- Status changed from New to Needs Feedback
Updated by Alexander Opitz over 9 years ago
- Status changed from Needs Feedback to Closed
No feedback within the last 90 days => closing this issue.
If you think that this is the wrong decision or experience this issue again, then please write to the mailing list typo3.teams.bugs with issue number and an explanation or open a new ticket and add a relation to this ticket number.