PHP :: Bug #75146 :: APCu: apcu should not return stale data in cli mode
php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75146 APCu: apcu should not return stale data in cli mode
Submitted: 2017-09-01 14:28 UTC Modified: 2018-06-24 04:25 UTC
From: spam2 at rhsoft dot net Assigned:
Status: No Feedback Package: APC (PECL)
PHP Version: Irrelevant OS:
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: spam2 at rhsoft dot net
New email:
PHP Version: OS:

 

 [2017-09-01 14:28 UTC] spam2 at rhsoft dot net
Description:
------------
"After the ttl has passed, the stored variable will be expunged from the cache (on the next request)" - fine, i don't care when it get purged phyiscally but i care when it lives forever in CLI mode

the code below was intended to run within our cli-autotests but since there are no requests "apc.enable_cli = 1" is completly unuseable in a long running script because you get stale data forever

i guess the check is done against $_SERVER['REQUEST_TIME'] which don't change and is fine in webserver-mode to save expensive time() calls but not in CLI mode

 apcu_store('shm_ttl_test', 'TTL TEST', 1);
 $cache_read = apcu_fetch('shm_ttl_test', $success);
 if($success !== true || $cache_read !== 'TTL TEST')
 {
  trigger_error('unexpected shm-read');
  $return_value = 0;
 }
 sleep(1);
 $cache_read = apcu_fetch('shm_ttl_test');
 $cache_read = apcu_fetch('shm_ttl_test');
 if(!empty($cache_read))
 {
  trigger_error("unexpected shm-read - value should have expired $cache_read");
  $return_value = 0;
 }


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-09-01 14:30 UTC] spam2 at rhsoft dot net
or at least trigger a warning when TTL is set in CLI mode that this don't work
 [2017-10-24 08:51 UTC] kalle@php.net
-Summary: apcu should not return stale data in cli mode +Summary: APCu: apcu should not return stale data in cli mode
 [2018-02-27 11:38 UTC] nikic@php.net
-Status: Open +Status: Feedback
 [2018-02-27 11:38 UTC] nikic@php.net
Did you set apc.use_request_time=0?
 [2018-02-27 12:45 UTC] spam2 at rhsoft dot net
> Did you set apc.use_request_time=0

no - but "Use the SAPI request start time for TTL" should not matter when apcu_store() set a explicit TTL


the snippet from the report is part of a large cli-autotest-suite which should not behave that way depending on a ini-setting you probably have no control of
 [2018-06-24 04:25 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.
 [2018-06-24 04:31 UTC] spam2 at rhsoft dot net
no feedback was provided? WTF
 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sat Aug 18 22:01:26 2018 UTC