1

I have Flask app which makes SQL updates:

 query = 'update tbl set x="bla" where filename=%s';
 cursor.execute(query, fileName)

This code worked well with multiple files. Suddenly i'm starting to get this errors while updating (Error rises up again in each update call).

InternalError: (1205, u'Lock wait timeout exceeded; try restarting transaction')

I've seen similar posts like Getting "Lock wait timeout exceeded; try restarting transaction" even though I'm not using a transaction

But it didn't solve my problem.

This is my process list: enter image description here

Tried to kill some sleeping processes but it didn't work.

Info from SHOW ENGINE INNODB STATUS:

mysql tables in use 1, locked 1
LOCK WAIT 2 lock struct(s), heap size 1136, 5 row lock(s)
MySQL thread id 439228, OS thread handle 139653215057664, query id 7055088 10.66.85.134 admin updating
update tbl set vt_status=\"rescan\" where filename=\'3ec7il\'
Trx read view will not see trx with id >= 131151, sees < 131145
jonb
  • 845
  • 1
  • 13
  • 36

1 Answers1

2

Try/except finally solved it

try:
   conn = getConn()
finally:
   conn.close()
azro
  • 53,056
  • 7
  • 34
  • 70
jonb
  • 845
  • 1
  • 13
  • 36