|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59776 Cached Variables not expiring
Submitted: 2011-05-19 01:03 UTC Modified: 2016-11-18 21:43 UTC
From: admin at edma dot com Assigned:
Status: Wont fix Package: APC (PECL)
PHP Version: 5.3.5 OS: Centos 4.8
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: admin at edma dot com
New email:
PHP Version: OS:


 [2011-05-19 01:03 UTC] admin at edma dot com
Running PHP 5.3.6. on CentOS with APC

Replaced (fresh compile) 3.1.7 with 3.1.9 and the "Cached Variable" count shown on the APC info page continues to grow and never drops back down as variables expire  (aps.user_ttl=3600).

Reverting back to 3.1.7 brought back normal operation as observed for the past several months using 3.1.6 and later 3.1.7. 

3.1.7 cached variable count properly ranges between 100 and 150 with old ones dropping off.  Under 3.1.9, the count never stopped climbing (toward 1000) with the same website activity levels.

What else do you need from me to help.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-05-19 02:48 UTC]
Are you using the faster Read/Write locks?

If you are, then this is expected. To make cache finds faster, we only grab a read lock which means cache expiry is only done during a apc_store() to that particular hash-chain.

So, looking for an expired entry does not remove it. But it is guaranteed that trying to overwrite an entry will always remove it.

Essentially, it makes apc_fetch() really fast.
 [2011-05-19 13:57 UTC] admin at edma dot com
Thank you for the immediate reply. Understood, I'll look to modify my session mgmt garbage collection appropriately.
 [2011-05-27 12:29 UTC] bugggs at mailinator dot com
Doesn't this break a lot of read / calculate / cache models 
that many sites use? I know in all my code I try to read 
from the cache and if the cache has no entry (expired / 
never set), then the result is calculated and cached for say 
30 seconds (maximum tolerance of stale data). Then the next 
time it expires, it is re-calculated.

I was eager to try APC again after seeing support for 
read/write locks but this would seem to break many use 
cases. Is it possible to turn a read lock into a write lock 
if it's determined that the data is expired and remove it?
 [2011-05-27 16:45 UTC]
No, it doesn't break anything. When an entry is removed isn't 
something your app should care about. The apc_fetch() call 
will still return nothing for an expired entry just like 
before. The only thing that has changed is that the expired 
entry isn't physically removed from the cache.
 [2016-11-18 21:43 UTC]
-Status: Open +Status: Wont fix
 [2016-11-18 21:43 UTC]
APC is no longer supported in favor of opcache that comes bundled with PHP, if you wish to use the user cache, then look at PECL/APCu.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jun 23 02:01:28 2024 UTC