2

Recently a c# web site I've been working on has been throwing a -

mysql has exceeded the 'max_user_connections

error. I've checked my code and believe I'm closing all open connections when I should do. After running the SHOW PROCESSLIST command it lists a number of processes where the state is 'sleep' and the 'info' is null, similar to this Stack Overflow question -

Mysql show processlist lists many processes sleep and info = null?

Is there anything I can do either in the database set-up or in my connection string that will prevent MySql hanging on to processes? My connection string currently looks like this -

server=server;User Id=user;password=****;Persist Security Info=True;database=mysql5_867860_footytriv;Pooling=true;Min Pool Size=10;Max Pool Size=15

The web site is hosted on discountasp.net

Community
  • 1
  • 1
ipr101
  • 24,096
  • 8
  • 59
  • 61
  • Usually this means you don't close your connections, I will recheck again and encapsulate every new MySqlConnection inside a using statement. – Steve Apr 29 '12 at 10:15
  • what is your connection string? do you use "Using" on your connections? – Moshe L May 06 '12 at 08:01

1 Answers1

0

This requires a lot of investigation. Usually as you know, MYSQL manages the connection instance from the connection pool. Sometimes, it happens that all the connections are in use.

This leads us into 2 issues:
1. There is some query which is taking pretty long to execute so it is not releasing the connection ( some redundant queries, long running queries, etc)
2. The load on the server is too high and the configuration of hardware is not sufficient enough to handle so many users.

You have to measure all this before coming to a conclusion. You can tweak the configuration file to increase the memory, no of connections ,etc but I don't think it will help you !