You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following method within FbConnectionPoolManager.cs
public void CleanupPool()
{
lock (_syncRoot)
{
CheckDisposedImpl();
var now = DateTimeOffset.UtcNow;
var available = _available.ToArray();
var keep = available.Where(x => IsAlive(_connectionString.ConnectionLifeTime, x.Created, now)).ToArray();
var keepCount = keep\.Count\(\);
if \(keepCount < \_connectionString\.MinPoolSize\)
keep = available\.Except\(keep\)\.Take\(\_connectionString\.MinPoolSize \- keepCount\)\.ToArray\(\);
var release = available\.Except\(keep\)\.ToArray\(\);
release\.AsParallel\(\)\.ForAll\(x =\> x\.Dispose\(\)\);
\_available = new Queue<Item\>\(keep\);
\}
\}
}
The line keep = available.Except(keep).Take(_connectionString.MinPoolSize - keepCount).ToArray(); will always clear existing connections when the number of connections is less than the Minimum Pool Size.
By removing the following lines, all works as expected:
var keepCount = keep\.Count\(\);
if \(keepCount < \_connectionString\.MinPoolSize\)
keep = available\.Except\(keep\)\.Take\(\_connectionString\.MinPoolSize \- keepCount\)\.ToArray\(\);
Also the Take(_connectionString.MinPoolSize - keepCount) only takes account of the min pool size and not the maximum, so "other" connections above min pool size could also be lost at this point
Submitted by: @k3ldar
The following method within FbConnectionPoolManager.cs
public void CleanupPool()
{
lock (_syncRoot)
{
CheckDisposedImpl();
var now = DateTimeOffset.UtcNow;
var available = _available.ToArray();
var keep = available.Where(x => IsAlive(_connectionString.ConnectionLifeTime, x.Created, now)).ToArray();
}
The line keep = available.Except(keep).Take(_connectionString.MinPoolSize - keepCount).ToArray(); will always clear existing connections when the number of connections is less than the Minimum Pool Size.
By removing the following lines, all works as expected:
Also the Take(_connectionString.MinPoolSize - keepCount) only takes account of the min pool size and not the maximum, so "other" connections above min pool size could also be lost at this point
The following is my connection string:
User=USERNAME;Password=password;Database=DBName.fdb;DataSource=127.0.0.1;Dialect=3;MinPoolSize=20;MaxPoolSize=150;Pooling=True;Connection lifetime=0;Packet Size=8192;CharSet=UTF8
Commits: 5456044
The text was updated successfully, but these errors were encountered: