Forums

Lock Wait Timeout

I am getting this constantly when trying to update a table in my db. As far as I can tell, I only have one process trying to insert records (that I can see).

This same program has been working well for ages, I make regular small mods, but this is the first time I have hit this.

a) How can I work out what is giving the locks?

b) Anything changed your end - I use MySQL.

JdP

Is this from a web app, a console script or a scheduled task?

a) Your best bet for working out what is giving the locks is to note the queries that are generating the message and try to work out what is being locked.

b) Nope. My guess is that you're not closing a transaction somewhere under some conditions and so you're getting 2 transactions fighting over a table or a row.

Thanks. This is from a python script run ad-hoc. Hitherto it has run fine, from a PA bash console & remotely from my pc. I would naturally assume that I had made a code change that caused this, but I have not made any changes to the db update for ages.

I want to check the database from a MySQL console, but I cannot open a new MySql console. I get "access denied".
I wonder is this related to my lock problem?

It looks like you deleted the default database which is what the MySQL console on the Consoles tab connects to. To connect to the actual database that you have, go to the Databases tab and use the open console like there.

I have no recollection of deleting the default database. None. I didn't do it guv, honest.

I tried connecting using the Databases tab, but get the message that I have 'exceeded the max_user_connection resource (current value 27).

As far as I can see I don't have any scripts running at all. None on my local machines and none on PA bash consoles.

I see that there are a number of exceptions of the same sort coming from your web app. That suggests to me that your web app is the source of both issues. It's opening connections and not closing them. My guess is that, if you reload it, you won't see either of the issues above. Then you just need to work out why it's hogging connections.

I don't think any of the source files for my web app have changed for months.

Right now, my web app does not run - max connections exceeded (27) - and as far as I can see I have nothing running.

Same for any other script or MySQL console or Heidi.

I have no way of connecting to the database to find out what is happening. I want to make sure my db has not been corrupted.

Can you close any connections to my db so I can get on?

I've emailed you a list of the processes that were keeping the connections. Once I killed around 5 of them, the others seemed to work themselves out. I think you're getting deadlocks between the various ways that you access that database - from console, and from each webapp.

Thanks.

I will look at it later.

Hi I get this error exceeded the 'max_user_connections' resource (current value: 3) And I dont know how to cancel the resources

If you have any console processes with open database connections, you can stop the processes by getting the process list on the Consoles page and killing the processes from there. If you have scheduled tasks, you can do the same thing from the Scheduled tasks page. If they're only in your web app, then you need to make sure that your web app code only opens a connection at the start of the request and closes it at the end and doesn't open additional connections.