Hello,
I am new on drupal and directly started using drupal 7. I am working on a sample website and I received the following error many times in a day:

" already has more than 'max_user_connections' active connections in lock_may_be_available() (line 165 of domainname\includes\lock.inc)."

I have to wait for specific time and then my site works. I have contacted my hosting company and they have said I need to make some changes in my drupal code so my code should close the connection when that is used or no more required. Can someone guide me how to handle this issue and how can I close this connection.

Thanks

Comments

ayesh’s picture

Not sure what is the exact problem. Find the full entry in drupal db log and let others see it. So community could help.

As the error message says, your site connects to database with too many connections.

Try disabling Boost, ImageCache and other heavy modules first.

jscoble’s picture

Some hosting companies set resource limits on mysql, concurrent connections to the database is one of them. Do you know what the limit is for your hosting plan? If they won't increase this limit, then Drupal 7 may not be workable.

In that case, getting a hosting plan that has more resources or using a different hosting company would be necessary.

For getting to learn Drupal and working on a sample website you could also install and run it locally. For windows XAMPP works well. Google WAMP or MAMP, for Mac, to find out more. There are also howtos on this site that could help you through this process then.

moneyescapade’s picture

I experienced a similar problem today on my website for a brief amount of time before it went away by itself. I use ipage shared hosting as my provider. So am trying to figure out the issue, did you figure out what was the cause of this?

EDIT: I found out that the problem was due to too many concurrent MYSQL connections. So the problem now is how do I limit this on a shared hosting platform? I've been looking around but the solutions seem rather confusing/complicated, can anyone explain it better?

rachelljhall’s picture

I also using ipage hosting and want to install drupal as my new blog system. If any kind of other database error it will create then what is the easy solution for it help please.

loko’s picture

Same problem here.

stevenmhouse’s picture

It may not work for everybody, but I just cleared my cache via 'drush cc all' after SSHing into my server.

jgoldbloom’s picture

The long term solution is to change 'max_user_connections' to a higher value, traditionally this is done via /etc/my.cnf on the *nix serverr where you add this in:

[code]
# Set max user connections to unlimited (0)
max_user_connections = 0
[/code]

The my.cnf file overrides the default setting, whatever that is, set up by the installer or host.

Being you're on a shared host, you might not have this option in your GUI hosting manager or access to my.cnf and might need to contact support and ask them to either increase the value or set to 0 if they are willing. They would check your usage to validate the request or might simply say no. If the latter all the other solutions posed in this discussion are temporary, eventually as load increases, your connections will max out again. Sometimes this turns out to be a simple case of a host not being able to provide the resources you need.

gajanannehul’s picture

I am getting same issue on my windows IIS7 server.
Please tell me where do i place this code.

Thanks

golchi’s picture

Hey
Is it possible to track the queries that are not being closed ? I have a similar issue here but it is not a dedicated server so the mysql configuration file solution won't work for me.
Best

ayesh’s picture

Try setting it in phpmyadmin.
(there is a query to do so but I can't remember it).

quickly’s picture

I am having the same problem... anyone has a solution yet?