Skip to content

Commit 415262d

Browse files
Fix transient fault handling for Pooled connections (#637)
1 parent ebde504 commit 415262d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,8 @@ private bool IsTransientError(SqlException exc)
544544
{
545545
if (s_transientErrors.Contains(error.Number))
546546
{
547+
// When server timeouts, connection is doomed. Reset here to allow reconnect.
548+
UnDoomThisConnection();
547549
return true;
548550
}
549551
}
@@ -1628,7 +1630,7 @@ private bool AttemptRetryADAuthWithTimeoutError(SqlException sqlex, SqlConnectio
16281630
timeout.Reset();
16291631
// When server timeout, the auth context key was already created. Clean it up here.
16301632
_dbConnectionPoolAuthenticationContextKey = null;
1631-
// When server timeout, connection is doomed. Reset here to allow reconnect.
1633+
// When server timeouts, connection is doomed. Reset here to allow reconnect.
16321634
UnDoomThisConnection();
16331635
// Change retry state so it only retries once for timeout error.
16341636
_activeDirectoryAuthTimeoutRetryHelper.State = ActiveDirectoryAuthenticationTimeoutRetryState.Retrying;

src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,8 @@ private bool IsTransientError(SqlException exc)
632632
{
633633
if (transientErrors.Contains(error.Number))
634634
{
635+
// When server timeouts, connection is doomed. Reset here to allow reconnect.
636+
UnDoomThisConnection();
635637
return true;
636638
}
637639
}
@@ -1976,7 +1978,7 @@ private bool AttemptRetryADAuthWithTimeoutError(SqlException sqlex, SqlConnectio
19761978
timeout.Reset();
19771979
// When server timeout, the auth context key was already created. Clean it up here.
19781980
_dbConnectionPoolAuthenticationContextKey = null;
1979-
// When server timeout, connection is doomed. Reset here to allow reconnect.
1981+
// When server timeouts, connection is doomed. Reset here to allow reconnect.
19801982
UnDoomThisConnection();
19811983
// Change retry state so it only retries once for timeout error.
19821984
_activeDirectoryAuthTimeoutRetryHelper.State = ActiveDirectoryAuthenticationTimeoutRetryState.Retrying;

0 commit comments

Comments
 (0)