MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:rburnett Date:February 27 2007 7:39pm
Subject:Connector/NET commit: r611 - in branches/5.0: . Driver/Source
View as plain text  
Modified:
   branches/5.0/CHANGES
   branches/5.0/Driver/Source/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/5.0/CHANGES
===================================================================
--- branches/5.0/CHANGES	2007-02-26 19:02:49 UTC (rev 610)
+++ branches/5.0/CHANGES	2007-02-27 19:39:56 UTC (rev 611)
@@ -20,6 +20,7 @@
   Bug #26152 Opening a connection is really slow 
   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 changes
   -------------

Modified: branches/5.0/Driver/Source/MySqlPool.cs
===================================================================
--- branches/5.0/Driver/Source/MySqlPool.cs	2007-02-26 19:02:49 UTC (rev 610)
+++ branches/5.0/Driver/Source/MySqlPool.cs	2007-02-27 19:39:56 UTC (rev 611)
@@ -122,17 +122,17 @@
 		{
 			Driver driver = (Driver)idlePool.Dequeue();
 
-			// if the user asks us to ping/reset pooled connections
+            // 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.ConnectionReset)
-			{
-				if (!driver.Ping())
-				{
-					driver.Close();
-					return null;
-				}
 				driver.Reset();
-			}
 
 			inUsePool.Add(driver);
 
@@ -144,12 +144,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>
@@ -206,7 +211,7 @@
             // wait till we are allowed in
             bool allowed = poolGate.WaitOne(ticks, false);
             if (! allowed)
-                throw new TimeoutException(Resources.TimeoutGettingConnection);
+                throw new MySqlException(Resources.TimeoutGettingConnection);
 
             // if we get here, then it means that we either have an idle connection
             // or room to make a new connection

Thread
Connector/NET commit: r611 - in branches/5.0: . Driver/Sourcerburnett27 Feb