[wp-hackers] Hooking into wp-cron settings?

Brian Layman bulk at thecodecave.com
Mon Dec 13 19:29:59 UTC 2010


On 12/13/2010 11:28 AM, Chip Bennett wrote:
> I've been searching in the meantime, and found your original forum
> reply<http://wordpress.org/support/topic/296236#post-1175405>
> .
>
> Perhaps an obvious question: is there any way to debug the problem is a
> server configuration issue, that would require using the alternate cron
> method?
>
> Chip
Isn't that an excellent reply?  I saved it for posterity on The Code 
Cave last week (giving full credit) and added my own comments afterward.

Here are my additions:

I would add three things to this explanation:

    * mod_security can be configured to block the ip address of the
      server, the domain name itself or even wp-cron specifically.  You
      can do some testing of this by doing a wget for your domain from
      your server. (wget http://example.com/wp-cron.php) and look at the
      results.  If there's a problem and you can't change the
      mod_security config itself, the fix may be configuring .htaccess
      to specifically allow
      <http://wordpress.org/support/topic/wp-cron-is-having-mod_security-error-500>
      from your server's external IP address access to that file.
    * The loopback address failure can be caused by the Linux networking
      subsystem failing to load completely. Diagnosing that is off topic
      here, but you could look for it and see if you can "ping
      127.0.0.1" and your domain from your server. If that works,
      loopback config isn't the problem. If you it doesn't, try running
      "ifconfig lo up" and doing it again. If it works, you've got some
      networking issues to resolve. If once device fails due to a config
      error, the rest don't come up in systems I've seen.
    * It has been reported and disputed
      <http://core.trac.wordpress.org/ticket/8923> that the line in
      cron.php that calls the script has  a timeout that is too short or
      a value that is incompatible with some configurations. I also
      suspect that this can be a problem on extremely overloaded
      systems.  However, the fix might be worse than the original symptom.

The line in question is:

    wp_remote_post($cron_url, array('timeout' => 0.01, 'blocking' =>
    false));

Some people have changed 0.01 to 1 and it works however, this adds a 
full second to every page load that calls wp-cron - and that could be 
very costly Google wise.  So be conservative  using this "fix". On your 
overloaded system, adding milliseconds or second or more might not be 
noticeable, but then again - you probably have more pressing things you 
should be worrying about than a few missed posts.

http://thecodecave.com/2010/12/05/answered-help-wordpress-keeps-missing-my-scheduled-posts/

-Brian


More information about the wp-hackers mailing list