Mitigation: Pool Blocking Period

The connection pool blocking period has been removed for connections to Azure SQL databases.

Additional description

In the .NET Framework 4.6.1 and earlier versions, when an app encounters a transient connection failure when connecting to a database, the connection attempt cannot be retried quickly, because the connection pool caches the error and re-throws it for 5 seconds to 1 min. For more information, see SQL Server Connection Pooling (ADO.NET). This behavior is problematic for connections to Azure SQL databases, which often fail with transient errors that are typically recovered from within a few seconds. The connection pool blocking feature means that the app cannot connect to the database for an extensive period, even though the database is available. This behavior is particularly problematic for web apps that connect to Azure SQL databases and that need to render within a few seconds.

Starting with the .NET Framework 4.6.2, for connection open requests to known Azure SQL databases (*.database.windows.net, *.database.chinacloudapi.cn, *.database.usgovcloudapi.net, *.database.cloudapi.de), connection open errors are not cached. For all other connection attempts, the connection pool blocking period continues to be enforced.

Impact

This change allows the connection open attempt to be retried immediately for Azure SQL databases, thereby improving the performance of cloud-enabled apps.

Mitigation

For apps that are adversely affected by this change, the connection pool blocking period can be configured by setting the new SqlConnectionStringBuilder.PoolBlockingPeriod property. The value of the property is a member of the System.Data.SqlClient.PoolBlockingPeriod enumeration that can take either of three values:

The previous behavior can be restored by setting the PoolBlockingPeriod property to PoolBlockingPeriod.AlwaysBlock.

See also