MySQL Error 1205: Lock wait timeout exceeded - mysql

I'm using SQLyog to sync a production database to a dev db. On 4 tables, I'm getting:
Error No. 1205 Lock wait timeout exceeded; try restarting transaction
Researching the web seems to indicate that a transaction has begun, locked tables, but has not committed. One post said to SHOW PROCESSLIST; but the only processes appear to be my own, via SQLyog.
I have also tried a Restart of MySQL, but that didn't help either.
As a relative novice in MySQL, I'm stuck: I can't determine what transaction or process is locking the tables, nor how to clear this situation.
Any suggestions would be gratefully accepted!
MTIA

Having the same problem on MySQL-cluster, I've solved (at least it looks being solved now - no fail have occured during last two days) it by performing commit/rollback after SELECTs too.

Export and re-import your database; this can often fix a lot of mysterious problems. You can do this through phpMyAdmin or from the command line.
This page at MediaTemple has a good set of instructions:
http://kb.mediatemple.net/questions/129/Export+and+import+MySQL+databases#gs
(Well, it worked for me!)

Related

What happens to mysql transaction after exceeded wait timeout?

I'm new to MySQL database and got some issue with table lock/deadlock. We are running a system with a heavy transactions run everyday and sometime deadlock happened. I would like to know what happened to the transactions if they exceeded wait timeout. Are they canceled (roll-back) ? Do we need to manually run the transaction again or did application auto retry the transaction after deadlock is resolved?
I'm using MySQL 5.7 with Innodb engine.
Thanks
it dosen't matter what db you are using ,if you are using a transaction it will only be committed on success ie if u look closely there is a commit transaction command at the end of try which u write , unless that line is invoked No changes to the DB will be made hence you can be assured that it will be roll backed at the situation of timeout error

MySQL Lock Timeout Exceeded When Server Time Updates

We have a MySQL 5.6 DB server providing service to 10 clients. The clients poll the database server for records to process. We were having intermittent issues where all of the clients would suddenly generate "Lock wait timeout exceeded; try restarting transaction" errors, all of them at the same time. During troubleshooting one of these events we noted that on the server (Windows Server 2008R2) that at the moment the clients generated the error the server time had changed. We took note for the next time.
Today the next time occurred. 9 out of the 10 clients generated the error and sure enough, when we checked the Event Viewer on the server the server time had changed 1 second forward at the exact time the errors were generated.
Can someone explain:
Why this is happening?
Recommend a way to prevent it?
We are already handling deadlock errors and it's actually not clear where in the program this error is coming from. The clients do not poll the server simultaneously but psuedo randomly in approximate 10 second intervals so it's baffling to us that so many would generate the error at the same moment.
Thanks,
Pablo
What may be happening is some thread is holding lock on some record/table (may be an scheduled task is there to take backup of DB which is generating locks) for too long, and your thread is being timed out. As I said in comments please go through innodb status log for more details.
One way to avoid this is if you are using InnoDB storage engine then fine tune your transaction isolation level.
Check transaction isolation level by executing SELECT ##GLOBAL.tx_isolation, ##tx_isolation;
If you see any of these as REPEATABLE READ which is defauld for InnoDB set it to READ COMMITTED using
SET tx_isolation = 'READ-COMMITTED'; and SET GLOBAL tx_isolation = 'READ-COMMITTED';

How to configure MySQL on a very slow environment?

My application is installed on a client machine which is really really slow.
I'm getting errors like:
"Operation not allowed after ResultSet closed" (which I believe that occured due to timed out connections)
"Lock wait timeout exceeded;
try restarting transaction".
I would like to ensure that all of these errors caused to the slow machine by increasing MySQL timeouts.
My question is - which configurations should I change so that MySQL will be more tolerated to the slow environment.
Thanks
Well, you could try setting your innodb_lock_wait_timeout parameter in your my.ini file to resolve the second problem, but i dont really know how to fix the first one. More on innodb_lock_wait_timeout.

Magento 1.8 & Amazon RDS Lock wait timeouts

Firstly this isn't a duplicate of this question because I'm not behind a load balancer at the moment. Also randomly restarting the instance isn't a satisfactory solution either.
I moved our store from using a local mysql db on the EC2 to RDS recently and we're getting some errors on the backend when they're moving categories around / adding products. Mostly they look like SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction but I've seen other variations of PDO errors.
How would one go about eliminating these issues?
I've read suggestions to just 'keep retrying' but this seems stupid.
I've tried tinkering with innodb_lock_wait_timeout and others but doesn't seem to resolve it.
I have finally disabled magento logging to the DB - will see if this helps going forward. Unfortunately I have to wait a while to let the staff tinker on the backend and then see if any fix has an effect.
Thanks
UPDATE
Now also seeing a bunch of these
User Error: DDL statements are not allowed in transactions

mysql 1205 error on bulk delete in django admin

I've moved to mysql from sqlite and funny issue - whenever I mass-delete objects via django admin (about 100 or so) I get this mysql error:
(1205, 'Lock wait timeout exceeded; try restarting transaction')
this has never happened with sqlite with the same models.
I am able to delete a max of two records, three are failing.
The setup is windows7, mysql 5.5.20, python 2.7, django 1.3
That error is directly from MySQL. It happens when there's a lock created on the table and it isn't released for whatever reason. You can try restarting your MySQL server. That might be enough to clear things up and allow you to proceed. You can also edit your my.conf file (not sure of its location in Windows, but should be with the rest of your MySQL stuff) and change the following line to a longer time period (number is seconds):
innodb_lock_wait_timeout = 50
Turns out there may be many causes to this issue. My case was caused by indexes mixing up somehow - I was only able to fix this by recreating the database and importing data.
in general
show status
show engine innodb status
explain <select causing issues>
may give some hints.