List:Commits« Previous MessageNext Message »
From:rburnett Date:February 27 2007 8:48pm
Subject:Connector/NET commit: r612 - in branches/1.0: . mysqlclient
View as plain text  
Modified:
   branches/1.0/CHANGES
   branches/1.0/mysqlclient/MySqlPool.cs
Log:
Bug #25603 Critial ConnectionPool Error in Connector.Net 5.03 

Fixed problem where pool was not checking the connection for being alive unless connection
reset was given on the connection string.  It should always check that the connection is
alive.  Also, fixed a problem in GetConnection that resulted from our recent overhaul of
pooling.  It was only making a single pass looking for a connetion.

Modified: branches/1.0/CHANGES
===================================================================
--- branches/1.0/CHANGES	2007-02-27 19:39:56 UTC (rev 611)
+++ branches/1.0/CHANGES	2007-02-27 19:47:59 UTC (rev 612)
@@ -4,6 +4,7 @@
     Bug #25605 BINARY and VARBINARY is returned as a string 
     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 
     
     Other
     -----

Modified: branches/1.0/mysqlclient/MySqlPool.cs
===================================================================
--- branches/1.0/mysqlclient/MySqlPool.cs	2007-02-27 19:39:56 UTC (rev 611)
+++ branches/1.0/mysqlclient/MySqlPool.cs	2007-02-27 19:47:59 UTC (rev 612)
@@ -106,17 +106,17 @@
 		{
 			Driver driver = (Driver)idlePool.Dequeue();
 
+			// first check to see that the server is still alive
+			if (!driver.Ping())
+			{
+				driver.Close();
+				return null;
+			}
+
 			// if the user asks us to ping/reset pooled connections
 			// do so now
 			if (settings.ResetPooledConnections)
-			{
-				if (!driver.Ping())
-				{
-					driver.Close();
-					return null;
-				}
 				driver.Reset();
-			}
 
 			inUsePool.Add(driver);
 
@@ -128,12 +128,17 @@
 		/// </summary>
 		private Driver GetPooledConnection()
 		{
-			// if we don't have an idle connection but we have room for a new
-			// one, then create it here.
-			if (!HasIdleConnections)
-				CreateNewPooledConnection();
+			while (true)
+			{
+				// if we don't have an idle connection but we have room for a new
+				// one, then create it here.
+				if (!HasIdleConnections)
+					CreateNewPooledConnection();
 
-			return CheckoutConnection();
+				Driver d = CheckoutConnection();
+				if (d != null)
+					return d;
+			}
 		}
 
 		/// <summary>

Thread
Connector/NET commit: r612 - in branches/1.0: . mysqlclientrburnett27 Feb