MySql Error. Buffer Maxing Out?

02/08/2011 18:38 Korvacs#16
Chances are that you arnt Disposing the connection after you are finshed with it and are simply closing it. Can you check that?
02/08/2011 21:18 -impulse-#17
Use timeouts. MySQL can be configured to kill a connection after an interval. If you use a connection/query (I wouldn't do it if I was in your case)* then you should add a parameter like "Connection Lifetime=5", even if 5 is much, it will help you since not all connections are bad and don't want to close themselves, this lifetime will save you. Also to be sure you can configurate mysql to kill any connection after no communication was done in a time span you want. (Networking options -> wait_timeout).

I use mysql's pooling system and it works wonderfully, and I wouldn't do what you do because creating a conn/query takes a few milliseconds and overall in 1 second it might be a big amount of milliseconds if there are like 100 queries.
I tried to profile my server cpu timing and I could see that to create a mysql connection it takes about 30 ms as it also pings the server before returing the connection. If the ping doesn't get back then too many connections are already opened and it will throw an error(your error.)

Better set a timeout like 2 seconds or even 1. It might not be a good idea if you also got your website to do queries on the mysql directly but try it.

Quote:
Originally Posted by .Beatz View Post
No Impulse uses a "solid" connection

It open up when the source does and stays open and sends everything through that connection...
Actually no, you can use one solid connection to only execute queries that doesn't involve reading, but it's not my case. I am using 'using' statement as .NET has a nicely well done pooling system.

For stealarcher, 'using' statement doesn't dispose the connection, it keeps it into the pool until a timeout expires and it is disconnected.

By the way. Your server doesn't open thousands of connections now is because the pooling is on even if you don't want to. Add 'pooling=false' in your connectionstring if you don't want it.

I tried to make my own little mysql pool :S I failed because atm when I restart my server there are atleast 50 people who would login directly, and sincerely without mysql pooling, my plan failed. Better inform yourself about pooling. It will help you.
02/09/2011 16:17 stealarcher#18
Quote:
Originally Posted by Korvacs View Post
Chances are that you arnt Disposing the connection after you are finshed with it and are simply closing it. Can you check that?
hmm, does it work around the same was as IDispose? where you have to implement your own void etc? I was under the impression that by using the "using" it already disposed it for me.
02/09/2011 16:24 Korvacs#19
Oh good, no thats fine that disposes correctly. Just wanted to rule that out.
02/09/2011 16:27 stealarcher#20
oh i see, np. And as for impulses solution, i tried to set the mysql timeout inside mysql settings to 3, and then restarted my mysql, let it run overnight, and i still ran into the same problem. I also set the connection timeout in the sql string itself. And i did disable pooling.
02/09/2011 18:39 ImmuneOne#21
Having one connection for multipile queries is really no problem. As long you have some sort of notification method for when the connection dies, that way you could open a new connection whenever your existing connection dies.
02/09/2011 23:47 12tails#22
for example if i check the connection before do any action, if the connection is killed i can start it again?? (just a question)
02/10/2011 00:29 stealarcher#23
As far as I know its about the same situation as sockets. Once a socket dies (not from intentional disconnection), you may have to start a completely new connection rather then just re-opening the current connection.
02/10/2011 18:37 ImmuneOne#24
Quote:
Originally Posted by 12tails View Post
for example if i check the connection before do any action, if the connection is killed i can start it again?? (just a question)
When using the ManagedOpenSsl library, you have an option to get the connection.StateChange raised whenever your MySql's connection's state has been changed.

Code:
connection.StateChange += new StateChangeEventHandler(connection_StateChange);

void connection_StateChanged(object sender, StateChangeEventArgs e)
{
//do whatever you want with e.CurrentState
}
02/11/2011 18:13 stealarcher#25
#bump, still getting the same error. Tried reinstalling mysql thinking i may of changed some variables by accident, still didnt change anything.