php.net |  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
 [2011-05-19 01:03 UTC] admin at edma dot com
Description:
------------
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.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-05-19 02:48 UTC] gopalv@php.net
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] rasmus@php.net
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] kalle@php.net
-Status: Open +Status: Wont fix
 [2016-11-18 21:43 UTC] kalle@php.net
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: Thu Dec 12 19:01:27 2024 UTC