close Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": Can't find an appropriate component, maybe the corresponding plugin was not enabled? ). Look in the Trac log for more information.

Opened 3 years ago

Closed 3 years ago

#1569 closed defect (fixed)

WP Super Cache causes high "doing_wp_cron" load

Reported by: tigertech Owned by: gallir
Priority: normal Plugin: wp-cache
Severity: normal Keywords: wp-super-cache cron
Cc:

Description

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 seems appropriate because that's the default it gets set to (based on $cache_max_time) anyway.

Change History (1)

comment:1 Changed 3 years ago by donncha

  • Resolution set to fixed
  • Status changed from new to closed

In [592326]:

Error: Failed to load processor CommitTicketReference
No macro or processor named 'CommitTicketReference' found
Note: See TracTickets for help on using tickets.