-
Notifications
You must be signed in to change notification settings - Fork 17
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
Auto-cache cron event removed? #613
Comments
This seems like #603 could be related, however this also seems to be an isolated incident. I only rolled this on my main personal site yesterday which is why I reported, however today I started rolling this out to the other sites on my personal server and a couple of servers with client sites at work, and all sites I randomly checked had the |
To add, when I attempt to re-create the cron event in two different scenarios (WP-CLI and a PHP script), while I can get |
@MarioKnight Interesting. Thanks for the report. This does sound like #603 might be related, but it could also be something else. Here are a few questions:
Note that you can backup your ZenCache configuration via ZenCache → Plugin Options → Import/Export Options, then click Restore to reset your configuration and see if that makes the cron even reappear, and then reapply your configuration by importing the saved options. |
@raamdev I think this issue (and perhaps #603 too) are both related to the bug I outlined for Kristine in this PR. I just stumbled into this while reviewing her work. See: wpsharks/comet-cache-pro#174 (comment) In short, |
I'm sorry for the delay, it's been a hectic couple of days.
Other tidbits that may or may not make a difference include me going from 5.4.45 to 5.6.15 on my personal server same days before the update. The week before, I followed the guide on your site to use RAM for the cache files, so this was the first update done following that change. I attempted to use the export/import described, which did bring back the event, but did not work when called, which I am doing via WP-CLI. At one point in the update, I got a message about my .htaccess similar to #617, however that only happened once and I have not been able to get that to come up again to add anything worth mentioning in that issue report. I also noticed that most of the time I click to save changes, I am now getting a generic 500 error, however the changes seem to save. |
I'm copying @patdumond's comment from #603 so that we can keep all reports for this in one place (this issue has more updates, so I'm favoring keeping this one open): @patdumond writes...
|
@jaswsinc writes...
That bug did not exist in v151105, so this issue must be the result of something else. |
Copy that. My mistake. That bug was introduced while working on a PR, never in the official copy. |
@patdumond writes...
Are you saying that the Auto-Cache Engine is disabled if ZenCache is disabled? That is the expected behavior. If you disable ZenCache, the cron job that runs the Auto-Cache Engine should be removed. |
I'm saying that it is removed from we-cron when ZenCache is deactivated and is not recreated/turned back on when ZenCache is reactivated. |
@patdumond Do you still have a site where you can reproduce that behavior consistently? If so, I'd like to send you a copy of the latest dev build to see if the recent work that went into the dev branch fixes this issue. |
I was able to successfully reproduce this bug following these steps:
So, the bug appears to be with Still investigating... |
Another datapoint that adds to the difficulty of reproducing this bug:
My first thought would normally be, "okay, well maybe WordPress is cleaning up that cron when it finds the thing it was hooked to no longer exists...", except that Why does |
Referencing: this file in WP core. I'm reviewing that file to see if I can help answer your question. |
I haven't been able to pin this down yet, but I am almost sure that the reason for this disappearance is the schedule that the auto-cache engine runs on. It's a schedule that only exists so long as ZenCache is an active plugin; i.e., it runs on a custom schedule of |
So I think you've discovered a WP core bug. We just need to find a way to prove that now. ha |
@jaswsinc You were right. This is related to WP Core, but it's not a bug as far as I can see (unless we're supposed to be able to schedule events with schedules that no longer exist). 😄 Here's what's happening: When As an aside: I learned how to use XDebug to debug WP Cron API code without triggering XDebug from the browser (i.e., auto-triggering it whenever cron runs): Reviewing the WP Core code, I think the current behavior makes perfect sense. (How can WP 'remember' the custom In fact, I was surprised to see the |
Makes sense. I see exactly what you mean.
ha. That's awesome! I'll have to try that out some time.
I mostly agree, but what makes me feel that this is a bug are the comments in these lines of code. See: https://github.com/WordPress/WordPress/blob/77e365efbf2e499e2ed11d29c101ea466cf1ceed/wp-includes/cron.php#L126-L137 As it exists, a CRON entry is self-contained, and it should not need to depend on the schedule once it has already been configured at least once, because the interval is known. It appears to me that whoever authored So I still feel that this is a bug (very minor), but I call it a bug, because the array of schedules should be reserved almost entirely for a UI-based approach to WP Cron. The schedule itself should not have any impact on the integrity of the underlying array, because all the schedule does is set an interval anyway. Once that interval is known, the dependence on the original schedule should end. |
I agree with you there, we shouldn't be able to create a CRON using a non-existent schedule, because the interval would be unknown. However, once an event has been scheduled it shouldn't disappear simply because the schedule it was connected to is gone. It shouldn't even be connected to the original schedule at all, in fact. Once the event is set, the interval is known. The So the bug is not with That means that all of your configured CRON jobs are susceptible to this magical disappearing act when/if you happen to deactivate any given plugin which filters the array of known schedules. |
Another example of how (what I consider to be a bug) could cause problems... We recently made it possible for you to schedule the cleanup process in a custom way; using one of the configured WordPress CRON schedules that is available in your installation of WordPress. But what happens if you choose a schedule from the dropdown that is exposed by a plugin other than ZenCache? If, later, you deactivate that plugin, the ZenCache cleanup task will magically disappear due to this bug. |
@jaswsinc writes...
Ah, I see what you mean. Yep, I agree that this appears to be the result of a bad strategy on WP_Cron's part and probably someone inserting code somewhere that changed the originally intended behavior.
Great point! That's a really good example of how this bug would affect other plugins in negative ways, or at the very least make it more challenging and less intuitive for them to use WP_Cron in various ways (like we are with allowing someone to select a possibly custom schedule). I'll file a WP Core ticket to hopefully get some attention around this issue, but in the meantime I'll follow your suggestions in the PR to fix this for ZenCache so that we work around this issue. |
Next Pro Release Changelog:
|
ZenCache Pro v151220 has been released and includes changes worked on as part of this GitHub Issue. See the release announcement for further details. This issue will now be locked to further updates. If you have something to add related to this GitHub Issue, please open a new GitHub Issue and reference this one (#613). |
I just updated to ZenCache pro v151114 earlier. As I have done with any plugin updates, I went to call the manual cron event
_cron_zencache_auto_cache
to rebuild the site's cache following the cache being cleared after plugin updates. I did this today for the first time after installing the new version, and I received the following message:Error: Invalid cron event '_cron_zencache_auto_cache'
I was thinking/hoping this may have moved to a different event, however I only see the
_cron_zencache_cleanup
event associated with ZenCache Pro where a direct call does not rebuild the cache. It has also been a few hours, and I am not seeing the cache in a status I would expect to see following a rebuild.The text was updated successfully, but these errors were encountered: