Bug #71749 [NEW]: file_cache_consistency_checks has no effect
From: iquito at gmx dot net
Operating system:
PHP version: 7.0.4
Package: opcache
Bug Type: Bug
Bug description:file_cache_consistency_checks has no effect
Description:
------------
I did a lot of tests with the new opcache.file_cache possibilities and
think that these new features are great. But as far as I can tell,
"opcache.file_cache_consistency_checks=1" has no effect - there are no
checks if files have changed or if the checksum is still the same, at
least I could not make out any noticeable effects.
This is a problem because it is now a bit confusing and hard to clear
the file cache - the only sure way to clear the cache is to delete the
cached .bin file. If "opcache.validate_timestamps" is set to 1, then
that also seems to work for the file_cache - an existing file_cache .bin
file is compared with the timestamp of the original .php file.
But in production, "opcache.validate_timestamps" is better set to zero,
to avoid file system requests. Until now, when deploying a new version
of an application, I just called "opcache_reset();" to reload the
application, which worked perfectly: in an instant, the old code is gone
and the new code is loaded.
With validate_timestamps set to 0 and with the new file_cache, the file
is instead immediately re-cached from the file system and not checked
against the original file - meaning a newly deployed application is not
loaded, the previous state is loaded from the file system. I thought
"opcache.file_cache_consistency_checks" was to specifically address this
issue - check if the file_cache version is still the same as the
original file. But this does not seem to work, in all my tests.
Test script:
---------------
Use the following settings:
opcache.enable=1
opcache.enable_cli=1
opcache.validate_timestamps=0
opcache.file_cache="/srv/php-file-cache"
opcache.file_cache_only=1
opcache.file_cache_consistency_checks=1
Then call a simple script from PHP CLI (opcache enabled), like "<?php
echo '5';" - this file will now be cached. If you change the file to
"<?php echo '7';", this change will never be displayed until you delete
the cached file from the file system.
--
Edit bug report at https://bugs.php.net/bug.php?id=71749&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71749&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71749&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71749&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=71749&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=71749&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=71749&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=71749&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=71749&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=71749&r=support
Expected behavior: https://bugs.php.net/fix.php?id=71749&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=71749&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=71749&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=71749&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71749&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=71749&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=71749&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=71749&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71749&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=71749&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=71749&r=mysqlcfg
Thread (9 messages)
- iquito at gmx dot net