3

我有一个在 Amazon EC2 实例上运行的 WordPress 站点,在过去的几周里,该站点大约每 3-4 天在清晨崩溃一次。我查看了 Apache 和 MYSQL 日志,看起来我遇到了反复出现的死锁。

以下是 Apache 日志中的代码示例:

[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

这在快速连续的情况下一遍又一遍地重复。
这是来自 SQL 日志的代码:

------------------------
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)

它也打印了一堆其他的东西,但我相信那是相关的代码。告诉我我是否错了,我也需要看看其他的东西。

自从提到它后,我怀疑它与 Jetpack 有关,所以我禁用了 Jetpack,但该网站仍然死机,尽管出现了更多神秘的错误。有人可以在这里给我任何见解吗?该网站已经运行了几个月,但这只是最近才开始发生的。我不确定为什么这是一个反复出现的问题。

另外,如果我应该将其发布在 WordPress stackexchange 上,请告诉我。

4

0 回答 0