Skip to content

Commit 301b01b

Browse files
Treat Sql Error Number 1222 as Transient (#31725)
Error number 1222 is defined as > Lock request time out period exceeded And official Microsoft recommendation is to retry the transaction after it has been aborted [Source](https://learn.microsoft.com/en-us/sql/relational-databases/errors-events/mssqlserver-1222-database-engine-error) Fixes #31724
1 parent a4db3b7 commit 301b01b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/EFCore.SqlServer/Storage/Internal/SqlServerTransientExceptionDetector.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,9 @@ public static bool ShouldRetryOn(Exception? ex)
590590
// SQL Error Code: 1232
591591
// Failed to acquire lock with lock manager service, it could be due to many reasons including transient service failure.
592592
case 1232:
593+
// SQL Error Code: 1222
594+
// Lock request time out period exceeded.
595+
case 1222:
593596
// SQL Error Code: 1221
594597
// The Database Engine is attempting to release a group of locks that are not currently held by the transaction.
595598
// Retry the transaction. If the problem persists, contact your support provider.

0 commit comments

Comments
 (0)