update_option() failing
-
Hi,
Whist working to diagnose an un-related CRON issue, we have noticed that quite a lot of Wordfence originating
update_option()
commands are failing. We found this by adding someerror_log()
and$wpdb->print_error()
to/wp-includes/option.php
.Here are some examples from debug.log …
[09-Mar-2023 23:41:27 UTC] Failed to save option "wordfence_syncAttackDataAttempts" to the wp_options table with value: 1 (integer) and old value: 0 (string) and error: [09-Mar-2023 23:41:27 UTC] WordPress database error for query UPDATE
wp_options
SEToption_value
= '1',autoload
= 'no' WHEREoption_name
= 'wordfence_syncAttackDataAttempts' made by require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('plugins_loaded'), WP_Hook->do_action, WP_Hook->apply_filters, wordfence::veryFirstAction, update_site_option, update_network_option, update_option [09-Mar-2023 23:43:18 UTC] Failed to save option "wordfence_syncAttackDataAttempts" to the wp_options table with value: 1 (integer) and old value: 0 (string) and error: [09-Mar-2023 23:43:18 UTC] WordPress database error for query UPDATEwp_options
SEToption_value
= '1',autoload
= 'no' WHEREoption_name
= 'wordfence_syncAttackDataAttempts' made by require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('plugins_loaded'), WP_Hook->do_action, WP_Hook->apply_filters, wordfence::veryFirstAction, update_site_option, update_network_option, update_option [10-Mar-2023 06:15:09 UTC] Failed to save option "wordfence_syncAttackDataAttempts" to the wp_options table with value: 2 (integer) and old value: 1 (string) and error: [10-Mar-2023 06:15:09 UTC] WordPress database error for query UPDATEwp_options
SEToption_value
= '2',autoload
= 'no' WHEREoption_name
= 'wordfence_syncAttackDataAttempts' made by require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('plugins_loaded'), WP_Hook->do_action, WP_Hook->apply_filters, wordfence::veryFirstAction, update_site_option, update_network_option, update_option [10-Mar-2023 06:15:45 UTC] Failed to save option "wordfence_syncAttackDataAttempts" to the wp_options table with value: 1 (integer) and old value: 0 (string) and error: [10-Mar-2023 06:15:45 UTC] WordPress database error for query UPDATEwp_options
SEToption_value
= '1',autoload
= 'no' WHEREoption_name
= 'wordfence_syncAttackDataAttempts' made by require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('plugins_loaded'), WP_Hook->do_action, WP_Hook->apply_filters, wordfence::veryFirstAction, update_site_option, update_network_option, update_optionInstead of the number of rows updated, false is returned by your
update_option()
request but no error is in$wpdb->print_error()
.Can you think of any reason why this might be happening? Could it be possible that one of these is true …
- Whilst
update_option()
is fired, the option has been deleted by another concurrent page load so theUPDATE
query has no option to update? - Whilst
update_option()
is fired, the option has already been updated by another concurrent page load so theUPDATE
query has nothing to update?
The site in question often receives Wordfence notifications like this (and the date / time of the attack matches the entries in debug.log) …
The Wordfence Web Application Firewall has blocked 483 attacks over the last 10 minutes. Below is a sample of these recent attacks:March 10, 2023 6:13am 146.190.86.194 (Singapore) Blocked for Known malicious User-Agents
March 10, 2023 6:13am 146.190.86.194 (Singapore) Blocked for Known malicious User-Agents
March 10, 2023 6:13am 146.190.86.194 (Singapore) Blocked for Known malicious User-Agents
March 10, 2023 6:13am 146.190.86.194 (Singapore) Blocked for Known malicious User-Agents
March 10, 2023 6:13am 146.190.86.194 (Singapore) Blocked for Known malicious User-Agents
March 10, 2023 6:13am 146.190.86.194 (Singapore) Blocked for Known malicious User-Agents
March 10, 2023 6:13am 146.190.86.194 (Singapore) Blocked for Known malicious User-Agents
March 10, 2023 6:13am 146.190.86.194 (Singapore) Blocked for Known malicious User-Agents
March 10, 2023 6:13am 146.190.86.194 (Singapore) Blocked for Known malicious User-Agents
March 10, 2023 6:13am 146.190.86.194 (Singapore) Blocked for Known malicious User-AgentsYour thoughts would be appreciated.
Thank you,
Oliver
- Whilst
- The topic ‘update_option() failing’ is closed to new replies.