Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transaction (Process ID 68) was deadlocked on lock resources with another process and has been chosen as the deadlock victim #17872

Open
PeterKvayt opened this issue Dec 31, 2024 · 2 comments

Comments

@PeterKvayt
Copy link
Contributor

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

15.1.1

Bug summary

When I create a document in the content tree and try to save and publish it sometimes I face with deadlock error:
image
The document was saved and published but a deadlock error occurred.

Specifics

Starck trace:

Microsoft.Data.SqlClient.SqlException (0x80131904): Transaction (Process ID 68) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.

   at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)

   at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)

   at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, SqlCommand command, 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 NPoco.Database.Read[T](Object instance, DbDataReader r, PocoData pd)+MoveNext()

   at NPoco.Database.QueryImp[T](T instance, Expression`1 listExpression, Func`2 idFunc, Sql Sql, PocoData pocoData)+MoveNext()

   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)

   at NPoco.Database.PageImpAsync[T](Int64 page, Int64 itemsPerPage, String sql, Object[] args, Boolean sync)

   at NPoco.AsyncHelper.RunSync[T](Task`1 task)

   at NPoco.Database.Page[T](Int64 page, Int64 itemsPerPage, Sql sql)

   at Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement.EntityRepository.GetPagedResultsByQuery(IQuery`1 query, Guid[] objectTypes, Int64 pageIndex, Int32 pageSize, Int64& totalRecords, IQuery`1 filter, Ordering ordering, Action`1 sqlCustomization)

   at Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement.EntityRepository.GetPagedResultsByQuery(IQuery`1 query, ISet`1 objectTypes, Int64 pageIndex, Int32 pageSize, Int64& totalRecords, IQuery`1 filter, Ordering ordering)

   at Umbraco.Cms.Core.Persistence.Repositories.IEntityRepository.GetPagedResultsByQuery(IQuery`1 query, Guid objectType, Int64 pageIndex, Int32 pageSize, Int64& totalRecords, IQuery`1 filter, Ordering ordering)

   at Umbraco.Cms.Core.Services.EntityService.GetPagedChildren(Int32 id, UmbracoObjectTypes objectType, Int64 pageIndex, Int32 pageSize, Boolean trashed, IQuery`1 filter, Ordering ordering, Int64& totalRecords)

   at Umbraco.Cms.Core.Services.EntityService.GetPagedChildren(Int32 id, UmbracoObjectTypes objectType, Int64 pageIndex, Int32 pageSize, Int64& totalRecords, IQuery`1 filter, Ordering ordering)

   at Umbraco.Cms.Core.Services.EntityService.GetPagedChildren(Nullable`1 parentKey, IEnumerable`1 parentObjectTypes, UmbracoObjectTypes childObjectType, Int32 skip, Int32 take, Int64& totalRecords, IQuery`1 filter, Ordering ordering)

   at Umbraco.Cms.Core.Services.EntityService.GetPagedChildren(Nullable`1 parentKey, UmbracoObjectTypes childObjectType, Int32 skip, Int32 take, Int64& totalRecords, IQuery`1 filter, Ordering ordering)

   at Umbraco.Cms.Api.Management.Controllers.Tree.EntityTreeControllerBase`1.GetPagedChildEntities(Guid parentKey, Int32 skip, Int32 take, Int64& totalItems)

   at Umbraco.Cms.Api.Management.Controllers.Tree.UserStartNodeTreeControllerBase`1.GetPagedChildEntities(Guid parentKey, Int32 skip, Int32 take, Int64& totalItems)

   at Umbraco.Cms.Api.Management.Controllers.Tree.EntityTreeControllerBase`1.GetChildren(Guid parentId, Int32 skip, Int32 take)

   at Umbraco.Cms.Api.Management.Controllers.Document.Tree.ChildrenDocumentTreeController.Children(CancellationToken cancellationToken, Guid parentId, Int32 skip, Int32 take, Nullable`1 dataTypeId)

   at lambda_method680(Closure, Object)

   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)

   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)

   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)

   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)

   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)

   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()

--- End of stack trace from previous location ---

   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)

   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)

   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)

   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()

--- End of stack trace from previous location ---

   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)

   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)

   at Umbraco.Cms.Web.Common.Middleware.BasicAuthenticationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)

   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()

--- End of stack trace from previous location ---

   at Umbraco.Cms.Api.Management.Middleware.BackOfficeExternalLoginProviderErrorMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)

   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()

--- End of stack trace from previous location ---

   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)

   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)

   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)

   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)

   at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)

   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)

   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)

   at StackExchange.Profiling.MiniProfilerMiddleware.Invoke(HttpContext context) in C:\projects\dotnet\src\MiniProfiler.AspNetCore\MiniProfilerMiddleware.cs:line 112

   at Umbraco.Cms.Web.Common.Middleware.UmbracoRequestMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)

   at Umbraco.Cms.Web.Common.Middleware.UmbracoRequestMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)

   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()

--- End of stack trace from previous location ---

   at Umbraco.Cms.Web.Common.Middleware.PreviewAuthenticationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)

   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()

--- End of stack trace from previous location ---

   at Umbraco.Cms.Web.Common.Middleware.UmbracoRequestLoggingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)

   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()

--- End of stack trace from previous location ---

   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.<Invoke>g__Awaited|10_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task)

ClientConnectionId:b34f6e32-c277-4866-85c8-8dd9b432c2ce

Error Number:1205,State:51,Class:13

Steps to reproduce

  1. Open content tree
  2. Select "create" in the context menu
  3. Fill necessary content fields
  4. Click "Save and publish"
    There is a deadlock error sometimes.

Expected result / actual result

Expected result: there are no deadlocks
Actual result: there is a deadlock

Copy link

Hi there @PeterKvayt!

Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.

We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.

  • We'll assess whether this issue relates to something that has already been fixed in a later version of the release that it has been raised for.
  • If it's a bug, is it related to a release that we are actively supporting or is it related to a release that's in the end-of-life or security-only phase?
  • We'll replicate the issue to ensure that the problem is as described.
  • We'll decide whether the behavior is an issue or if the behavior is intended.

We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.

Thanks, from your friendly Umbraco GitHub bot 🤖 🙂

@NguyenThuyLan
Copy link
Contributor

NguyenThuyLan commented Jan 3, 2025

Thank you @PeterKvayt for reporting this issue.
I have had this same issue a few times. It is quite difficult to reproduce because it does not happen continuously.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants