List:Commits« Previous MessageNext Message »
From:rburnett Date:July 24 2007 12:06am
Subject:Connector/NET commit: r805 - in branches/1.0: . mysqlclient
View as plain text  
Modified:
   branches/1.0/CHANGES
   branches/1.0/mysqlclient/MySqlPool.cs
Log:
- Fixed problem where an attempt to open a connection max pool size times while the server is down will prevent any further attempts due to the pool semaphore being full. (Bug #29409)   

Modified: branches/1.0/CHANGES
===================================================================
--- branches/1.0/CHANGES	2007-07-24 00:02:22 UTC (rev 804)
+++ branches/1.0/CHANGES	2007-07-24 00:06:55 UTC (rev 805)
@@ -5,6 +5,9 @@
     Bug #24373 High CPU utilization when no idle connection 
     Bug #24957 MySql.Data.Types.MySqlConversionException is not marked as Serializable. 
     Bug #25603 Critial ConnectionPool Error in Connector.Net 5.03 
+    - Fixed problem where an attempt to open a connection max pool size times while
+      the server is down will prevent any further attempts due to the pool semaphore
+      being full. (Bug #29409)       
     
     Other
     -----

Modified: branches/1.0/mysqlclient/MySqlPool.cs
===================================================================
--- branches/1.0/mysqlclient/MySqlPool.cs	2007-07-24 00:02:22 UTC (rev 804)
+++ branches/1.0/mysqlclient/MySqlPool.cs	2007-07-24 00:06:55 UTC (rev 805)
@@ -133,7 +133,8 @@
 				// if we don't have an idle connection but we have room for a new
 				// one, then create it here.
 				if (!HasIdleConnections)
-					CreateNewPooledConnection();
+					if (!CreateNewPooledConnection())
+						return null;
 
 				Driver d = CheckoutConnection();
 				if (d != null)
@@ -144,10 +145,19 @@
 		/// <summary>
 		/// It is assumed that this method is only called from inside an active lock.
 		/// </summary>
-		private void CreateNewPooledConnection()
+		private bool CreateNewPooledConnection()
 		{
-			Driver driver = Driver.Create(settings);
+			Driver driver = null;
+			try 
+			{
+				driver = Driver.Create(settings);
+			}
+			catch (Exception)
+			{
+				return false;
+			}
 			idlePool.Enqueue(driver);
+			return true;
 		}
 
 		public void ReleaseConnection(Driver driver)
@@ -183,7 +193,10 @@
 			// or room to make a new connection
 			lock (lockObject)
 			{
-				return GetPooledConnection();
+				Driver d = GetPooledConnection();
+				if (d == null)
+					poolGate.Release();
+				return d;
 			}
 		}
 	}

Thread
Connector/NET commit: r805 - in branches/1.0: . mysqlclientrburnett24 Jul