踩坑记录:MySQLTransactionRollbackException: Deadlock..
DeadlockLoserDataAccessException: ### Error updating database. Cause: com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Deadlock found...
·
ERROR sn(ls8-resource-server) hn(mdw) c.i.i.i.t.c.BeforeWfFeeController:61 - 发送失败
org.springframework.dao.DeadlockLoserDataAccessException:
### Error updating database. Cause:
com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Deadlock found when trying
to get lock; try restarting transaction
### The error may exist in com/**/FeeXXMapper.java (best guess)
### The error may involve com.**.mapper.FeeXXMapper.batchInsert-Inline
### The error occurred while setting parameters
### SQL: insert into
fee_xx_item(id,apply_id,apply_detail_id,parent_apply_id,parent_apply_detail_id,parent_apply
_detail_item_id,fee_code,fee_calibre,consumption_object,apply_amount,approval_amount,ext_in
fo,complete_flag,fee_control_id,seq,enable_this_product,this_product_illustrate,product_cod
e,frozen_amount,enable_frozen) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
### Cause: com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Deadlock found
when trying to get lock; try restarting transaction
; Deadlock found when trying to get lock; try restarting transaction; nested exception is
com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Deadlock found when trying
to get lock; try restarting transaction
最近在做压测时遇到MySQLTransactionRollbackException: Deadlock...的问题,经排查发生的原因是:在接口中使用Transactional注解,且该接口的业务逻辑夹杂在两个或多个mapper(泛指对数据库的增删改)方法中间,业务逻辑处理时间长,高并发的状态下则会导致TransactionRollbackException,所以需要将与数据库操作的增删改方法都统一放在接口的最后。
更多推荐
已为社区贡献1条内容
所有评论(0)