I wonder if anyone has found any weird behaviours with apc_exists()
, behaviour that causes the entire WAMP server to hang when using it together with apc_add()
or apc_store()
?
After a long session of "debugging" and minimizing the problem I ended up with the following code that causes my WAMP to crash.
As far as I can tell it requires 1 apc_exists()
and 2 apc_add()
accessing different keys. [thus it sounds like a deadlock-issue]
I run this script in chrome and then smashes F5-key until I get the rand-thingy to happen twice. At that time or the first time it usually hangs.
<?php
$result = "asdfioasdjfoasdjf";
if(apc_exists("asdf")) {
echo("#1<br/>");
apc_add("launcher", $result, 1);
} else {
echo("#2<br/>");
$result = "asdfasdfasdf";
apc_add("launcher", $result, 10);
}
if(rand(0,100) < 4) {
echo("#stored data!<br/>");
apc_add("asdf", "2130130", 1);
}
?>
My system/setup:
Windows 7 64bit
WAMP 2.2d 32bit
PHP Version 5.3.10
apc version 3.1.9 | $Revision: 325040 $
Am I doing something wrong in the code? Is this related to windows / wamp or does it exist in other environments and php/apc-versions?
In the above case, if I replace apc_exists()
with apc_fetch()
, the system doesn't crash, does anyone know why?