Error connecting...obtaining a connection from the pool
Posted by: Jesse Castleberry
Date: May 31, 2012 07:29AM

We have a Windows Server 2003 machine connected to an Ubuntu Linux server running MySQL Database. periodically we'll get the following error:

System.Web.HttpUnhandledException: Exception of type ''System.Web.HttpUnhandledException'' was thrown. ---> MySql.Data.MySqlClient.MySqlException: error connecting: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.

When this happens the application no longer responds. We're using the .net MySQL connector in our app (not necessarily the latest version, but we've had this problem with all prior versions as well). The only way I've found to fix this problem is to manually recycle the application pool in IIS. When I do this, we're off and running until this happens again.

It typically happens if we have someone logging in repeatedly and doing something in rapid-fire succession. For instance, maybe they'll click on a report, set certain parameters, display the report, print, then hit the browser back button, change a parameter, run the report again, repeat over and over and over very quickly. I have checked the application code and I'm using "try/finally" or "using" to ensure that the connection is being closed when it's finished. The application code is not a problem, because I use similar techniques on the another server (see below) and it works great.

We also have another application (similar code, but different function) on another WS03 server with MySQL installed right on that server itself and it runs like a champ! During certain times of the year this is a VERY busy server. It's not unusual for us to have over 1000 connections to that server at the same time and it's never complained about this. However, while the server referenced above is busy it's not as busy as this one. We may have a few hundred connections at a time at most on the above server.

Just to eliminate the network as a possible problem (we are on a LAN at the data center), we had a similar set up as the one just above. We had the app on the server and the database server right on the same machine. The difference was we were running Windows Server 2008. We had that problem ALL THE TIME with that app. We'd get 50 people or so connected and it'd bomb, so I know that the LAN isn't an issue here.

Any ideas what could be causing this? Is it a MySQL configuration issue? App configuration issue? IIS Configuration issue? Is it an app pool issue (which I don't think since the one that works very well uses the same server O/S and settings). Any help is appreciated.

Thanks,
Jesse

Options: ReplyQuote


Subject
Written By
Posted
Error connecting...obtaining a connection from the pool
May 31, 2012 07:29AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.