We’ve recently noticed that some of the busy WordPress sites we host are calling “POST /wp-cron.php?doing_wp_cron” several times a second. This causes high load.
I believe we’ve traced this to a change in WP Super Cache 1.0. If someone was using a version of WP Super Cache from before version 1.0, and they then updated to version 1.0 or 1.1 without resaving the garbage collection settings, WP Super Cache can think that the garbage collection interval is 0.
This happens because wp-cache-phase2.php contains this code in schedule_wp_gc() near the bottom:
wp_schedule_single_event( time() + $cache_time_interval, 'wp_cache_gc' );
That code relies on the global $cache_time_interval being set in the “wp-cache-config.php” file. But on sites that have been upgraded as I described, that variable isn’t present. The code cited above treats $cache_time_interval as zero, making WP Super Cache constantly schedule the next garbage cleanup for the current time. The code fires again on the next HTTP request, and so on in an infinite loop.
The code could protect against this problem (and others) with the addition of something like this before $cache_time_interval is used:
if ( !isset( $cache_time_interval ) )
$cache_time_interval = 3600;
3600 is appropriate because that’s the default it gets set to (based on $cache_max_time) anyway.
- The topic ‘WP Super Cache causes high "doing_wp_cron" load’ is closed to new replies.