• Resolved Reüel

    (@pronamic_reuel)


    Hi,

    This plugin causes the WP Cron to result in HTTP status 500 and possibly prevents other scheduled tasks from being executed because of a wp_die() in https://github.com/A5hleyRich/wp-background-processing/blob/jobs-database-table/classes/worker/wp-http-worker.php#L270

    I’ve now manually edited the handle_cron() function in /mailchimp-for-woocommerce/includes/vendor/queue/classes/worker/wp-http-worker.php, but it would be better to see this fixed in the plugin itself of course.

    Edited version of handle_cron():

    		public function handle_cron() {
    			if ( $this->is_worker_running() ) {
    				// Worker already running, die
    				wp_die();
    			}
    
    			if ( $this->queue->available_jobs() ) {
    				$this->dispatch();
    			}
    		}

    Best regards,
    Reüel van der Steege

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hey there @pronamic_reuel

    Thanks for your post and sharing all this detailed information. I definitely want to be sure our team is aware of any conflicts and would be glad to pass along feedback. That said, I’d just like to gather a few details to be sure we’re on the same page with the behavior you’re seeing.

    When you get a chance, could you provide the following details?

    — When this error occurs, what are the specific steps being taken leading up to encountering this 500 error?
    — If possible, could you provide a screenshot of this error?
    — Could you confirm the name of the specific WordPress plugin that’s causing this conflict with the MailChimp for WooCommerce plugin?

    Thanks in advance for this Reüel. We’ll keep an eye out for your reply.
    – Malachite

    Hi @mcsupport,

    We’re experiencing the exact same problem that @pronamic_reuel has raised as we were seeing the WordPress error appear in the WP_Cron.

    I can be sure that your plugin is causing the error because when I put an echo at the line that Reüel mentioned, I see the output returned when the WP_Cron errors. It also never errors with the plugin de-activated.

    Logging into the server and running php -q wp/wp-cron.php in the WordPress root it outputs the following:

    <!DOCTYPE html>
    <!-- Ticket #11289, IE bug fix: always pad the error page with enough characters such that it is greater than 512 bytes, even after gzip compression abcdefghijklmnopqrstuvwxyz1234567890aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz11223344556677889900abacbcbdcdcededfefegfgfhghgihihjijikjkjlklkmlmlnmnmononpopoqpqprqrqsrsrtstsubcbcdcdedefefgfabcadefbghicjkldmnoepqrfstugvwxhyz1i234j567k890laabmbccnddeoeffpgghqhiirjjksklltmmnunoovppqwqrrxsstytuuzvvw0wxx1yyz2z113223434455666777889890091abc2def3ghi4jkl5mno6pqr7stu8vwx9yz11aab2bcc3dd4ee5ff6gg7hh8ii9j0jk1kl2lmm3nnoo4p5pq6qrr7ss8tt9uuvv0wwx1x2yyzz13aba4cbcb5dcdc6dedfef8egf9gfh0ghg1ihi2hji3jik4jkj5lkl6kml7mln8mnm9ono
    -->
    <html xmlns="https://www.w3.org/1999/xhtml" lang="en-US">
    <head>
    	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    	<meta name="viewport" content="width=device-width">
    	<meta name='robots' content='noindex,follow' />
    	<title>WordPress &rsaquo; Error</title>
    	<style type="text/css">
    		html {
    			background: #f1f1f1;
    		}
    		body {
    			background: #fff;
    			color: #444;
    			font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    			margin: 2em auto;
    			padding: 1em 2em;
    			max-width: 700px;
    			-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.13);
    			box-shadow: 0 1px 3px rgba(0,0,0,0.13);
    		}
    		h1 {
    			border-bottom: 1px solid #dadada;
    			clear: both;
    			color: #666;
    			font-size: 24px;
    			margin: 30px 0 0 0;
    			padding: 0;
    			padding-bottom: 7px;
    		}
    		#error-page {
    			margin-top: 50px;
    		}
    		#error-page p {
    			font-size: 14px;
    			line-height: 1.5;
    			margin: 25px 0 20px;
    		}
    		#error-page code {
    			font-family: Consolas, Monaco, monospace;
    		}
    		ul li {
    			margin-bottom: 10px;
    			font-size: 14px ;
    		}
    		a {
    			color: #0073aa;
    		}
    		a:hover,
    		a:active {
    			color: #00a0d2;
    		}
    		a:focus {
    			color: #124964;
    		    -webkit-box-shadow:
    		    	0 0 0 1px #5b9dd9,
    				0 0 2px 1px rgba(30, 140, 190, .8);
    		    box-shadow:
    		    	0 0 0 1px #5b9dd9,
    				0 0 2px 1px rgba(30, 140, 190, .8);
    			outline: none;
    		}
    		.button {
    			background: #f7f7f7;
    			border: 1px solid #ccc;
    			color: #555;
    			display: inline-block;
    			text-decoration: none;
    			font-size: 13px;
    			line-height: 26px;
    			height: 28px;
    			margin: 0;
    			padding: 0 10px 1px;
    			cursor: pointer;
    			-webkit-border-radius: 3px;
    			-webkit-appearance: none;
    			border-radius: 3px;
    			white-space: nowrap;
    			-webkit-box-sizing: border-box;
    			-moz-box-sizing:    border-box;
    			box-sizing:         border-box;
    
    			-webkit-box-shadow: 0 1px 0 #ccc;
    			box-shadow: 0 1px 0 #ccc;
    		 	vertical-align: top;
    		}
    
    		.button.button-large {
    			height: 30px;
    			line-height: 28px;
    			padding: 0 12px 2px;
    		}
    
    		.button:hover,
    		.button:focus {
    			background: #fafafa;
    			border-color: #999;
    			color: #23282d;
    		}
    
    		.button:focus  {
    			border-color: #5b9dd9;
    			-webkit-box-shadow: 0 0 3px rgba( 0, 115, 170, .8 );
    			box-shadow: 0 0 3px rgba( 0, 115, 170, .8 );
    			outline: none;
    		}
    
    		.button:active {
    			background: #eee;
    			border-color: #999;
    		 	-webkit-box-shadow: inset 0 2px 5px -3px rgba( 0, 0, 0, 0.5 );
    		 	box-shadow: inset 0 2px 5px -3px rgba( 0, 0, 0, 0.5 );
    		 	-webkit-transform: translateY(1px);
    		 	-ms-transform: translateY(1px);
    		 	transform: translateY(1px);
    		}
    
    			</style>
    </head>
    <body id="error-page">
    	<p></p></body>
    </html>

    I was made aware that it was this plugin causing the issue because my cron logs detected that the http_worker_cron caused the error to be output. I searched my root for http_worker_cron and it showed up in your MailChimp plugin. A quick google found this thread and Reüel’s solution did, in fact, fix the issue.

    We’ve had some cron syncing issues on our server but I’m not 100% sure if it’s connected but it is a concern that we’d like to fix to keep the site running well.

    Thank you,
    Anthony

    Hey @webassembler

    Thanks for chiming in here. I appreciate the additional detail on when this error occurs and exactly what you’re seeing in the output. I understand that this is something showing up in WP_Cron when the MailChimp For WooCommerce plugin is activated, so we can certainly pass it along to our team for a closer look.

    Just to be sure, have you noticed any unexpected behavior as a result of this error going on? Do you notice any issues with customers making a purchase, abandoned cart automations being triggered, or the initial installation’s sync of backfilling purchase data from WooCommerce to MailChimp? I’d like to gather as much information as possible on any unexpected behavior as a result of this error.

    Thanks again for all the helpful information. I’ll keep an eye on this thread for any further replies.

    – Malachite

    Hey @mcsupport

    I don’t think we’ve had any unexpected behaviour yet as I’ve just started to look into it but I can let you know next week.

    Thanks

    Thread Starter Reüel

    (@pronamic_reuel)

    I’m not aware of any “unexpected behaviour” either. I think the main issue is that you’re doing a wp_die() while executing cron events. Besides the fact that this results in an HTTP 500 in the access logs, which makes users like @webassembler and myself to think that there are PHP script execution errors that need to be investigated/resolved, it possibly also unnecessarily delays execution of other scheduled cron events until the next run of the cron. With hosts that only allow the cron to run twice an hour (e.g. @siteground), it would be nice if your plugin doesn’t suddenly stop cron execution only because your plugin has finished its own background tasks ??

    Hey @webassembler and @pronamic_reuel

    I appreciate the feedback there. Just wanted to check incase there were any other symptoms that would be useful to track on our end.

    For now, I’ll go ahead and pass this along to our team internally so we can get a closer look at the plugin code.

    While I can’t provide a firm ETA on when to expect updates, feel free to check back in here at any time to learn the latest on the situation.

    Thanks again for these insights,
    Malachite

    Hi, is this problem solved with new releases of th plug-in?

    we have the 2.1.2 version and we are still experiencig several WP cron HTTP 500 errors.

    we also tried to apply the fix suggested by Reüel, but the file wp-http-worker.php has changed and there is no handle_cron()

    thanks!

    Hey @bluoberon

    Sorry to hear you’re still encountering this. I’m afraid this issue is still outstanding, but you can track the progress of this on the plugin’s github page. If you’re able to provide any more details on error logging you’re seeing, that would also be very helpful in assisting our team in working towards a resolution. Here’s where this issue is being tracked on Github: https://github.com/mailchimp/mc-woocommerce/issues/143

    If you have any additional questions, don’t hesitate to let me know.
    – Malachite

    Hi Malachite,

    today we tried to turn the plugin off and fired the wp-cron several times… 100% worked, while during the night we got around 80% error 500.

    As you already know, the plugin is definitely doing something wrong with the wp-cron, I hope you can fix this soon, since the plugin itself is very useful, but we can not afford a non-working wp-cron.

    thanks.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘WP cron HTTP 500 because of wp_die()’ is closed to new replies.