Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP APC Potential Cache Slam Averted for Key

Tags:

I'm receiving this error while trying to use apc_store(). I googled it and saw that this was APC timebomb bug and saw some fixes which suggested adding apc.slam_defense = Off; to php.ini.

I need to know whether this has happened because of a programming error, and if yes, how to fix it.

This is the code segment:

if ($data = apc_fetch("foo")) {     $an_array = $data; } else {     /* couple of lines */      apc_store("circles", $an_array); // This is where I get the error } 

This script will be called frequently in my deployed system.

I hope I've provided enough info

Thanks in advance

like image 650
shyam Avatar asked Feb 13 '11 09:02

shyam


2 Answers

Setting apc.write_lock = 1 and apc.slam_defense = 0 in php.ini should fix the problem.

like image 96
rynop Avatar answered Sep 21 '22 06:09

rynop


Since APC 3.1.3, it seems there is a bug (http://pecl.php.net/bugs/bug.php?id=16814), warning are made when slam defense is at on and when you try to write a key that already exists.
Does not seem to be fixed yet.

like image 32
Serty Oan Avatar answered Sep 20 '22 06:09

Serty Oan