Posted by gnindl on September 16, 2010 at 9:18am
4 followers
Jump to:
| Project: | Cache Router |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | major |
| Assigned: | Unassigned |
| Status: | needs work |
Issue Summary
When flushing the cache the, APC throws an error message on cache_menu and cache_admin_menu lookups:
warning: apc_store(): Potential cache slam averted for key 'cache_menu_lookup' in .../cacherouter/engines/apc.php on line 197.
This is related to this APC issue:
http://pecl.php.net/bugs/bug.php?id=16843
We can get around this problem by using an atomic function when storing keys to APC (see patch).
| Attachment | Size |
|---|---|
| cacherouter-apc-cache-slam.patch | 469 bytes |
Comments
#1
trying this.
#2
still get the error
#3
I was getting this-
"warning: apc_store() [function.apc-store]: Potential cache slam averted for key 'cache_menu_lookup' in .../sites/all/modules/cacherouter/engines/apc.php on line 197."
Right after a cache flush...
So I did this-
- apc_store($this->lookup, $lookup, 0);
+ @apc_store($this->lookup, $lookup, 0);
To the above mentioned file per the patch.
Now I am getting these 2 right after a cache flush-
"warning: apc_store() [function.apc-store]: Potential cache slam averted for key 'cache-context' in .../sites/all/modules/cacherouter/engines/apc.php on line 95."
These are lines 92-103 in that file
" $lookup[$this->key($key)] = $expire;
// Attempt to store full key and value
if (!apc_store($this->key($key), $cache, $ttl)) {
unset($lookup[$this->key($key)]);
$return = FALSE;
}
else {
// Update static cache
parent::set($this->key($key), $cache);
$return = TRUE;
}"
AND
"warning: unlink(/tmp/cache_lock) [function.unlink]: No such file or directory in .../sites/all/modules/cacherouter/Cache.php on line 124."
these are lines 115-126 at the very end of this file
" /**
* unlock()
* lock the cache from other writes.
*
* @param none
* @return bool
* Returns TRUE on success, FALSE on failure
*/
function unlock() {
unlink($this->lock);
}
}"
So, what's next?
Or, I guess what might be the better question, should I have added the "@" per the posted patch? Or is there a better solution? Is there some behavior that caused th original error message to occur that I could try to avoid?
Can I get a human translation of what that line was doing before and after the "@" was added? Thanks
#4
I think we should not hide this warnings!
http://pecl.php.net/bugs/bug.php?id=16843 suggests use of
apc.slam_defense = Off;Actually this lead to inconsistensy in cache because of
It's actually a feature, which prevents you from inserting the same keymultiple times with-in the same second.
Also using an old version of APC your own choice so you just need to use this switch.
I guess we need to append readme about suggested APC version and this key settings.
#5
I am trying the suggestion.
If it does not work, then I'll revert to apc 3.1.4 if I need to.
I will report back
Edit:
While I did not get the error, I did get the core dump that the slam protection was supposed to be a fix for.
I tried downgrading to apc-3.1.4. I read this issue was in 3.1.5 and 3.1.6. We'll see.
#6
I was just about to do the same, I think you have to go all the way to 3.0.19. http://pecl.php.net/bugs/bug.php?id=16843