Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection pool is getting full if connection fails [DNET998] #914

Closed
firebird-automations opened this issue Dec 30, 2020 · 3 comments
Closed

Comments

@firebird-automations
Copy link

Submitted by: Silver Aid (silveraid)

Hi!
If connection fails, the connection pool getting exhausted (even I use FbConnection.ClearAllPools()). Issue exists on 7.10.x.x but not in 7.5.0.0.
Example code:
**************************************************************
int retries = 0;
while (true)
{
try
{
using (var con = new FbConnection($"User=SYSDBA;Password=xxxxx;Database=db;DataSource=localhost;Port=3553;Dialect=3;Charset=NONE;MaxPoolSize=3"))
{
con.Open();
}
}
catch (Exception ex)
{
Console.WriteLine($"Connection failed: {ex.Message}");
if (!(ex is FbException)) break;
FbConnection.ClearAllPools();
if (retries++ >= 4)
{
Console.WriteLine("Giving up....");
break;
}
}

        \}

***********************************************************
With 7.5.0.0 the output is like expected:
Connection failed: Unable to complete network request to host "localhost".
Connection failed: Unable to complete network request to host "localhost".
Connection failed: Unable to complete network request to host "localhost".
Connection failed: Unable to complete network request to host "localhost".
Connection failed: Unable to complete network request to host "localhost".
Giving up....

With 7.10.x.x the output is:
Connection failed: Unable to complete network request to host "localhost".
Connection failed: Unable to complete network request to host "localhost".
Connection failed: Unable to complete network request to host "localhost".
Connection failed: Connection pool is full.

Thanks in advance.
Silver

Commits: 2290ec0

@firebird-automations
Copy link
Author

Commented by: Silver Aid (silveraid)

Additionally,
I stepped into FbConnectionPoolManager source code and if I use FbConnection.ClearAllPools(), FbConnectionPoolManager internal variable Stack<Item> _available is cleared but
variable List<FbConnectionInternal> _busy is not cleared.

Best regards,
Silver

@firebird-automations
Copy link
Author

Commented by: @cincuranet

Not touching busy connections is expected (DNET638). The rest looks like a bug, I'll check it later.

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: vNext [ 10970 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants