From: Date: February 14 2008 9:26pm Subject: Connector/NET commit: r1180 - in branches/5.2: . Driver/Source List-Archive: http://lists.mysql.com/commits/42309 X-Bug: 34338 Message-Id: <200802142026.m1EKQmfa021743@bk-internal.mysql.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modified: branches/5.2/CHANGES branches/5.2/Driver/Source/ProcedureCache.cs Log: Fixed a problem in procedure cache where it was possible to get into a race condition and cause a memory leak (bug #34338). This was fixed by introducing some better locking. Modified: branches/5.2/CHANGES =================================================================== --- branches/5.2/CHANGES 2008-02-14 20:23:37 UTC (rev 1179) +++ branches/5.2/CHANGES 2008-02-14 20:26:48 UTC (rev 1180) @@ -18,6 +18,8 @@ Version 5.1.6 - Fixed problem where parameters lists were not showing when you tried to alter a routine in server explorer. (bug #34359) + - Fixed a problem in procedure cache where it was possible to get into a race condition + and cause a memory leak (bug #34338) Version 5.1.5 - 2/11/2008 - Fixed problem with membership provider where FindUserByEmail would fail trying to add Modified: branches/5.2/Driver/Source/ProcedureCache.cs =================================================================== --- branches/5.2/Driver/Source/ProcedureCache.cs 2008-02-14 20:23:37 UTC (rev 1179) +++ branches/5.2/Driver/Source/ProcedureCache.cs 2008-02-14 20:26:48 UTC (rev 1180) @@ -52,7 +52,11 @@ { int hash = spName.GetHashCode(); - DataSet ds = (DataSet) procHash[hash]; + DataSet ds = null; + lock (procHash.SyncRoot) + { + ds = (DataSet)procHash[hash]; + } if (ds == null) { ds = AddNew(conn, spName); @@ -80,11 +84,11 @@ DataSet procData = GetProcData(connection, spName); if (maxSize > 0) { - if (procHash.Keys.Count == maxSize) - TrimHash(); int hash = spName.GetHashCode(); lock (procHash.SyncRoot) { + if (procHash.Keys.Count >= maxSize) + TrimHash(); if (!procHash.ContainsKey(hash)) { procHash[hash] = procData;