November Happy Hour will be moved to Thursday December 5th.

SqlTransientErrorsRetryPolicy in api functions

Vote:
 

Hi!

I find alot of these in my windows log using my api functions:

Category: EPiServer.Data.Providers.SqlTransientErrorsRetryPolicy
EventId: 0
SpanId: aaa225932de18d8c
TraceId: 05481137a1bda9ecbdf9929bd081d6eb
ParentId: 0000000000000000
RequestId: 80000db7-0001-f000-b63f-84710c7967bb
RequestPath: /api/common/getnewsservice
ActionId: 60e094f4-875d-46f2-b4ac-1e149d45b355
ActionName: Web.Features.Api.Common.CommonController.GetNewsService (Web)

Transient error 'Transaction (Process ID 558) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.' detected, about to do retry 1 of 3.
Microsoft.Data.SqlClient.SqlException (0x80131904): Transaction (Process ID 558) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
   at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at Microsoft.Data.SqlClient.SqlDataReader.TryHasMoreRows(Boolean& moreRows)
   at Microsoft.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean setTimeout, Boolean& more)
   at Microsoft.Data.SqlClient.SqlDataReader.Read()
   at EPiServer.DataAccess.Internal.ContentVersionDB.<>c__DisplayClass4_0.<List>b__0()
   at EPiServer.Data.Providers.Internal.SqlDatabaseExecutor.<>c__DisplayClass26_0`1.<Execute>b__0()
   at EPiServer.Data.Providers.SqlTransientErrorsRetryPolicy.Execute[TResult](Func`1 method)
ClientConnectionId:bfa8c7e1-f48c-4f10-a318-d77d672d0906
Error Number:1205,State:51,Class:13

Exception: 
Microsoft.Data.SqlClient.SqlException (0x80131904): Transaction (Process ID 558) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
   at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at Microsoft.Data.SqlClient.SqlDataReader.TryHasMoreRows(Boolean& moreRows)
   at Microsoft.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean setTimeout, Boolean& more)
   at Microsoft.Data.SqlClient.SqlDataReader.Read()
   at EPiServer.DataAccess.Internal.ContentVersionDB.<>c__DisplayClass4_0.<List>b__0()
   at EPiServer.Data.Providers.Internal.SqlDatabaseExecutor.<>c__DisplayClass26_0`1.<Execute>b__0()
   at EPiServer.Data.Providers.SqlTransientErrorsRetryPolicy.Execute[TResult](Func`1 method)
ClientConnectionId:bfa8c7e1-f48c-4f10-a318-d77d672d0906
Error Number:1205,State:51,Class:13

Any idea what could cause this?

Thanks!

/Kristoffer

#321032
Apr 25, 2024 14:08
Vote:
 

Are you actively using the IContentVersionRepository somehow? ContentVersionDB.List is pretty expensive and it might cause deadlocks in case of race conditions 

#321039
Apr 25, 2024 16:22
Vote:
 

What versions are you on? Any chance this fix could help? https://world.optimizely.com/support/Bug-list/bug/CMS-29569

Was a different issue, but similar error came up around Find indexing, discussed here: https://world.optimizely.com/forum/developers-add-ons-forum/Search/Thread-Container/2023/8/search--navigation-content-indexing-job-fails-locally/ 

#321041
Apr 25, 2024 16:58
Quan Mai - Apr 26, 2024 9:58
I don't think those are related
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.