3

I have a WordPress site running on an Amazon EC2 instance, and for the past couple weeks the site has been crashing early in the morning about every 3-4 days. I took a look at Apache and MYSQL logs and it looks like I am having a recurring deadlock.

Here is a sample of the code from the Apache log:

[Sun Feb 19 20:02:16.224985 2017] [:error] [pid 56] [client 191.96.249.70:42601] WordPress database error Deadlock found when trying to get lock; try restarting transaction for query DELETE FROM `wp_options` WHERE `option_name` = '_transient_jetpack_idc_allowed' made by include('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), include_once('/plugins/jetpack/jetpack.php'), require_once('/plugins/jetpack/class.jetpack-idc.php'), Jetpack_IDC::init, Jetpack_IDC->__construct, Jetpack::check_identity_crisis, Jetpack::validate_sync_error_idc_option, get_transient, delete_option

This repeats over and over again in quick succession.
And here is the code from the SQL logs:

------------------------
LATEST DETECTED DEADLOCK
------------------------
2017-02-19 20:02:16 0x7fc8b8734700
*** (1) TRANSACTION:
TRANSACTION 3450375, ACTIVE 0 sec starting index read
mysql tables in use 1, locked 1
LOCK WAIT 2 lock struct(s), heap size 1136, 1 row lock(s)
MySQL thread id 3, OS thread handle 140500064950016, query id 53 localhost sqluser updating
DELETE FROM `wp_options` WHERE `option_name` = '_transient_jetpack_idc_allowed'
*** (1) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 162 page no 49 n bits 400 index option_name of table `wordpress`.`wp_options` trx id 3450375 lock_mode X locks rec but not gap waiting
Record lock, heap no 325 PHYSICAL RECORD: n_fields 2; compact format; info bits 32
 0: len 30; hex 5f7472616e7369656e745f6a65747061636b5f6964635f616c6c6f776564; asc _transient_jetpack_idc_allowed;;
 1: len 8; hex 000000000000563c; asc       V<;;

*** (2) TRANSACTION:
TRANSACTION 3450373, ACTIVE 0 sec starting index read
mysql tables in use 1, locked 1
3 lock struct(s), heap size 1136, 2 row lock(s)
MySQL thread id 2, OS thread handle 140500064749312, query id 49 localhost sqluser updating
DELETE FROM `wp_options` WHERE `option_name` = '_transient_jetpack_idc_allowed'
*** (2) HOLDS THE LOCK(S):
RECORD LOCKS space id 162 page no 49 n bits 400 index option_name of table `wordpress`.`wp_options` trx id 3450373 lock_mode X locks rec but not gap
Record lock, heap no 325 PHYSICAL RECORD: n_fields 2; compact format; info bits 32
 0: len 30; hex 5f7472616e7369656e745f6a65747061636b5f6964635f616c6c6f776564; asc _transient_jetpack_idc_allowed;;
 1: len 8; hex 000000000000563c; asc       V<;;

*** (2) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 162 page no 49 n bits 400 index option_name of table `wordpress`.`wp_options` trx id 3450373 lock_mode X waiting
Record lock, heap no 325 PHYSICAL RECORD: n_fields 2; compact format; info bits 32
 0: len 30; hex 5f7472616e7369656e745f6a65747061636b5f6964635f616c6c6f776564; asc _transient_jetpack_idc_allowed;;
 1: len 8; hex 000000000000563c; asc       V<;;

*** WE ROLL BACK TRANSACTION (1)

It prints a bunch of other stuff too but I believe that is the relevant code. Tell me if I'm wrong and I need to look at other stuff too.

I suspected it had something to do with Jetpack since it was mentioned, so I disabled Jetpack, but the site still died albeit with more cryptic errors. Can somebody give me any insight here? The site has been up for several months but this just started happening recently. I'm not sure why it's a recurring issue.

Also, if I should instead be posting this on the WordPress stackexchange, let me know.

Peter Milionis
  • 103
  • 1
  • 6

0 Answers0