首页 > 其他分享 >Lock wait timeout exceeded; try restarting transaction临时解决办法

Lock wait timeout exceeded; try restarting transaction临时解决办法

时间:2023-10-18 14:37:06浏览次数:54  
标签:transaction Lock try restarting timeout exceeded wait

错误日志

Error updating database.  Cause: com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Lock wait timeout exceeded; try restarting transaction### The error may involve com.zhonghe.userim.dao.mysql.CrmRoleDao.updateById-Inline### SQL: UPDATE crm_role  SET content_permission=?, name=?, `description`=?, self_apply_status=?,  updated_at=?  WHERE id=?; Lock wait timeout exceeded; try restarting transaction; nested exception is com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Lock wait timeout exceeded; try restarting transactionat org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:262)at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:88)

查看事务

-- 当前运行的所有事务
SELECT * from information_schema.innodb_trx;

sql

/*PROXY:10.0.6.249,d2fd98510040000*/ DELETE 
FROM
	crm_role_permission 
WHERE
	id IN (
		4749806,
		4749813,
		4749820,
		4749827,
		4749834,
		4749841,
		4749848,
		4749855,
		4749862,
		4749869,
		4749876,
		4749883,
		4749890,
		4749897,
		4749904,
		4749911,
		4749918,
		4749925,
		4749932,
		4749939,
		4749946,
		4749953,
		4749960,
		4749967,
		4749974,
		4749981,
		4749988,
		4749995,
		4750002,
		4750009,
		4750016,
		4750023,
		4750030,
		4750037,
		4750044,
		4750051,
		4750058,
		4750065,
		4750072,
		4750079,
		4750086,
		4750093,
		4750100,
		4750107,
		4750114,
		4750121,
		4750128,
		4750135,
		4750142,
		4750149,
		4750156,
		4750163,
		4750170,
		4750177,
		4750184,
		4750191,
		4750198,
		4750205,
		4750212,
		4750219,
		4750226,
		4750233,
		4750240,
		4750247,
		4750254,
		4750261,
		4750268,
		4750275,
		4750282,
		4750289,
		4750296,
		4750303,
		4750310,
		4750317,
		4750324,
		4750331,
		4750338,
	4750345,
	4750)

杀掉事物

-- kill 线程ID(trx_mysql_thread_id)
kill 8375425;

只是临时解决, 根本还是需要优化代码

标签:transaction,Lock,try,restarting,timeout,exceeded,wait
From: https://www.cnblogs.com/zhangxl1016/p/17772251.html

相关文章

  • Program does not contain a static 'Main' method suitable for an entry point
    http://www.kangry.net/blog/?article_id=391&type=article修改办法,对着项目右键-》属性-》application-》outputtype设为ClassLibrary即可。  ......
  • Japan Registry Services (JPRS) Programming Contest 2023 (AtCoder Beginner Contes
    JapanRegistryServices(JPRS)ProgrammingContest2023(AtCoderBeginnerContest324)赛后总结可悲的是:我没来得及写题解。T1Same秒切。直接输入排一遍序再遍历即可。#include<bits/stdc++.h>usingnamespacestd;intn,a[101];intmain(){cin>>n;f......
  • 比赛总结:Japan Registry Services (JPRS) Programming Contest 2023 (AtCoder Beginn
    比赛:JapanRegistryServices(JPRS)ProgrammingContest2023(AtCoderBeginnerContest324)A-same1.常规方法intmain(){ intn; cin>>n; vector<int>s(n);//利用vector容器可以不需要确定内存大小 for(auto&n:s) { cin>>n; } for(inti=0;i......
  • ECS-Centos7登录页面出现Hint: caps lock on,输入大小写字母反了(大小写反转问题)
    问题描述:虚拟机Centos7,输入大小写字母反了,开启capslock的时候变成小写字母了,关闭则变成大写了。。。解决办法:只需要执行:setleds+caps 或 setleds-caps 即可。如图: ......
  • 【Java 并发编程】ReentrantLock
    目录ReentrantLock公平锁和非公平锁synchronized和ReentrantLock有什么区别?ReentrantLockReentrantLock是一个可重入的互斥锁,又被称为“独占锁”。ReentrantLock类实现了Lock,它拥有与synchronized相同的并发性和内存语义,但是添加了类似锁投票、定时锁等候和可中断锁等......
  • 【Java 并发编程】LockSupport
    目录简介方法介绍阻塞和唤醒示例示例1示例2示例3阻塞对象blocker的作用和显式锁、隐式锁等待唤醒的区别简介java.util.concurrent.locks.LockSupport是一个工具类,提供了基本的线程阻塞和唤醒功能,它是创建锁和其他同步组件的基础工具,内部是基于sun.misc.Unsafe类实现的。Lo......
  • ReentrantLock怎么实现公平锁的?
    newReentrantLock()构造函数默认创建的是非公平锁NonfairSyncpublicReentrantLock(){ sync=newNonfairSync();}同时也可以在创建锁构造函数中传入具体参数创建公平锁FairSyncReentrantLocklock=newReentrantLock(true);---ReentrantLock//true代表公平锁,fa......
  • 部署项目 Failure obtaining db row lock: Table ‘XXX.qrtz_LOCKS‘ doesn‘t exist
    系统环境centos7MySQL5.7原因:mysql对表大小写有要求,但是当时创建表的时候都是小写,所以说就查不到qrtz_LOCKS这张表,所以就报错了解决办法:找到mysql的配置文件my.cnf路径在etc/my.cnfcdetcvimmy.cnf此时点击A键触发编辑命令然后找到位置输入lower_case_table_names......
  • css - inline-block元素水平居中
    inline-block使用margin:0auto失效,因为确定了宽度..content-wrapper{text-align:center;font-size:0;//兼容chromeletter-spacing:-4px;//兼容safari,可能根据不同字体字号做一定的调整word-spacing:-4px;}.content-wrapperulli{......
  • 10-15|sudo hwclock --systohc这个是什么,什么情况下会用到这个
    `sudohwclock--systohc`是一个命令,用于将系统时间同步到硬件时钟。下面详细解释一下这个命令:1.**`sudo`**:这个前缀表示以超级用户权限执行接下来的命令。因为更改硬件时钟通常需要管理员权限,所以通常需要使用`sudo`。2.**`hwclock`**:这是一个工具,用于访问和修改硬件时......