php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #58609 apc.user_ttl causes entire user cache to be delete
Submitted: 2009-03-31 15:54 UTC Modified: 2009-03-31 20:32 UTC
From: radek at pinkbike dot com Assigned:
Status: Closed Package: APC (PECL)
PHP Version: 5.2.9 OS: centos 5.2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: radek at pinkbike dot com
New email:
PHP Version: OS:

 

 [2009-03-31 15:54 UTC] radek at pinkbike dot com
Description:
------------
Had do go through the source code to figure out why my entire user cache was being deleted when segment memory reached max, instead of just the user entries with expired ttls.

As the source documents, the default apc.user_ttl of 0, causes the entire cache to be expunged, which is not obvious behavior.

Currently apc.user_ttl is defined as..
"The number of seconds a user cache entry is allowed to idle in a slot in case this cache entry slot is needed by another entry. Leaving this at zero means that your cache could potentially fill up with stale entries while newer entries won't be cached. "

On initial reading this value can be interpreted as just a default ttl value for entries, but if your usage is to specify a per entry ttl with apc_store/add this setting is easy to ignore/misinterpret.

Additional confusion may be caused by the fact that a 0 ttl in a per entry assignment signifies that the slot will persist indefinitely, but actually, this entry would be deleted in the expunge, where as a entry with a high ttl would not be deleted.

I'm still trying to understand how and when the garbage collection happens during normal operation,  in addition to the expunge when the segment becomes full.




Expected result:
----------------
Just to explain how this was impacting us.  We use apc as a general user data storage cache that is deterministic in quantity and size. This is preloaded/warmed before startup as the high traffic prevents us from loading the cache on the fly. In this use, we never fill the apc segment as we can configure it to be larger than the deterministic size of our data.
Recently we added an custom php session handler which also uses apc.  This essentially grows the segment until it is full, at which point we were expecting the garbage collection would remove all the stale slots/sessions, but not any of the valid slots.

Actual result:
--------------
To our surprise our whole site would crash because all the 300Megs (500k slots) of preloaded data would be erased also.  Oops.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-03-31 20:32 UTC] shire@php.net
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 11 23:01:33 2024 UTC