当前位置:   article > 正文

生产异常 Cause: com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Lock wait timeout exceed_nested exception is com.mysql.cj.jdbc.exceptions.m

nested exception is com.mysql.cj.jdbc.exceptions.mysqltransactionrollbackexc

1、程序中报错日志:

  1. Cause: com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException:
  2. Lock wait timeout exceeded; try restarting transaction;
  3. Lock wait timeout exceeded; try restarting transaction;
  4. nested exception is com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException:
  5. Lock wait timeout exceeded; try restarting transaction

 

 

  1. 2、查看未提交事务:
  2. select * from information_schema.INNODB_TRX;
  3. SELECT
  4. a.id,a.user,a.host,b.trx_started,b.trx_query
  5. FROM information_schema.processlist a RIGHT OUTER JOIN information_schema.innodb_trx b
  6. ON a.id = b.trx_mysql_thread_id;

 

 

 

 

3、手动执行该update语句,失败,等待锁超时:

  1. update orders set *** where id='79302e18a8e848ccb2323c48ca4ca349';
  2. update orders set *** where id='aeff09dbbc1a4668bf959f675d536ece';

 

4、由于是生产,急需处理业务数据,所以临时解决方案,是先kill 掉,未能提交事务的线程,

kill  trx_mysql_thread_id(上图中的trx_mysql_thread_id是10, 所以 执行  kill  10

目前的解决方案,就是手动kill掉长期挂起,未提交的事务。

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/爱喝兽奶帝天荒/article/detail/987387
推荐阅读
相关标签
  

闽ICP备14008679号