Recursive write lock while sorting

Hi all,

I’m trying to sort some content on my production environment but each time I get an error “Could not update content sort order”. When i check the locks the error states:
“System.InvalidOperationException: Recursive locks not allowed”.

Does anyone know how this can be fixed?

Hi @BramvdBogaard

Are you getting this issue only on sorting or on other operations as well i.e., save & publish etc. ?

@BramvdBogaard , could you share the full log entry, including the stack trace?

Hi,
Thanks for the response.

This is the full stack trace:

System.AggregateException: One or more errors occurred. (Recursive locks not allowed)

 ---> System.InvalidOperationException: Recursive locks not allowed

   at Umbraco.Cms.Infrastructure.PublishedCache.ContentStore.Lock(WriteLockInfo lockInfo, Boolean forceGen)

   at Umbraco.Cms.Infrastructure.PublishedCache.ContentStore.ScopedWriteLock..ctor(ContentStore store, Boolean scoped)

   at Umbraco.Cms.Infrastructure.PublishedCache.ContentStore.<GetScopedWriteLock>b__29_0(Boolean scoped)

   at Umbraco.Cms.Core.Scoping.ScopeContextualBase.<>c__DisplayClass2_0`1.<Get>b__0()

   at Umbraco.Cms.Core.Scoping.ScopeContext.Enlist[T](String key, Func`1 creator, Action`2 action, Int32 priority)

   at Umbraco.Cms.Core.Scoping.ScopeContextualBase.Get[T](ICoreScopeProvider scopeProvider, String key, Func`2 ctor)

   at Umbraco.Cms.Infrastructure.PublishedCache.PublishedSnapshotService.Notify(JsonPayload[] payloads, Boolean& draftChanged, Boolean& publishedChanged)

   at Umbraco.Cms.Core.Cache.ContentCacheRefresher.NotifyPublishedSnapshotService(IPublishedSnapshotService service, AppCaches appCaches, JsonPayload[] payloads)

   at Umbraco.Cms.Core.Cache.ContentCacheRefresher.Refresh(JsonPayload[] payloads)

   at Umbraco.Cms.Infrastructure.Sync.ServerMessengerBase.DeliverLocal[TPayload](ICacheRefresher refresher, TPayload[] payload)

   at Umbraco.Cms.Infrastructure.Sync.ServerMessengerBase.Deliver[TPayload](ICacheRefresher refresher, TPayload[] payload)

   at Umbraco.Cms.Infrastructure.Sync.ServerMessengerBase.QueueRefresh[TPayload](ICacheRefresher refresher, TPayload[] payload)

   at Umbraco.Cms.Core.Cache.DistributedCache.RefreshByPayload[TPayload](Guid refresherGuid, TPayload[] payload)

   at Umbraco.Extensions.DistributedCacheExtensions.RefreshContentCache(DistributedCache dc, IEnumerable`1 changes)

   at Umbraco.Cms.Core.Cache.ContentTreeChangeDistributedCacheNotificationHandler.Handle(IEnumerable`1 entities)

   at Umbraco.Cms.Core.Cache.DistributedCacheNotificationHandlerBase`2.Handle(IEnumerable`1 notifications)

   at Umbraco.Cms.Core.Events.NotificationHandlerWrapperImpl`1.<>c__DisplayClass0_0`2.<Handle>b__2(IEnumerable`1 handlerNotifications)

   at Umbraco.Cms.Core.Events.EventAggregator.PublishCore[TNotification](IEnumerable`1 allHandlers, IEnumerable`1 notifications)

   at Umbraco.Cms.Core.Events.NotificationHandlerWrapperImpl`1.Handle[TNotification,TNotificationHandler](IEnumerable`1 notifications, ServiceFactory serviceFactory, Action`2 publish)

   at Umbraco.Cms.Core.Events.EventAggregator.PublishNotifications[TNotification,TNotificationHandler](IEnumerable`1 notifications)

   at Umbraco.Cms.Core.Events.EventAggregator.Publish[TNotification,TNotificationHandler](IEnumerable`1 notifications)

   at Umbraco.Cms.Core.Events.ScopedNotificationPublisher`1.PublishScopedNotifications(IList`1 notifications)

   at Umbraco.Cms.Core.Events.ScopedNotificationPublisher`1.ScopeExit(Boolean completed)

   at Umbraco.Cms.Core.Scoping.CoreScope.HandleScopedNotifications()

   at Umbraco.Cms.Infrastructure.Scoping.Scope.TryFinally(Action[] actions)

   --- End of inner exception stack trace ---

   at Umbraco.Cms.Infrastructure.Scoping.Scope.TryFinally(Action[] actions)

   at Umbraco.Cms.Infrastructure.Scoping.Scope.DisposeLastScope()

   at Umbraco.Cms.Infrastructure.Scoping.Scope.Dispose()

   at Umbraco.Cms.Core.Services.ContentService.Sort(IEnumerable`1 ids, Int32 userId)

   at Umbraco.Cms.Web.BackOffice.Controllers.ContentController.PostSort(ContentSortOrder sorted)

Hi Nikhil,

I’m only seeing it while sorting.

Hi @BramvdBogaard ,
Try rebuilding Content Cache at Settings->Published Status and sort again. Your content cache could get corrupted at some point. Additionally you could try rebuilding Lucene indexes at Settings->Examine Management.
If this does not help, there’s a known issue with the same error message in Umbraco 13 here When multiple editors are adding content at the same time, a "Recursive locks not allowed" error is thrown · Issue #19338 · umbraco/Umbraco-CMS · GitHub . A fix is going to be released in v13.10.
Likely this is related. Upgrading may resolve it.