Background of the issue:
[Wed Jun 04 11:31:29.227590 2025] [proxy_fcgi:error] [pid 2722242:tid 139851290625792] [client xxx:xxx] AH01071: Got error 'PHP message: WordPress database error Deadlock found when trying to get lock; try restarting transaction for query INSERT IGNORE INTO wp_options ( `option_name`, `option_value`, `autoload` ) VALUES ('wpml.WPML\\TM\\Settings\\ProcessNewTranslatableFields.lock', '1749029489', 'no') /* LOCK */ made by require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('wp_loaded'), WP_Hook->do_action, WP_Hook->apply_filters, WPML\LIB\WP\Hooks::WPML\LIB\WP\{closure}, WPML\FP\Promise->resolve, WPML\FP\Right->chain, WPML\FP\Right->map, WPML\BackgroundTask\BackgroundTaskLoader->WPML\BackgroundTask\{closure}, WPML\BackgroundTask\BackgroundTaskLoader->getSerializedTasks, WPML\FP\Fns::__callStatic, call_user_func_array, WPML\FP\Fns::WPML\FP\{closure}, call_user_func_array, WPML\FP\Fns::WPML\FP\{closure}, array_map, WPML\BackgroundTask\BackgroundTaskLoader->WPML\BackgroundTask\{closure}, WPML\BackgroundTask\BackgroundTaskViewModel::get, WPML\Utilities\Lock->create, WPML\Uti...', referer: hidden link
We are seeing a lot of these in the error log. When the db deadlock happens, WordPress is inaccessible for 3-4 minutes. We would like to understand what is going on by means of the following questions
1. The referrer is a post.php with action=edit. Does WPML need to launch a background task during a post edit? Can we disable WPML background tasks? What are the implications?
2. It is clear that the contention is happening with the key option_name with value "wpml.WPML\\TM\\Settings\\ProcessNewTranslatableFields.lock" - could you kindly explain what are Translatable Fields in the context of editing a post? Many posts edits are racing for the lock with that key given the INSERT IGNORE will lock the row before update if it already exists.
Thank you,
Reuben
Symptoms:
WordPress database error: Deadlock found when trying to get lock; try restarting transaction. This occurs during a post edit and makes WordPress inaccessible for 3-4 minutes.
Questions:
Does WPML need to launch a background task during a post edit?
Can we disable WPML background tasks? What are the implications?
What are Translatable Fields in the context of editing a post, and why are many post edits racing for the lock with the key 'wpml.WPML\TM\Settings\ProcessNewTranslatableFields.lock'?