Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Rune Grønkjær 1371 posts 3102 karma points
    Jan 31, 2023 @ 11:24
    Rune Grønkjær
    0

    SQL write lock failure

    Hi people,

    Umbraco v10.

    Does anyone know why we keep getting this write lock error in the backoffice? Whenever the error starts appearing, it throws the error when saving anything. The error will disappear after a while (x number of minutes).

    Can the timeout be changed? Or can I do anything else to make sure this won't happen?

    An error occurred
    Failed to acquire write lock for id: -333.
    
    Exception Details
    Umbraco.Cms.Core.DistributedLocking.Exceptions.DistributedWriteLockTimeoutException, Umbraco.Core, Version=10.3.2.0, Culture=neutral, PublicKeyToken=null: Failed to acquire write lock for id: -333.
    Stacktrace
    at Umbraco.Cms.Persistence.SqlServer.Services.SqlServerDistributedLockingMechanism.SqlServerDistributedLock..ctor(SqlServerDistributedLockingMechanism parent, Int32 lockId, DistributedLockType lockType, TimeSpan timeout)
       at Umbraco.Cms.Persistence.SqlServer.Services.SqlServerDistributedLockingMechanism.WriteLock(Int32 lockId, Nullable`1 obtainLockTimeout)
       at Umbraco.Cms.Infrastructure.Scoping.Scope.ObtainWriteLock(Int32 lockId, Nullable`1 timeout)
       at Umbraco.Cms.Infrastructure.Scoping.Scope.LockInner(Guid instanceId, Dictionary`2& locks, HashSet`1& locksSet, Action`2 obtainLock, Nullable`1 timeout, Int32 lockId)
       at Umbraco.Cms.Infrastructure.Scoping.Scope.EagerWriteLockInner(Guid instanceId, Nullable`1 timeout, Int32[] lockIds)
       at Umbraco.Cms.Infrastructure.Scoping.Scope.EnsureDbLocks()
       at Umbraco.Cms.Infrastructure.Scoping.Scope.get_Database()
       at Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement.ContentTypeRepositoryBase`1.PersistUpdatedBaseContentType(IContentTypeComposition entity)
       at Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement.ContentTypeRepository.PersistUpdatedItem(IContentType entity)
       at Umbraco.Cms.Core.Cache.FullDataSetRepositoryCachePolicy`2.Update(TEntity entity, Action`1 persistUpdated)
       at Umbraco.Cms.Core.Services.ContentTypeServiceBase`2.Save(TItem item, Int32 userId)
       at Umbraco.Cms.Web.BackOffice.Controllers.ContentTypeController.<PostSave>b__30_1(IContentType type)
       at Umbraco.Cms.Web.BackOffice.Controllers.ContentTypeControllerBase`1.PerformPostSave[TContentTypeDisplay,TContentTypeSave,TPropertyType](TContentTypeSave contentTypeSave, Func`2 getContentType, Action`1 saveContentType, Action`1 beforeCreateNew)
       at Umbraco.Cms.Web.BackOffice.Controllers.ContentTypeController.PostSave(DocumentTypeSave contentTypeSave)
       at lambda_method84(Closure , Object , Object[] )
       at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
    --- End of stack trace from previous location ---
       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.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
    
  • Jason 122 posts 637 karma points
    Feb 02, 2023 @ 17:32
    Jason
    0

    Hey Rune, I cannot offer a solution for this, but I am running into this a lot as well. I am running into a lot of performance issues with v10. Database and NuCache locking issues often and extremely slow performance.

    Have you found anything new to the cause or solution?

  • Dave Woestenborghs 3504 posts 12134 karma points MVP 9x admin c-trib
    Feb 02, 2023 @ 18:57
    Dave Woestenborghs
    0

    Hi Rune,

    Can I ask what kind of server setup you have. I'm not experiencing this.

    Dave

  • Rune Grønkjær 1371 posts 3102 karma points
    Feb 03, 2023 @ 06:20
    Rune Grønkjær
    0

    Hi Dave,

    In this latest case the website runs on an MS SQL 15.0.4261 on a linux server. The Umbraco website is also running on Linux, but we are experiencing the problem from our local windows dev machines that uses the same linux served database.

    It might have something to do with us running multiple websites against the same database? But why would that be an issue on Umbraco 10. That was never an issue on Umbraco 7 and 8!

    /Rune

  • Dave Woestenborghs 3504 posts 12134 karma points MVP 9x admin c-trib
    Feb 03, 2023 @ 08:14
    Dave Woestenborghs
    0

    Hi Rune,

    Working from a shared database will most likely be the cause of this issue, because in Umbraco terms you are now loadbalancing (multiple servers connecting to the same database).

    You will probably would have issues on V7 and V8 as well, but you might not have noticed them. Probably you faced issues like content cache or examine indexes not being up to date after publishing.

    Maybe the following things can help you fix the problem.

    1. Change the locking to filesystem as described here : https://docs.umbraco.com/umbraco-cms/fundamentals/setup/server-setup/load-balancing/azure-web-apps#host-synchronization
    2. Make your servers think they are not loadbalancing by registering them as single : https://docs.umbraco.com/umbraco-cms/fundamentals/setup/server-setup/load-balancing/flexible-advanced#explicit-schedulingpublisher-server

    But this is not guaranteed to fix the issue. We always use local databases for development and sync schema changes using uSync or Umbraco Deploy (when working with Cloud).

    Dave

  • Rune Grønkjær 1371 posts 3102 karma points
    Feb 03, 2023 @ 08:42
    Rune Grønkjær
    0

    Brilliant. I will try that. It's only while in the development phase we do this, but it would be nice not to have to worry about it.

    /Rune

  • Rune Grønkjær 1371 posts 3102 karma points
    Feb 06, 2023 @ 11:52
    Rune Grønkjær
    0

    Just a little heads up. No luck with Daves proposal.

    I have been debugging with a debug build of Umbraco and found out that when getting the error on a content save and publish the error appears when the DocumentRepository tries to Fetch a ContentScheduleDto in the GetContentSchedule() method.

    Stepping through the code other lock call before this actually succeeds in getting a database lock, but this one doesn't. Not sure if that makes any sence and I'm not in to the science behind it.

    /Rune

  • Huw Reddick 1864 posts 6388 karma points MVP 2x c-trib
    Feb 06, 2023 @ 12:38
    Huw Reddick
    0

    Hi Rune,

    Have you tried updating to Umbraco 10.4.0 ? It may be worth doing so to see if any resolved issues are at fault.

  • John DeSpirito 10 posts 80 karma points
    Feb 13, 2023 @ 18:21
    John DeSpirito
    0

    Any more news on this Rune? I'm getting this exact error on save and publish as well. Did upgrading Umbraco help?

  • Rune Grønkjær 1371 posts 3102 karma points
    Feb 20, 2023 @ 06:48
    Rune Grønkjær
    0

    Hi John,

    No conclusion yet. What we are trying right now is using uSync instead of all connecting to the same database. That might have had a positive effect. Last week we did not experience the error though.

    /Rune

  • Rune Grønkjær 1371 posts 3102 karma points
    Feb 27, 2023 @ 09:15
    Rune Grønkjær
    0

    Just a small follow-up on this one. We recently updated to Umbraco 10.4 and this have not fixed the problem. We are still experiencing the issue from time to time on different machines.

  • Russell 11 posts 83 karma points c-trib
    Mar 07, 2023 @ 20:22
    Russell
    1

    I have also been having this issue. I have several Umbraco sites but it only seems to happen in one of them. It is has over 1000 pages but it is not the largest site - sites with more pages on the same server do not evidence the same problem.

    Rebuild database cache can help but seems to be a temporary fix.

  • Rune Grønkjær 1371 posts 3102 karma points
    Apr 12, 2023 @ 05:16
    Rune Grønkjær
    0

    Just a small update on this issue, or whatever you can call it. After we have started strictly having one instance per database we have not had the issue quite as much. When deploying the website we sometime have to restart the sql-server though. So the problem is not entirely gone.

    /Rune

  • Joe Begly 19 posts 110 karma points
    Aug 30, 2023 @ 17:25
    Joe Begly
    1

    I've just seen this for the first time myself today. I've been working on Umbraco sites since 2011.

    What I've noticed today is that running on an Ubuntu server is where I see the issue. I can have the site running on localhost pointed at the same database. Trying to delete an item from the Media section on the instance running on a browser gives the "Failed to acquire write lock for id: -334." error. Moving over to my local version and doing the same operation - just fine.

  • ewuski 97 posts 263 karma points
    Nov 01, 2023 @ 14:40
    ewuski
    0

    I am experiencing this issue on one of our databases. And only one website is connected to it so I doubt it's anything to do with supposed load balancing.

    We are only experiecing it in one environment while the other ones (that connect to their own databases) are working well.

  • Rune Grønkjær 1371 posts 3102 karma points
    Nov 02, 2023 @ 07:41
    Rune Grønkjær
    0

    Yes, same here. It can happen in multiple cases including where there's just one instance working on the database.

  • Heather Floyd 607 posts 1008 karma points MVP 6x c-trib
    1 week ago
Please Sign in or register to post replies

Write your reply to:

Draft