Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Revalidate Failure / Files Not Refreshed #140
We've had some issues with this, but until now, could not nail down for certain what was occurring. This issue occurs about 50% of the time during the process that I will describe.
To understand the problem we need be able to reproduce it. The less the reproduction case the better :)
For now I can just guess. Probably, the deployment process is not atomic. The file where ComposerAutoloaderInita8d874c72e26eea58cb1ad4a2bfaaf31 was defined was reloaded but file where ComposerAutoloaderInita8d874c72e26eea58cb1ad4a2bfaaf31 was used wasn't yet.
We are having a similar issue and in our case it comes from the parameter "opcache.enable_file_override".
Default is 0, but for performance reasons it is a good idea to activate it "opcache.enable_file_override = 1" or "opcache.enable_file_override = On".
But there is a bug because ZendOptimizer does no timestamp revalidation on file_exist, is_file and is_readable calls. This is not a problem as long as you only include or require a removed file, because it is in the cache (as long it is not removed), but it could become an issue when checking with file_exist, is_file or is_readable functions and then calling for example filemtime then.
For example think of a symfony 2 app using Symfony DIC, twig etc. Symfony caches configuration files (xml, yaml), annotations, twig templates, etc to the ./app/cache directory as php files.
Here is a test-script:
the "sleep(10)" is only to make sure the cache ttl is outdated when we set the revalidate frequence to 1 second with "opcache.revalidate_freq=1" (but it is not used in case of enable_file_override enabled handling. But the bug also occurs when sleep is removed because the revalidation is not used in case of file_exist, is_file and is_readable checks (what is the bug from my point of view).
expected output and with "opcache.enable_file_override" disabled (default):
broken output with "opcache.enable_file_override" enabled:
Configuration, working scenario:
Configuration, broken scenario:
The problem seems to come from the "static int filename_is_in_cache(char *filename, int filename_len TSRMLS_DC)" function in zend_accelerator_module.c. It only makes a hashmap lookup to find out if the file is in the cache, but it did not revalidate the cache timestamp (and when it is outdated it should return 0 or false).
Rene, I can confirm the issue. The overridden functions (file_exists, etc)
On Tue, Dec 10, 2013 at 5:48 PM, René Kerner email@example.com: