Microsoft.Data.SqlClient CheckPoolBlockingPeriod(System.Exception) connecting to Azure Sql Database

Viewed 249

I have a client application that connects to Azure SQL Database using AD Interactive login. It was working fine until last Friday - running the app would pop up a browser prompt for login, selecting the account would grant access appropriately. It was working fine for quite a while. Then something changed late last week and the app now throws an error when trying to connect to the database. No system patches or updates were applied to my local machine where the app is running during that time period. I confirmed that the last update applied was 4/15/2022 per Windows system settings. Seems CheckPoolBlockingPeriod is now broken? Here is the stack trace:

at Microsoft.Data.ProviderBase.DbConnectionPool.CheckPoolBlockingPeriod(Exception e) at Microsoft.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) at Microsoft.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) at Microsoft.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) at Microsoft.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions) at Microsoft.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions) at Microsoft.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry, SqlConnectionOverrides overrides) at Microsoft.Data.SqlClient.SqlConnection.Open(SqlConnectionOverrides overrides) at Microsoft.Data.SqlClient.SqlConnection.Open() at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) at CsharpSqlServer.Program.Main(String[] args) in C:\Users\james.a.barnes\source\repos\dbTest\dbTest\Program.cs:line 65

Can anyone provide any insight into possible causes and workarounds? Again, the code has been running fine for a couple of months and the database connection code has not changed, so something else did. Thanks

1 Answers

If timeout occurs while connecting to Azure SQL Database where connection pooling is enabled, the above exception will be thrown and the login attempt fails for the next few seconds (i.e., "blocking period").

Usually, the above exception will be recovered within a few seconds.

  • If not, you can resolve the exception by adding ;Connection Timeout=60 to your connection string.

You can also increase the timeout seconds by replacing 60.

You can go through the below SO thread for more information:

c# - SQL Exception: Login failed for user - Stack Overflow

Related