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

问题场景:应用调用数据库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,问题处理成功。

你可能感兴趣的:(mysql,liunx)