|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-07-25 18:22 UTC] gopalv@php.net
[2013-08-05 19:52 UTC] krakjoe@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: krakjoe
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 24 04:00:02 2025 UTC |
Description: ------------ When two or more concurrent scripts try to save data to the APC user cache, and APC memory usage is high (near limit set by apc.shm_size option), function apc_store() randomly fails to save data and returns false. I`ve updated APC to latest available version from trunk (3.1.15-dev). I provide simple test script. To reproduce the bug, you should: 1) Set apc.shm_size to relative small value (eg. 32M) 2) Leave the rest of options at default values 3 Run test script simultaneously in two different browsers. This is very important to have at least two instances executing at a time, because one single script will always work correctly. If the problem doesn`t occur, try to repeat this several times and make sure you have reached full memory usage allowed by limit (one execution of a script takes approximately 12MB of RAM). Test script: --------------- <?php for ($i = 0; $i < 20000; $i++) { $unique = uniqid(); if (false === apc_store($unique, $unique, 3600)) { throw new Exception('Failed'); } usleep(1000); } echo 'OK'; Expected result: ---------------- Script run in each browser should write values to the cache and display OK. Actual result: -------------- Result is correct only when APC has a lot of free memory available. When memory usage is high (near limit set by apc.shm_size) one of the scripts very often throws an exception, because apc_store() is unable to write to the cache. Test case works well with relatively small value of apc.shm_size, but the problem remains also on production servers, with 512MB or more shm_size.