From: Date: July 24 2007 2:13am Subject: Connector/NET commit: r809 - in trunk: Driver/Source TestSuite/Source List-Archive: http://lists.mysql.com/commits/31452 X-Bug: 29409 Message-Id: <200707240013.l6O0DjNF026207@bk-internal.mysql.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modified: trunk/Driver/Source/MySqlPool.cs trunk/TestSuite/Source/PoolingTests.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: trunk/Driver/Source/MySqlPool.cs =================================================================== --- trunk/Driver/Source/MySqlPool.cs 2007-07-24 00:13:06 UTC (rev 808) +++ trunk/Driver/Source/MySqlPool.cs 2007-07-24 00:13:44 UTC (rev 809) @@ -135,7 +135,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) @@ -146,11 +147,20 @@ /// /// It is assumed that this method is only called from inside an active lock. /// - private void CreateNewPooledConnection() + private bool CreateNewPooledConnection() { - Driver driver = Driver.Create(settings); - idlePool.Enqueue(driver); - } + Driver driver = null; + try + { + driver = Driver.Create(settings); + } + catch (Exception) + { + return false; + } + idlePool.Enqueue(driver); + return true; + } public void ReleaseConnection(Driver driver) { @@ -204,7 +214,10 @@ // or room to make a new connection lock (lockObject) { - return GetPooledConnection(); + Driver d = GetPooledConnection(); + if (d == null) + poolGate.Release(); + return d; } } } Modified: trunk/TestSuite/Source/PoolingTests.cs =================================================================== --- trunk/TestSuite/Source/PoolingTests.cs 2007-07-24 00:13:06 UTC (rev 808) +++ trunk/TestSuite/Source/PoolingTests.cs 2007-07-24 00:13:44 UTC (rev 809) @@ -262,6 +262,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file