|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59531 APC behaves badly when it fills up
Submitted: 2010-12-06 14:53 UTC Modified: 2016-09-11 04:22 UTC
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: webmaster_apc at colnect dot com Assigned: cmb (profile)
Status: No Feedback Package: APC (PECL)
PHP Version: 5.3.2 OS: gentoo linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2010-12-06 14:53 UTC] webmaster_apc at colnect dot com
I've been using APC for a long time and I'm not sure whether or not it's a regression of 3.1.5 since usually APC's cache wouldn't get full. I was previously using 3.0.19 for a long time and haven't gotten the same problems.I give it 1.5G and use it frequently to cache database query results along with other things.

When the cache fills up (I see the "Full count" growing), it appears that APC is removing entries which should not have been removed from cache. It also somehow always displays free space in the cache (around 40-80M).

The reason I'm certain that it does that is because some user cache items are meant to stay for 24 hours and the cache fills up before these 24 hours are over and then the database server gets loaded with queries that should have been cached.

I'm pretty sure that non-expired entries should stay in the cache even if it gets full. Am I missing anything?

Thanks and sorry for not having an exact scenario.

Reproduce code:
Sorry, I haven't an exact code to reproduce the situation.

Expected result:
When the cache is full it should keep all non-expired entries.

Actual result:
Important cache entries are deleted and not saved again.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-13 13:28 UTC]
Unless a cache_ttl is set for the cache, it'll nuke everything.
 [2011-01-15 11:24 UTC] webmaster_apc at colnect dot com
Sorry for the delay. Of course the user_ttl is properly set and I can confirm that the ttl is properly set when I view the user variables. However, due to bug #20731 I cannot make any checks when the cache is actually full. For now, I simply have a much larger cache than what I actually need to prevent it from becoming full.
 [2014-10-17 10:40 UTC] hugo at domibay dot es
This Behaviour can still be observed on CentOS release 6.5 (Final) with php 5.4 and apc 3.1.15

Name        : php                          Relocations: (not relocatable)
Version     : 5.4.28                            Vendor: Remi Collet
Name        : php-pecl-apc                 Relocations: (not relocatable)
Version     : 3.1.15                            Vendor: Remi Collet

Although the user_ttl is set when the assigned Memory runs full APC starts to kill any entry of lesser time of life although its time of life has not run out yet.
That leads to Cache Access Misses even only some milliseconds have passed since the Cache was created.
 [2016-08-31 15:48 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2016-08-31 15:48 UTC]
APC has been discontinued in favor of APCu.
Does this issue still occur using the latter?
 [2016-09-11 04:22 UTC] pecl-dev at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri Sep 30 18:05:52 2022 UTC