WP Cron fails to spawn on production
I was checking to see if a scheduled task that I added to WP cron was there or not and it appears that WP cron doesn't appear to be working.
I used the following wp-cli command to see if WP cron was functioning correctly:
wp cron test
And that throws back the following error:
Error: WP-Cron spawn failed with error: cURL error 28: Operation timed out after 3001 milliseconds with 0 out
of -1 bytes received
I then checked the cron schedule with:
wp cron event list
And there are a bunch of older cron events dating as far back as March 7th that haven't run. This might be the cause of other issues such as #7346. Also, I'm guessing that no one has received a daily digest since March 7th.
I did some brief research to see what might be causing the problem and a Github user notes that
commons.gc.cuny.edu might not be in the HOSTS file during the cURL lookup:
We'd have to confirm with Lihua if that is the case or not.
I also just tested WP cron on the development server and it appears to be working there though.
#3 Updated by Raymond Hoh almost 2 years ago
Boone - I think my suspicions are correct.
If you do the following:
$args = array( 'timeout' => 0.01, 'blocking' => true, // I changed this to 'true' from 'false' in order to get some output. /** This filter is documented in wp-includes/class-wp-http-streams.php */ 'sslverify' => apply_filters( 'https_local_ssl_verify', false ) ); // Use the Commons homepage as a test. $test = wp_remote_post( home_url( '/' ), $args ); var_dump( $test );
You'll see that the HTML markup is for
http://gc.cuny.edu/Home and not
So it appears that cURL is not finding
We should contact Lihua about this.
#5 Updated by Raymond Hoh almost 2 years ago
- Status changed from New to Rejected
- Target version changed from 1.10.15 to Not tracked
Boone - I was about to write to Lihua, but I wanted to test cron again to confirm my findings.
wp cron test now appears to work, though I'm not sure why.
However, if you run
wp cron event list, it is still showing older cron events instead of upcoming ones.
I installed WP-Crontrol on production to see if wp-cli might be showing the wrong data and there are differences. Check out WP-Crontrol's version at "Tools > Cron Events" in the WP admin dashboard. WP-Crontrol appears to have newer events, but is still showing expired ones and no upcoming events.
This might be due to the Memcached object cache plugin we are using. I forget which specific one we are currently using on production, but it might be the one by tollmanz:
However, tollmanz's plugin is old. Human Made has forked it and has been making improvements:
Not sure if we want to be messing around with switching object cache plugins, but thought I'd mention this.
Since you stated that you are receiving daily digests, I presume that cron is in fact working, so I'm going to close this as rejected.
#6 Updated by Boone Gorges almost 2 years ago
It does sound like it might be a cache issue, though it's very strange that it'd persist for this long. Since the cache array gets updated fairly frequently, you'd think that cache discrepancies would flush themselves pretty quickly.
I think we are using tollmanz's drop-in. It's definitely worth examining Human Made's (thanks for pointing it out btw - I hadn't seen it before, and I need to reach out to them regarding https://core.trac.wordpress.org/ticket/20875#comment:33) but, like you suggest, I don't think it's worth it for the purposes of this ticket.
Let's remember that this ticket exists if we hear about any weirdness related to scheduled events.
#8 Updated by Raymond Hoh almost 2 years ago
Just to update this thread, Lihua made a change to the HOSTS file and now WP's cron tasks look correct when accessed via the WP admin dashboard's "Tools > Cron Events" page.
wp-cli is still showing older events, but I take that as a conflict between our Memcached object cache drop-in and wp-cli.