php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59938 APCIterator fails with large user cache
Submitted: 2011-09-06 14:43 UTC Modified: 2013-02-18 00:35 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (33.3%)
From: joe dot lencioni at gmail dot com Assigned:
Status: No Feedback Package: APC (PECL)
PHP Version: 5.3.6 OS: Linux 2.6.32-131.4.1.el6.x86_64
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2011-09-06 14:43 UTC] joe dot lencioni at gmail dot com
Description:
------------
Similar to bug #24343, APCIterator fails when working with a 
large user cache.

Our user cache is currently 100663 (858.4 MBytes), and when we 
try to get some keys and loop over them, it seems that 
APCIterator fails when calling current().

This problem makes APC unsuitable for working with a large 
user cache.

Reproduce code:
---------------
$apcCache = new \APCIterator('user', '`^example-search`', APC_ITER_KEY, 100, APC_LIST_ACTIVE);

var_dump($apcCache->getTotalCount(), $apcCache->current());

Expected result:
----------------
int 2
array
  'key' => string 'example-search-201213' (length=26)

Actual result:
--------------
int 2
bool false

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-09-06 15:12 UTC] joe dot lencioni at gmail dot com
I believe this may have also prevented stale entries in the 
user cache from being deleted by APC.
 [2012-02-15 17:00 UTC] ns at vivid-planet dot com
I can reproduce this issue using the following example code:

//to fill apc cache (~200MB):
for($i=0;$i<50000;$i++) {
    $value = str_repeat(md5(microtime()), 100);
    apc_store('test-niko-asdfasdfasdfkjasdflkasjdfasf'.$i, $value);
}

//then later (usually after a few minutes) this won't work correctly:
$it = new ApcIterator('user', '#^test-niko-asdfasdfasdfkjasdflkasjdfasf#');
var_dump($it->getTotalCount()); //returns 50000
var_dump($it->current()); //returns false
 [2012-02-15 17:02 UTC] ns at vivid-planet dot com
PS: I'm running:
PHP 5.3.3-7+squeeze3
APC 3.1.9
 [2012-08-14 15:27 UTC] ab@php.net
Automatic comment from SVN on behalf of ab
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=327123
Log: added test for bug #59938
 [2012-08-14 15:29 UTC] ab@php.net
Looks like this bug isn't reproduceable anymore with PHP 5.4 and current APC 
trunk. Could you test it there please?
 [2012-08-14 15:29 UTC] ab@php.net
-Status: Open +Status: Feedback
 [2012-11-24 17:35 UTC] sfedder at hotmail dot com
I had this same issue occur during make test on current version APC 3.1.13 under 
PHP 5.4.8.  FAIL APC: Bug #59938 APCIterator fails with large user cache 
[tests/apc54_018.phpt]
 [2013-02-18 00:35 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 "Open". Thank you.
 [2013-04-04 01:07 UTC] mi+php at aldan dot algebra dot com
This test still fails for me with APC-3.1.13 compiled against php-5.4.13 (on RHEL 5.7, 64bit):

FAILED TEST SUMMARY
---------------------------------------------------------------------
APC: Bug #62190 Couldn't fetch DOMProcessingInstruction with APC and native obj (php 5.4 nts) [tests/apc54_003.phpt]
APC: Bug #62456 Incorrect description of notice variation 1 (php 5.4 nts) [tests/apc54_004.phpt]
APC: Bug #61912 Memory corruption in ext/dom (php 5.4) [tests/apc54_008.phpt]
APC: Bug #61824 apc produces strange notice (php 5.4) [tests/apc54_009.phpt]
APC: Bug #59938 APCIterator fails with large user cache [tests/apc54_018.phpt]
Trying to exclude trait method multiple times (origin Zend/tests/traits/error_010.phpt) [tests/apc54_error_010.phpt]
Exclude trait method [tests/apc54_error_010_2.phpt]

Using php-5.3.21 on the same system is clean.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Nov 27 23:03:15 2021 UTC