Make WordPress Core

Opened 5 years ago

Last modified 6 months ago

#23133 new enhancement

Display a warning in the admin if cron tasks fail due to blocked HTTP requests — at Version 9

Reported by: prb22public@… Owned by:
Milestone: Future Release Priority: normal
Severity: major Version: 3.5
Component: Cron API Keywords: dev-feedback has-patch
Focuses: Cc:

Description (last modified by SergeyBiryukov)

I recently upgraded my very simple WP site to 3.5 where the following was in use:

Theme: Twenty Eleven Plugins: None Activated

I have been completely unable to submit a post for publishing in a future date, when the time occurs, I get a "missed schedule" message.

The schedule entry in cron is as follows:

Next due (GMT/UTC): Jan 4, 2013 @ 11:28 (1357298880)
          Schedule: One-off event
              Hook: publish_future_post
         Arguments: [0]: 358

Increasing the timeout value in cron.php has made no difference.

I will need to remain on a lower release until this is fixed or a diagnosis "kit" is made available.

I am not using any software other that WP produced at this point and feel that the lack of wp-cron documentation and support in the public domain leaves alot of people clocking many hours googling in desperation...

Make a difference in 2013 and get 3.5 development priorities to de-mystify the methods of fixing wp-cron please :o)

Change History (10)

#1 @prb22public@…
5 years ago

I have since re-installed wordpress from scratch using a fresh database and directory in a sub-domain http://dev.crinniswoodmanagement.co.uk

It has no plugins or themes or child data, literally "out of the box" and it fails to publish a scheduled test post where everything else works.

Happy to hand over the admin keys to the web interface if I somebody wants to look under the hood and assist/troubleshoot root cause...

#2 @prb22public@…
5 years ago

PHP Version 5.3.10

MYSQL details (obtained from phpMYAdmin on 8th January 2013)

Server: Localhost via UNIX socket Software: MySQL Software version: 5.5.25a-log - MySQL Community Server (GPL) Protocol version: 10 User: xxxxxx@localhost Server charset: UTF-8 Unicode (utf8)

#3 @prb22public@…
5 years ago

  • Keywords dev-feedback added; needs-patch reporter-feedback removed

#4 follow-up: @SergeyBiryukov
5 years ago

Related: #19621. The only change to cron in 3.5 was #13449.

Does the site actually get visited in order for the cron task to run in time (see ticket:17888:4)?

#5 in reply to: ↑ 4 @prb22public@…
5 years ago

Replying to SergeyBiryukov:

The dev site I have setup specifically to diagnose the issue does not get visits from anyone apart from myself during the tests to get the scheduler to work.

I appreciate there is a need for a "visit" to kick off cron entries, but this does not appear to occur and posts stay in "missed schedule" status, implying one of two things:

  1. wp-cron is not being triggered on webpage visit.
  2. wp-cron is perhaps being triggered (how do I check this?) but is not picking up past entries/hooks that have missed the schedule date/time.

This does appear to be prevalent in 3.* versions of WP and perhaps increasing dependancy on the mechanism is causing a lot of concern in communities where debug documentation is poor. I'd really like somebody to deep dive into my dev site where they can see first hand the problem if they are unable to replicate elsewhere.

#6 @prb22public@…
5 years ago

  • Keywords 2nd-opinion added

I would really welcome development look over the installation to be able to diagnose the issue which could be useful to the wider community.

#7 @SergeyBiryukov
5 years ago

  • Keywords 2nd-opinion removed

Your host appears to block local HTTP requests.

WP_Http_Curl didn't return an error, just an empty response (I've created #23310 for that). However, this simple example displays "Curl error: couldn't connect to host" when being run on your server:

function curl_test_23133() {
	$ch = curl_init();

	curl_setopt( $ch, CURLOPT_URL, 'http://dev.crinniswoodmanagement.co.uk/' );
	curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );

	$result = curl_exec( $ch );
	if ( false === $result )
		echo 'Curl error: ' . curl_error( $ch );

	echo $result;

Other transports also returned errors:

WP_Http_Streams: Could not open handle for fopen() to ...
WP_Http_Fsockopen: "110: Connection timed out"

The workaround is to use ALTERNATE_WP_CRON:

Another option is to add DISABLE_WP_CRON to your wp-config.php file and set up a cron job on the server to hit wp-cron.php every 1, 5, or 10 minutes, or whatever you prefer.

We could probably detect this situation and display some kind of warning in the admin.

#8 @SergeyBiryukov
5 years ago

  • Keywords needs-patch added
  • Summary changed from wp-cron fails to schedule posts to Display a warning in the admin if cron tasks fail due to blocked HTTP requests
  • Type changed from defect (bug) to enhancement

#9 @SergeyBiryukov
5 years ago

  • Description modified (diff)

Related: #11831

4 years ago

possible patch for check and message

Note: See TracTickets for help on using tickets.