diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs index 4525d4c75d..ed1655f39a 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs @@ -530,6 +530,8 @@ private bool IsTransientError(SqlException exc) { if (s_transientErrors.Contains(error.Number)) { + // When server timeouts, connection is doomed. Reset here to allow reconnect. + UnDoomThisConnection(); return true; } } @@ -1610,7 +1612,7 @@ private bool AttemptRetryADAuthWithTimeoutError(SqlException sqlex, SqlConnectio timeout.Reset(); // When server timeout, the auth context key was already created. Clean it up here. _dbConnectionPoolAuthenticationContextKey = null; - // When server timeout, connection is doomed. Reset here to allow reconnect. + // When server timeouts, connection is doomed. Reset here to allow reconnect. UnDoomThisConnection(); // Change retry state so it only retries once for timeout error. _activeDirectoryAuthTimeoutRetryHelper.State = ActiveDirectoryAuthenticationTimeoutRetryState.Retrying; diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs index 0da06ba54d..9309465bd3 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs @@ -620,6 +620,8 @@ private bool IsTransientError(SqlException exc) { if (transientErrors.Contains(error.Number)) { + // When server timeouts, connection is doomed. Reset here to allow reconnect. + UnDoomThisConnection(); return true; } } @@ -1960,7 +1962,7 @@ private bool AttemptRetryADAuthWithTimeoutError(SqlException sqlex, SqlConnectio timeout.Reset(); // When server timeout, the auth context key was already created. Clean it up here. _dbConnectionPoolAuthenticationContextKey = null; - // When server timeout, connection is doomed. Reset here to allow reconnect. + // When server timeouts, connection is doomed. Reset here to allow reconnect. UnDoomThisConnection(); // Change retry state so it only retries once for timeout error. _activeDirectoryAuthTimeoutRetryHelper.State = ActiveDirectoryAuthenticationTimeoutRetryState.Retrying;