1. Home
  2. Knowledge Base
  3. Problems (EN)
  4. I get the error “Lock wait timeout exceeded”

I get the error “Lock wait timeout exceeded”

This is a problem with your MySQL Server, it gets stuck and therefore cannot process operations. It’s usually because of a problem due to an incomplete “frozen” transaction. Connect to your MySQL server and execute:

show innodb status \G

Search for something similar to:

------------
TRANSACTIONS
------------
Trx id counter 0 2005868535
Purge done for trx's n:o <0 2005868523 undo n:o <0 0
History list length 4
Total number of lock structs in row lock hash table 12990
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 0 2005868508, not started, process no 6801, OS thread id 1150482768
MySQL thread id 67, query id 5223 localhost root
show innodb status
---TRANSACTION 0 2005868518, ACTIVE 833 sec, process no 6801, OS thread id 1150617936 rollback
mysql tables in use 2, locked 2
ROLLING BACK 12992 lock struct(s), heap size 1685488, undo log entries 1557131
MySQL thread id 70, query id 5111 localhost pandora end
DELETE FROM tagente_datos WHERE id_agente_modulo IN (SELECT id_agente_modulo FROM tagente_modulo WHERE
delete_pending = 1)

Another easy way to list current operations is the command:

SHOW FULL PROCESSLIST

In this example, transaction ID 70 , has been active for 833, and seems to be DEAD that’s why it’s blocking the access to some data, and probably it’s the explanation for those “lock wait” errors.

Kill the transaction with:

KILL 70;

Sometimes a KILL could take some time, so be patient. Killing (kill -9) a MySQL daemon IS NOT A GOOD IDEA, and you will get a corrupted database with a 99% chance, so you’ll need to wait to finish.

Was this article helpful?

Related Articles

Need Support?

Can't find the answer you're looking for?
Contact Support

Recent Discussions