And whenever we are trying to programmatically save member in database using MemberService or MemberManager, we are getting Failed to acquire write lock for id: -335.
Umbraco.Cms.Persistence.SqlServer.Services.SqlServerDistributedLockingMechanism.SqlServerDistributedLock..ctor(SqlServerDistributedLockingMechanism parent, Int32 lockId, DistributedLockType lockType, TimeSpan timeout).
Have you had any such an experience before? Thank you, indeed!
Be good to look in the umbracoLock database table and see what lock is fir -335!
It sounds like a previous update scope isn't complete, the lock isn't being released before the next attempt to update a Member, my guess would be that by explicitly wrapping the save in it's own scope and calling scope.complete() might resolve the issue, but is a bit of a guess!
This happened to me today. I was running health checks and in "data integrity" section it gave me this error:
Umbraco.Cms.Core.DistributedLocking.Exceptions.DistributedWriteLockTimeoutException: Failed to acquire write lock for id: -333.
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.ContentRepositoryBase`3.CheckDataIntegrity(ContentDataIntegrityReportOptions options)
at Umbraco.Cms.Core.Services.ContentService.CheckDataIntegrity(ContentDataIntegrityReportOptions options)
at Umbraco.Cms.Core.HealthChecks.Checks.Data.DatabaseIntegrityCheck.<>c__DisplayClass11_0.<CheckDocuments>b__0()
at Umbraco.Cms.Core.HealthChecks.Checks.Data.DatabaseIntegrityCheck.CheckPaths(String actionAlias, String actionName, String entityType, Boolean detailedReport, Func`1 doCheck)
at Umbraco.Cms.Core.HealthChecks.Checks.Data.DatabaseIntegrityCheck.CheckDocuments(Boolean fix)
at Umbraco.Cms.Core.HealthChecks.Checks.Data.DatabaseIntegrityCheck.GetStatus()
at Umbraco.Cms.Web.BackOffice.HealthChecks.HealthCheckController.GetStatus(Guid id)
Failed to acquire write lock for id: -335.
Hi,
We have upgraded Umbraco V7 to V11.
And whenever we are trying to programmatically save member in database using MemberService or MemberManager, we are getting Failed to acquire write lock for id: -335. Umbraco.Cms.Persistence.SqlServer.Services.SqlServerDistributedLockingMechanism.SqlServerDistributedLock..ctor(SqlServerDistributedLockingMechanism parent, Int32 lockId, DistributedLockType lockType, TimeSpan timeout).
Have you had any such an experience before? Thank you, indeed!
Hi Salome
What is the context of using the memberservice to save? eg a Controller or a background thread?
Are you saving/updating one member, or is it an import scenario where lots of updates are being made to multiple members?
And are you wrapping the save inside a Scope? (in V7 you didn't need to)
https://docs.umbraco.com/umbraco-cms/reference/distributed-locks
Be good to look in the umbracoLock database table and see what lock is fir -335!
It sounds like a previous update scope isn't complete, the lock isn't being released before the next attempt to update a Member, my guess would be that by explicitly wrapping the save in it's own scope and calling scope.complete() might resolve the issue, but is a bit of a guess!
regards
Marc
This happened to me today. I was running health checks and in "data integrity" section it gave me this error:
Hi Hüseyin,
This issue thread on GitHub, about -333 write lock issues, might be of interest to you: https://github.com/umbraco/Umbraco-CMS/issues/14195
Specifically, this comment, which explains what a -333 write lock means: https://github.com/umbraco/Umbraco-CMS/issues/14195#issuecomment-1958889246
is working on a reply...