Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Existing advanced-cache.php doesn't get replaced when reactivating ZenCache plugin #507

Closed
raamdev opened this issue Jun 18, 2015 · 5 comments
Labels

Comments

@raamdev
Copy link
Contributor

raamdev commented Jun 18, 2015

Steps to reproduce this bug

  1. Install and activate ZenCache, then enable caching
  2. Deactivate the ZenCache plugin
  3. Install and activate WP Super Cache, then enable caching
  4. Deactivate the WP Super Cache plugin
  5. Activate the ZenCache plugin

Expected behavior

ZenCache should now be active and caching pages.

Observed behavior

WP Super Cache cache files are still being served, because wp-content/advanced-cache.php was never replaced by ZenCache with its own version.

If you Disable and then Enable caching in ZenCache, the advanced-cache.php file gets updated properly.


Note that this scenario specifically depends on ZenCache caching be enabled when you first deactivate the plugin, because when you reactivate ZenCache (after activating, enabling, and then deactivating WP Super Cache), ZenCache is activated with caching enabled (the previous setting). As a result, the routine that installs advanced-cache.php never runs.

@raamdev raamdev added the bug label Jun 18, 2015
@raamdev raamdev added this to the Future Release milestone Jun 18, 2015
@jaswrks
Copy link

jaswrks commented Jun 18, 2015

ZenCache is activated with caching enabled (the previous setting). As a result, the routine that installs advanced-cache.php never runs.

Ah, tricky tricky. Good catch!

@raamdev raamdev modified the milestones: Next Release (Pro), Future Release Jul 10, 2015
@jaswrks
Copy link

jaswrks commented Aug 21, 2015

Install and activate ZenCache, then enable caching
Deactivate the ZenCache plugin
Install and activate WP Super Cache, then enable caching
Deactivate the WP Super Cache plugin
Activate the ZenCache plugin

I was unable to reproduce this, and I just checked the source code to confirm this should not happen. After disabling WP Super Cache and then re-enabling ZenCache, I inspected the advanced-cache.php file and confirmed that ZenCache does handle this scenario properly.

However, I have noticed a similar issue myself in the past when testing, and I think what you might be experiencing is an OPCache issue? The advanced-cache.php file installed by WP Super Cache can get cached in memory. Try disabling WP Super Cache, re-enable ZenCache; and then immediately inspect your advanced-cache.php file.

What you should find is that advanced-cache.php has in fact been updated. However, if OPCache is configured to bypass stat checks, the old version of that file can remain in memory for a few minutes, or even until your next Apache restart. The result is that you'll think the file has not been updated, because WordPress is in fact still running with the old copy in memory.

Relevant OPCache config. options:


Suggested Configuration for Production

php.ini file config. options...

opcache.validate_timestamps = yes
opcache.revalidate_freq = 300 ; or higher

Note that this issue should not occur with PHP OPCache now that ZenCache is configured, by default, to automatically clear the OPCache whenever a wipe and/or reactivation takes place. That was part of the work in this PR: wpsharks/comet-cache-pro#127

The issue can occur however, if you are running APC with a configuration that would open you up to this sort of confusion. APC has similar config. options, and stat checks can be turned on to avoid this. Referencing: http://php.net/manual/en/apc.configuration.php#ini.apc.stat

@raamdev raamdev removed this from the Next Release (Lite) milestone Aug 21, 2015
@raamdev raamdev self-assigned this Aug 21, 2015
@raamdev
Copy link
Contributor Author

raamdev commented Aug 21, 2015

@jaswsinc I seem to recall manually inspecting the advanced-cache.php file each time, which would rule out the OPCache theory. I'll add this to my todo list again and attempt to reproduce it later. Thanks for the feedback! :-)

@jaswrks
Copy link

jaswrks commented Aug 22, 2015

I see. Well, maybe it's an issue that existed in a previous release and I just didn't test it at the same time as you did. I tested earlier today against the development branch.

@raamdev raamdev added this to the Future Release (Pro) milestone Sep 18, 2015
@raamdev raamdev modified the milestones: Next Release (Pro), Future Release (Pro) Oct 4, 2015
@raamdev
Copy link
Contributor Author

raamdev commented Nov 1, 2015

I re-tested this with the latest versions of ZenCache Lite and ZenCache Pro and was not able to reproduce the issue I described above. Closing this.

@raamdev raamdev closed this as completed Nov 1, 2015
@raamdev raamdev removed this from the Next Release (Pro) milestone Nov 1, 2015
@raamdev raamdev removed their assignment Apr 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants