patternsqlMajor
mysql Lock wait timeout exceeded; try restarting transaction
Viewed 0 times
restartingwaittimeoutmysqltransactionexceededtrylock
Problem
we are running java application, running for ages, back end is MySQL, recently updated to MySQL 5.6. Everything was running fine, past week started getting this error:
Lock wait timeout exceeded; try restarting transaction
which looks like never stop ending. I don't know what to do with this error to stop.
Why is it occurring all of sudden?
Lock wait timeout exceeded; try restarting transaction
which looks like never stop ending. I don't know what to do with this error to stop.
Why is it occurring all of sudden?
Solution
You can set variable innodb_lock_wait_timeout=100 for lock time to 100 sec.
The transaction which is timeout, try to lock table which is hold by another process. and your timeout variable set with little number of second. so it shows error.
You can see more status by the command.
You can see list of locked tables by-
Now see the thread which is using this table
now you can kill that thread or wait to complete it.
mysql> set innodb_lock_wait_timeout=100;
Query OK, 0 rows affected (0.02 sec)
mysql> show variables like 'innodb_lock_wait_timeout';
+--------------------------+-------+
| Variable_name | Value |
+--------------------------+-------+
| innodb_lock_wait_timeout | 100 |
+--------------------------+-------+The transaction which is timeout, try to lock table which is hold by another process. and your timeout variable set with little number of second. so it shows error.
You can see more status by the command.
SHOW ENGINE INNODB STATUS\GYou can see list of locked tables by-
show open tables where in_use>0;Now see the thread which is using this table
show full processlist;now you can kill that thread or wait to complete it.
Code Snippets
mysql> set innodb_lock_wait_timeout=100;
Query OK, 0 rows affected (0.02 sec)
mysql> show variables like 'innodb_lock_wait_timeout';
+--------------------------+-------+
| Variable_name | Value |
+--------------------------+-------+
| innodb_lock_wait_timeout | 100 |
+--------------------------+-------+SHOW ENGINE INNODB STATUS\Gshow open tables where in_use>0;show full processlist;Context
StackExchange Database Administrators Q#100984, answer score: 43
Revisions (0)
No revisions yet.