mysql异常com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Lock wait timeout exceeded

本文记录了一次MySQL数据库出现Lockwaittimeoutexceeded错误的处理过程,包括尝试kill进程、调整my.cnf配置文件、排查存储空间不足等问题,并最终解决问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

问题场景:应用调用数据库mysql提示:
com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Lock wait timeout exceeded; try restarting transaction
; SQL []; Lock wait timeout exceeded; try restarting transaction; nested exception is
com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Lock wait timeout exceeded; try restarting transaction

处理过程:

1、尝试 SHOW PROCESSLIST; 进行kill id 发现无法kill成功;

2、关闭 mysql 服务,重启,提示:
查看 mysql.err 提示:

02:32:12 UTC - mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.

key_buffer_size=16384
read_buffer_size=262144
max_used_connections=0
max_threads=100
thread_count=0
connection_count=0
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 33293 K bytes of memory
Hope that’s ok; if not, decrease some variables in the equation.

Thread pointer: 0x0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong…
stack_bottom = 0 thread_stack 0x40000
/usr/local/mysql/bin/mysqld(my_print_stacktrace+0x35)[0x915405]
/usr/local/mysql/bin/mysqld(handle_fatal_signal+0x37b)[0x650beb]
/lib64/libpthread.so.0[0x341b00eca0]
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.

当时判断 这有可能是 是my.cnf的配置发生导致的异常,

3、重新调整 my.cnf 的key_buffer_size ,read_buffer_size等相关参数,但是一直提示:

key_buffer_size=402653184
read_buffer_size=2097152
max_used_connections=23
max_threads=151
threads_connected=11
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 1013277 K
bytes of memory
Hope that’s ok; if not, decrease some variables in the equation.

4、后来重置 my.cnf ,把my.cnf 设置为初始的my.cnf后

重启 mysql服务 ,发现日志变更为:

26573 [ERROR] /usr/local/mysql/bin/mysqld: Error writing file ‘/data0/mysqldb/pretest.pid’ (Errcode: 28 - No space left on device)
26573 [ERROR] Can’t start server: can’t create PID file: No space left on device

5、这说明当前存储空间出现问题

使用 df -sh * 和 dt -ah 查询,发现存储空间确实存在不足的问题,

处理存储空间不足的问题后,恢复 原始的my.cnf,重启mysql,问题处理成功。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值