Cron unschedule event error for hook
-
Is anyone else seeing errors like this in v6.1 (I think since v6.0.2 and v6.0.3) … ?
[09-Nov-2022 11:28:28 UTC] Cron unschedule event error for hook: do_pings, Error code: could_not_set, Error message: The cron event list could not be saved., Data: {“schedule”:false,”args”:[]}
[09-Nov-2022 18:05:03 UTC] Cron unschedule event error for hook: wordfence_processAttackData, Error code: could_not_set, Error message: The cron event list could not be saved., Data: {“schedule”:false,”args”:[]}Thank you,
Oliver
-
I really wanted to be able to reproduce this error.
I installed a clean version of WordPress 5.9.3 and a few plugins that create cron events.
I’ve then turned on error logging and upgraded the install to 6.1.1.
I then advanced the system clock by a week to force all cron events to fire.
Nothing. Nada. Not a peep out of debug.log.
I’ve submitted a ticket to trac https://core.trac.www.ads-software.com/ticket/57271#ticket
By the way … once the PHP error has appeared once for a given cron event on a given install … has anyone seen it appear again? I’m wondering if this is something being “tidied up” and once an event fires this error, it won’t happen again for that event?
Oliver
I’m seeing it reproduce the error multiple times. Here is one example of the same type of error being thrown over about a week.
[26-Nov-2022 21:00:03 UTC] Cron reschedule event error for hook: wp_privacy_delete_old_export_files, Error code: could_not_set, Error message: The cron event list could not be saved., Data: {"schedule":"hourly","args":[],"interval":3600} [27-Nov-2022 02:00:02 UTC] Cron reschedule event error for hook: wp_privacy_delete_old_export_files, Error code: could_not_set, Error message: The cron event list could not be saved., Data: {"schedule":"hourly","args":[],"interval":3600} [27-Nov-2022 05:00:03 UTC] Cron reschedule event error for hook: wp_privacy_delete_old_export_files, Error code: could_not_set, Error message: The cron event list could not be saved., Data: {"schedule":"hourly","args":[],"interval":3600} [27-Nov-2022 08:00:03 UTC] Cron reschedule event error for hook: wp_privacy_delete_old_export_files, Error code: could_not_set, Error message: The cron event list could not be saved., Data: {"schedule":"hourly","args":[],"interval":3600} [27-Nov-2022 18:00:02 UTC] Cron reschedule event error for hook: wp_privacy_delete_old_export_files, Error code: could_not_set, Error message: The cron event list could not be saved., Data: {"schedule":"hourly","args":[],"interval":3600} [27-Nov-2022 19:00:01 UTC] Cron reschedule event error for hook: wp_privacy_delete_old_export_files, Error code: could_not_set, Error message: The cron event list could not be saved., Data: {"schedule":"hourly","args":[],"interval":3600} [29-Nov-2022 02:00:01 UTC] Cron reschedule event error for hook: wp_privacy_delete_old_export_files, Error code: could_not_set, Error message: The cron event list could not be saved., Data: {"schedule":"hourly","args":[],"interval":3600} [29-Nov-2022 05:00:03 UTC] Cron reschedule event error for hook: wp_privacy_delete_old_export_files, Error code: could_not_set, Error message: The cron event list could not be saved., Data: {"schedule":"hourly","args":[],"interval":3600} [30-Nov-2022 17:00:03 UTC] Cron reschedule event error for hook: wp_privacy_delete_old_export_files, Error code: could_not_set, Error message: The cron event list could not be saved., Data: {"schedule":"hourly","args":[],"interval":3600} [02-Dec-2022 05:00:03 UTC] Cron reschedule event error for hook: wp_privacy_delete_old_export_files, Error code: could_not_set, Error message: The cron event list could not be saved., Data: {"schedule":"hourly","args":[],"interval":3600} [02-Dec-2022 13:00:03 UTC] Cron reschedule event error for hook: wp_privacy_delete_old_export_files, Error code: could_not_set, Error message: The cron event list could not be saved., Data: {"schedule":"hourly","args":[],"interval":3600} [02-Dec-2022 18:00:03 UTC] Cron reschedule event error for hook: wp_privacy_delete_old_export_files, Error code: could_not_set, Error message: The cron event list could not be saved., Data: {"schedule":"hourly","args":[],"interval":3600}
OK, noted. I’m not actually seeing that here. So that’s interesting.
By any chance are there multiple events for that hook in your database? Does WP Crontrol plug-in show multip events?
Do you happen to know if WordPress schedules
wp_privacy_delete_old_export_files
automatically or only when users files have been exported?Thanks.
There’s no fix yet (as far as I know the cause still hasn’t been found) but … the good news is that so far there’s no evidence that CRON schedules aren’t running as normal. No one has yet reported a CRON event fail as a direct result of this issue.
I believe the advice for now is to ignore the notices.
Oliver
Just to update this thread, I am now confident I know what’s causing the issue (thanks to @j3gaming pointing me to thinking the issue might be database related). I have updated the ticket on trac accordingly.
Oliver
Thanks @j3gaming, I’ve added some context to your ticket because I believe it may be relevant to your problem. I am still waiting for my main site to produce the
could_not_set
error again so that I can analyse any database errors / race conditions. I expect the error to appear again and will update this thread when it does.If anyone wants to speed up this diagnosis … feel free to change lines 520-523 of
/wp-includes/option.php
to …$wpdb->show_errors(); $result = $wpdb->update( $wpdb->options, $update_args, array( 'option_name' => $option ) ); if ( ! $result ) { if ( 'cron' === $option ) { error_log('Failed to save option "' . $option . '" to the wp_options table with value: ' . print_r($value, true) . ' (' . gettype($value) . ') and old value: ' . print_r($old_value, true) . ' (' . gettype($old_value) . ') and error: ' . $wpdb->last_error); $wpdb->print_error(); } return false; }
… and let me know what you get in
/wp-content/debug.log
Oliver
@domainsupport Got it
[16-Mar-2023 03:00:01 UTC] Failed to save option "cron" to the wp_options table with value: Array ( [1678935572] => Array ( [crontrol_cron_job] => Array ( [1a7c44f6bc8763ba9b13e29c22374480] => Array ( [schedule] => minutely [args] => Array ( [code] => require_once('wp-content/cron/email_send.php'); [name] => Send Emails ) [interval] => 60 ) ) ) [1678935600] => Array ( [crontrol_cron_job] => Array ( [63da9588156a987fc2e96975691b9427] => Array ( [schedule] => daily [args] => Array ( [code] => require_once('wp-content/cron/expense_pdf.php'); [name] => Generate Expense PDFs ) [interval] => 86400 ) ) ) [1678935632] => Array ( [crontrol_cron_job] => Array ( [1a7c44f6bc8763ba9b13e29c22374480] => Array ( [schedule] => minutely [args] => Array ( [code] => require_once('wp-content/cron/email_send.php'); [name] => Send Emails ) [interval] => 60 ) ) ) [1678935965] => Array ( [crontrol_cron_job] => Array ( [c5a124df7ffc768428c29928207bd5ea] => Array ( [schedule] => every10minutes [args] => Array ( [code] => require_once('wp-content/cron/email_create.php'); [name] => Visit Pages, create emails ) [interval] => 600 ) ) ) [1678936176] => Array ( [wp_update_themes] => Array ( [40cd750bba9870f18aada2478b24840a] => Array ( [schedule] => twicedaily [args] => Array ( ) [interval] => 43200 ) ) [wp_version_check] => Array ( [40cd750bba9870f18aada2478b24840a] => Array ( [schedule] => twicedaily [args] => Array ( ) [interval] => 43200 ) ) ) [1678936210] => Array ( [updraftplus_clean_temporary_files] => Array ( [40cd750bba9870f18aada2478b24840a] => Array ( [schedule] => twicedaily [args] => Array ( ) [interval] => 43200 ) ) ) [1678936261] => Array ( [wp_privacy_delete_old_export_files] => Array ( [40cd750bba9870f18aada2478b24840a] => Array ( [schedule] => hourly [args] => Array ( ) [interval] => 3600 ) ) ) [1678936262] => Array ( [wp_update_plugins] => Array ( [40cd750bba9870f18aada2478b24840a] => Array ( [schedule] => twicedaily [args] => Array ( ) [interval] => 43200 ) ) ) [1678938328] => Array ( [crontrol_cron_job] => Array ( [bb9f4f2851baacef069c58263db7ece0] => Array ( [schedule] => hourly [args] => Array ( [code] => require_once('wp-content/cron/timesheet_data.php'); [name] => Process Timesheet Data ) [interval] => 3600 ) ) ) [1678938652] => Array ( [crontrol_cron_job] => Array ( [0e38b5f00429375214e3724e7bd79667] => Array ( [schedule] => hourly [args] => Array ( [code] => require_once('wp-content/cron/ha_data.php'); [name] => Process HA Data ) [interval] => 3600 ) ) ) [1678944378] => Array ( [wp_update_user_counts] => Array ( [40cd750bba9870f18aada2478b24840a] => Array ( [schedule] => twicedaily [args] => Array ( ) [interval] => 43200 ) ) ) [1678950000] => Array ( [crontrol_cron_job] => Array ( [f300f7f2a16d40298c6a47e56fe4743f] => Array ( [schedule] => daily [args] => Array ( [code] => require_once('wp-content/cron/ha_analysis.php'); [name] => HA Analysis ) [interval] => 86400 ) ) ) [1678950001] => Array ( [crontrol_cron_job] => Array ( [520211849dc3302397985c098960f252] => Array ( [schedule] => daily [args] => Array ( [code] => require_once('wp-content/cron/dailylogs.php'); [name] => Daily Logs ) [interval] => 86400 ) ) ) [1678963758] => Array ( [wp_https_detection] => Array ( [40cd750bba9870f18aada2478b24840a] => Array ( [schedule] => twicedaily [args] => Array ( ) [interval] => 43200 ) ) ) [1678969800] => Array ( [crontrol_cron_job] => Array ( [dbf8b89544bd37e9d4df248597362f45] => Array ( [schedule] => daily [args] => Array ( [code] => require_once('wp-content/cron/missing_ha.php'); [name] => Missing HA with Timesheet ) [interval] => 86400 ) ) ) [1678979390] => Array ( [delete_expired_transients] => Array ( [40cd750bba9870f18aada2478b24840a] => Array ( [schedule] => daily [args] => Array ( ) [interval] => 86400 ) ) ) [1678980304] => Array ( [recovery_mode_clean_expired_keys] => Array ( [40cd750bba9870f18aada2478b24840a] => Array ( [schedule] => daily [args] => Array ( ) [interval] => 86400 ) ) ) [1678982428] => Array ( [wp_scheduled_delete] => Array ( [40cd750bba9870f18aada2478b24840a] => Array ( [schedule] => daily [args] => Array ( ) [interval] => 86400 ) ) ) [1678983579] => Array ( [wp_scheduled_auto_draft_delete] => Array ( [40cd750bba9870f18aada2478b24840a] => Array ( [schedule] => daily [args] => Array ( ) [interval] => 86400 ) ) ) [1679080880] => Array ( [wp_site_health_scheduled_check] => Array ( [40cd750bba9870f18aada2478b24840a] => Array ( [schedule] => weekly [args] => Array ( ) [interval] => 604800 ) ) ) [1679317200] => Array ( [crontrol_cron_job] => Array ( [ae9e5f83cd3bc516206598c5e13f24d8] => Array ( [schedule] => weekly [args] => Array ( [code] => require_once('wp-content/cron/end_of_week_email.php'); [name] => End of Week Emails ) [interval] => 604800 ) ) ) [1679402700] => Array ( [crontrol_cron_job] => Array ( [8258fef7e673779075aa8570e56f905c] => Array ( [schedule] => weekly [args] => Array ( [code] => require_once('wp-content/cron/timesheet_approvals.php'); [name] => Timesheet Approval Reminder ) [interval] => 604800 ) ) ) [version] => 2 ) (array) and old value: Array ( [1678935572] => Array ( [crontrol_cron_job] => Array ( [1a7c44f6bc8763ba9b13e29c22374480] => Array ( [schedule] => minutely [args] => Array ( [code] => require_once('wp-content/cron/email_send.php'); [name] => Send Emails ) [interval] => 60 ) ) ) [1678935600] => Array ( [crontrol_cron_job] => Array ( [63da9588156a987fc2e96975691b9427] => Array ( [schedule] => daily [args] => Array ( [code] => require_once('wp-content/cron/expense_pdf.php'); [name] => Generate Expense PDFs ) [interval] => 86400 ) ) ) [1678935965] => Array ( [crontrol_cron_job] => Array ( [c5a124df7ffc768428c29928207bd5ea] => Array ( [schedule] => every10minutes [args] => Array ( [code] => require_once('wp-content/cron/email_create.php'); [name] => Visit Pages, create emails ) [interval] => 600 ) ) ) [1678936176] => Array ( [wp_update_themes] => Array ( [40cd750bba9870f18aada2478b24840a] => Array ( [schedule] => twicedaily [args] => Array ( ) [interval] => 43200 ) ) [wp_version_check] => Array ( [40cd750bba9870f18aada2478b24840a] => Array ( [schedule] => twicedaily [args] => Array ( ) [interval] => 43200 ) ) ) [1678936210] => Array ( [updraftplus_clean_temporary_files] => Array ( [40cd750bba9870f18aada2478b24840a] => Array ( [schedule] => twicedaily [args] => Array ( ) [interval] => 43200 ) ) ) [1678936261] => Array ( [wp_privacy_delete_old_export_files] => Array ( [40cd750bba9870f18aada2478b24840a] => Array ( [schedule] => hourly [args] => Array ( ) [interval] => 3600 ) ) ) [1678936262] => Array ( [wp_update_plugins] => Array ( [40cd750bba9870f18aada2478b24840a] => Array ( [schedule] => twicedaily [args] => Array ( ) [interval] => 43200 ) ) ) [1678938328] => Array ( [crontrol_cron_job] => Array ( [bb9f4f2851baacef069c58263db7ece0] => Array ( [schedule] => hourly [args] => Array ( [code] => require_once('wp-content/cron/timesheet_data.php'); [name] => Process Timesheet Data ) [interval] => 3600 ) ) ) [1678938652] => Array ( [crontrol_cron_job] => Array ( [0e38b5f00429375214e3724e7bd79667] => Array ( [schedule] => hourly [args] => Array ( [code] => require_once('wp-content/cron/ha_data.php'); [name] => Process HA Data ) [interval] => 3600 ) ) ) [1678944378] => Array ( [wp_update_user_counts] => Array ( [40cd750bba9870f18aada2478b24840a] => Array ( [schedule] => twicedaily [args] => Array ( ) [interval] => 43200 ) ) ) [1678950000] => Array ( [crontrol_cron_job] => Array ( [f300f7f2a16d40298c6a47e56fe4743f] => Array ( [schedule] => daily [args] => Array ( [code] => require_once('wp-content/cron/ha_analysis.php'); [name] => HA Analysis ) [interval] => 86400 ) ) ) [1678950001] => Array ( [crontrol_cron_job] => Array ( [520211849dc3302397985c098960f252] => Array ( [schedule] => daily [args] => Array ( [code] => require_once('wp-content/cron/dailylogs.php'); [name] => Daily Logs ) [interval] => 86400 ) ) ) [1678963758] => Array ( [wp_https_detection] => Array ( [40cd750bba9870f18aada2478b24840a] => Array ( [schedule] => twicedaily [args] => Array ( ) [interval] => 43200 ) ) ) [1678969800] => Array ( [crontrol_cron_job] => Array ( [dbf8b89544bd37e9d4df248597362f45] => Array ( [schedule] => daily [args] => Array ( [code] => require_once('wp-content/cron/missing_ha.php'); [name] => Missing HA with Timesheet ) [interval] => 86400 ) ) ) [1678979390] => Array ( [delete_expired_transients] => Array ( [40cd750bba9870f18aada2478b24840a] => Array ( [schedule] => daily [args] => Array ( ) [interval] => 86400 ) ) ) [1678980304] => Array ( [recovery_mode_clean_expired_keys] => Array ( [40cd750bba9870f18aada2478b24840a] => Array ( [schedule] => daily [args] => Array ( ) [interval] => 86400 ) ) ) [1678982428] => Array ( [wp_scheduled_delete] => Array ( [40cd750bba9870f18aada2478b24840a] => Array ( [schedule] => daily [args] => Array ( ) [interval] => 86400 ) ) ) [1678983579] => Array ( [wp_scheduled_auto_draft_delete] => Array ( [40cd750bba9870f18aada2478b24840a] => Array ( [schedule] => daily [args] => Array ( ) [interval] => 86400 ) ) ) [1679080880] => Array ( [wp_site_health_scheduled_check] => Array ( [40cd750bba9870f18aada2478b24840a] => Array ( [schedule] => weekly [args] => Array ( ) [interval] => 604800 ) ) ) [1679317200] => Array ( [crontrol_cron_job] => Array ( [ae9e5f83cd3bc516206598c5e13f24d8] => Array ( [schedule] => weekly [args] => Array ( [code] => require_once('wp-content/cron/end_of_week_email.php'); [name] => End of Week Emails ) [interval] => 604800 ) ) ) [1679402700] => Array ( [crontrol_cron_job] => Array ( [8258fef7e673779075aa8570e56f905c] => Array ( [schedule] => weekly [args] => Array ( [code] => require_once('wp-content/cron/timesheet_approvals.php'); [name] => Timesheet Approval Reminder ) [interval] => 604800 ) ) ) [version] => 2 ) (array) and error: [16-Mar-2023 03:00:01 UTC] WordPress database error for query UPDATE
wp_dev_options
SEToption_value
= 'a:23:{i:1678935572;a:1:{s:17:\"crontrol_cron_job\";a:1:{s:32:\"1a7c44f6bc8763ba9b13e29c22374480\";a:3:{s:8:\"schedule\";s:8:\"minutely\";s:4:\"args\";a:2:{s:4:\"code\";s:47:\"require_once(\'wp-content/cron/email_send.php\');\";s:4:\"name\";s:11:\"Send Emails\";}s:8:\"interval\";s:2:\"60\";}}}i:1678935600;a:1:{s:17:\"crontrol_cron_job\";a:1:{s:32:\"63da9588156a987fc2e96975691b9427\";a:3:{s:8:\"schedule\";s:5:\"daily\";s:4:\"args\";a:2:{s:4:\"code\";s:48:\"require_once(\'wp-content/cron/expense_pdf.php\');\";s:4:\"name\";s:21:\"Generate Expense PDFs\";}s:8:\"interval\";i:86400;}}}i:1678935632;a:1:{s:17:\"crontrol_cron_job\";a:1:{s:32:\"1a7c44f6bc8763ba9b13e29c22374480\";a:3:{s:8:\"schedule\";s:8:\"minutely\";s:4:\"args\";a:2:{s:4:\"code\";s:47:\"require_once(\'wp-content/cron/email_send.php\');\";s:4:\"name\";s:11:\"Send Emails\";}s:8:\"interval\";s:2:\"60\";}}}i:1678935965;a:1:{s:17:\"crontrol_cron_job\";a:1:{s:32:\"c5a124df7ffc768428c29928207bd5ea\";a:3:{s:8:\"schedule\";s:14:\"every10minutes\";s:4:\"args\";a:2:{s:4:\"code\";s:49:\"require_once(\'wp-content/cron/email_create.php\');\";s:4:\"name\";s:26:\"Visit Pages, create emails\";}s:8:\"interval\";i:600;}}}i:1678936176;a:2:{s:16:\"wp_update_themes\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:10:\"twicedaily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:43200;}}s:16:\"wp_version_check\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:10:\"twicedaily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:43200;}}}i:1678936210;a:1:{s:33:\"updraftplus_clean_temporary_files\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:10:\"twicedaily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:43200;}}}i:1678936261;a:1:{s:34:\"wp_privacy_delete_old_export_files\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:6:\"hourly\";s:4:\"args\";a:0:{}s:8:\"interval\";i:3600;}}}i:1678936262;a:1:{s:17:\"wp_update_plugins\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:10:\"twicedaily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:43200;}}}i:1678938328;a:1:{s:17:\"crontrol_cron_job\";a:1:{s:32:\"bb9f4f2851baacef069c58263db7ece0\";a:3:{s:8:\"schedule\";s:6:\"hourly\";s:4:\"args\";a:2:{s:4:\"code\";s:51:\"require_once(\'wp-content/cron/timesheet_data.php\');\";s:4:\"name\";s:22:\"Process Timesheet Data\";}s:8:\"interval\";i:3600;}}}i:1678938652;a:1:{s:17:\"crontrol_cron_job\";a:1:{s:32:\"0e38b5f00429375214e3724e7bd79667\";a:3:{s:8:\"schedule\";s:6:\"hourly\";s:4:\"args\";a:2:{s:4:\"code\";s:44:\"require_once(\'wp-content/cron/ha_data.php\');\";s:4:\"name\";s:15:\"Process HA Data\";}s:8:\"interval\";i:3600;}}}i:1678944378;a:1:{s:21:\"wp_update_user_counts\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:10:\"twicedaily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:43200;}}}i:1678950000;a:1:{s:17:\"crontrol_cron_job\";a:1:{s:32:\"f300f7f2a16d40298c6a47e56fe4743f\";a:3:{s:8:\"schedule\";s:5:\"daily\";s:4:\"args\";a:2:{s:4:\"code\";s:48:\"require_once(\'wp-content/cron/ha_analysis.php\');\";s:4:\"name\";s:11:\"HA Analysis\";}s:8:\"interval\";i:86400;}}}i:1678950001;a:1:{s:17:\"crontrol_cron_job\";a:1:{s:32:\"520211849dc3302397985c098960f252\";a:3:{s:8:\"schedule\";s:5:\"daily\";s:4:\"args\";a:2:{s:4:\"code\";s:46:\"require_once(\'wp-content/cron/dailylogs.php\');\";s:4:\"name\";s:10:\"Daily Logs\";}s:8:\"interval\";i:86400;}}}i:1678963758;a:1:{s:18:\"wp_https_detection\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:10:\"twicedaily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:43200;}}}i:1678969800;a:1:{s:17:\"crontrol_cron_job\";a:1:{s:32:\"dbf8b89544bd37e9d4df248597362f45\";a:3:{s:8:\"schedule\";s:5:\"daily\";s:4:\"args\";a:2:{s:4:\"code\";s:47:\"require_once(\'wp-content/cron/missing_ha.php\');\";s:4:\"name\";s:25:\"Missing HA with Timesheet\";}s:8:\"interval\";i:86400;}}}i:1678979390;a:1:{s:25:\"delete_expired_transients\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:5:\"daily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:86400;}}}i:1678980304;a:1:{s:32:\"recovery_mode_clean_expired_keys\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:5:\"daily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:86400;}}}i:1678982428;a:1:{s:19:\"wp_scheduled_delete\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:5:\"daily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:86400;}}}i:1678983579;a:1:{s:30:\"wp_scheduled_auto_draft_delete\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:5:\"daily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:86400;}}}i:1679080880;a:1:{s:30:\"wp_site_health_scheduled_check\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:6:\"weekly\";s:4:\"args\";a:0:{}s:8:\"interval\";i:604800;}}}i:1679317200;a:1:{s:17:\"crontrol_cron_job\";a:1:{s:32:\"ae9e5f83cd3bc516206598c5e13f24d8\";a:3:{s:8:\"schedule\";s:6:\"weekly\";s:4:\"args\";a:2:{s:4:\"code\";s:54:\"require_once(\'wp-content/cron/end_of_week_email.php\');\";s:4:\"name\";s:18:\"End of Week Emails\";}s:8:\"interval\";i:604800;}}}i:1679402700;a:1:{s:17:\"crontrol_cron_job\";a:1:{s:32:\"8258fef7e673779075aa8570e56f905c\";a:3:{s:8:\"schedule\";s:6:\"weekly\";s:4:\"args\";a:2:{s:4:\"code\";s:56:\"require_once(\'wp-content/cron/timesheet_approvals.php\');\";s:4:\"name\";s:27:\"Timesheet Approval Reminder\";}s:8:\"interval\";i:604800;}}}s:7:\"version\";i:2;}' WHEREoption_name
= 'cron' made by wp_reschedule_event, wp_schedule_event, _set_cron_array, update_option [16-Mar-2023 03:00:01 UTC] Cron reschedule event error for hook: crontrol_cron_job, Error code: could_not_set, Error message: The cron event list could not be saved. true false, Data: {"schedule":"minutely","args":{"code":"require_once('wp-content\/cron\/email_send.php');","name":"Send Emails"},"interval":"60"}Thank you @j3gaming, that’s perfect.
This is trying to add (reschedule probably in your case) a new schedule as follows …
[1678935632] => Array ( [crontrol_cron_job] => Array ( [1a7c44f6bc8763ba9b13e29c22374480] => Array ( [schedule] => minutely [args] => Array ( [code] => require_once('wp-content/cron/email_send.php'); [name] => Send Emails ) [interval] => 60 ) ) )
Now we know that it’s failed. We also know that it’s failed due to some kind of database issue … BUT the $wpdb->last_error is empty so I’m absolutely convinced that this …
However, it doesn’t do this [outputting messages when errors occur] when the database connection is lost, in which case, I retries, and the dies if unsuccessful.
@galbaras… is what’s causing both your problem (events not being re-scheduled) and the original
could_not_set
errors that this thread is about.I would suggest that two things need to be done …
- The proposed solution in this comment should be developed ASAP
- If you are receiving this error then it’s almost certain that you have some kind of intermittent database issue (such as the one you have where your database gets locked up when you run a backup) which you should diagnose and find a way to overcome. For example, I’m still waiting for our main site to throw another “could_not_set” error so that I can take a look at the MySQL logs to see if there was an outage at the same time.
So … we’re getting somewhere! ??
Oliver
@domainsupport None taken, I have a better spot for logging anyway.
wp-cron.php near the bottom of the loop and file you’ll find:
// If the hook ran too long and another cron process stole the lock, quit.
if ( _get_cron_lock() !== $doing_wp_cron ) {
return;
}Make it this:
// If the hook ran too long and another cron process stole the lock, quit.
if ( _get_cron_lock() !== $doing_wp_cron ) {
debug_log("Double cron run detected. Exit!");
return;
}If we have seperate problems, you should never see this log. If it happens with the could_not_set afterwards, then our issues are the same.
- This reply was modified 1 year, 8 months ago by j3gaming.
@j3gaming OK, I like that ??
I’ve added that to the site and will report back when we get another
could_not_set
notice. It’s been quite some time since the last one, though, so this may be a few days wait.Just got my first …
[18-Mar-2023 15:17:33 UTC] Double cron run detected. Exit!
… but not in conjunction with a
could_not_set
error (or any error for that matter). There was a suspected DDOS going on at around that time I think however which may account for a concurrent cron firing.Oliver
@joehfresh Few things for you to look into …
- It’s now looking very likely that this issue is being caused by intermittent database / database connection issues so ask your host if there is any evidence of database outage around the time of the cron notices.
- When this happens the updated cron schedule cannot be saved to the database. This means that the re-scheduled event cannot be added which looks like it’s been deleted (it hasn’t, it’s run but it’s just not able to be re-scheduled).
- If you are adding your tasks yourself, make sure you add a check to make sure it’s added if it doesn’t exist. This will allow WordPress to add the task again if it is unable to be re-scheduled in the future.
if ( ! wp_next_scheduled( 'bl_cron_hook' ) ) { wp_schedule_event( time(), 'five_seconds', 'bl_cron_hook' ); }
Oliver
@me240 We also looked into concurrent cron firing being the cause but ruled that out for the following reasons …
- WP Cron firing is locked using a transient and duplicates would be almost impossible unless transients are disabled on your site or the requests were fired at exactly the same microsecond.
- The later was ruled out because the issue presents itself on low traffic sites as well as sites that fire their cron via the system rather than user traffic.
Our research has concluded that this issue occurs when the database is overloaded or disconnected for whatever reason.
Oliver
@domainsupport That’s not true. You don’t need it firing on the same microsecond. You just need both firing before the first database write for the transient. I proved it with some logging on my trac ticket.
@j3gaming I’m afraid I cannot concur with your findings as I’ve not been able to reproduce them.
But … if what you are describing is true then it would be because transients are stored in the database
wp_options
table so if your transient isn’t able to be stored then that just points to a database issue again.Also, have you managed to work out how your CRON is firing concurrently when it’s fired by the system rather than page requests?
Did you find out why running a backup locks up your database yet?
We have recently moved from request fired CRON to system fired CRON with public requests to
wp-cron.php
blocked and have (as yet) had no CRON rated issues such as those mentioned here or otherwise.
- The topic ‘Cron unschedule event error for hook’ is closed to new replies.