Could not enter monitor before timeout in content store

Hello Team,

We are running Umbraco.CMS v13.4.1.

We have this method inside an implementation of UmbracoApiController.

The aim of this method is to create a media folder and then create an actual media inside that folder.

Below is an example of this folder created:

On a fresh start of the app there is no issue. But after some time, we are getting this error when trying to upload a media that calls that method.

The error happens during the folder creation. When this code is called:

mediaService.Save(folder);

I was hoping someone can help us out resolve this issue?

Thank you.

I have included the full error below:

An error occurred while creating an update request “One or more errors
occurred. (Could not enter monitor before timeout in content store)”,
Details: “System.AggregateException: One or more errors occurred.
(Could not enter monitor before timeout in content store) —>
System.TimeoutException: Could not enter monitor before timeout in
content store at
Umbraco.Cms.Infrastructure.PublishedCache.ContentStore.Lock(WriteLockInfo
lockInfo, Boolean forceGen) at
Umbraco.Cms.Infrastructure.PublishedCache.ContentStore.b__29_0(Boolean
scoped) at
Umbraco.Cms.Core.Scoping.ScopeContextualBase.<>c__DisplayClass2_01.<Get>b__0() at Umbraco.Cms.Core.Scoping.ScopeContext.Enlist[T](String key, Func1
creator, Action2 action, Int32 priority) at Umbraco.Cms.Core.Scoping.ScopeContextualBase.Get[T](ICoreScopeProvider scopeProvider, String key, Func2 ctor) at
Umbraco.Cms.Infrastructure.PublishedCache.PublishedSnapshotService.Notify(JsonPayload
payloads, Boolean& anythingChanged) at
Umbraco.Cms.Core.Cache.MediaCacheRefresher.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.Core.Cache.DistributedCache.RefreshByPayload[TPayload](Guid
refresherGuid, TPayload payload) at
Umbraco.Extensions.DistributedCacheExtensions.RefreshMediaCache(DistributedCache
dc, IEnumerable1 changes) at Umbraco.Cms.Core.Cache.MediaTreeChangeDistributedCacheNotificationHandler.Handle(IEnumerable1
entities) at
Umbraco.Cms.Core.Events.EventAggregator.PublishCore[TNotification](IEnumerable1 allHandlers, IEnumerable1 notifications) at
Umbraco.Cms.Core.Events.NotificationHandlerWrapperImpl1.Handle[TNotification,TNotificationHandler](IEnumerable1
notifications, ServiceFactory serviceFactory, Action2 publish) at Umbraco.Cms.Core.Events.EventAggregator.PublishNotifications[TNotification,TNotificationHandler](IEnumerable1
notifications) at
Umbraco.Cms.Core.Events.EventAggregator.Publish[TNotification,TNotificationHandler](IEnumerable1 notifications) at Umbraco.Cms.Core.Events.ScopedNotificationPublisher1.ScopeExit(Boolean
completed) 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.Dispose() at
Umbraco.Cms.Core.Services.MediaService.Save(IMedia media, Int32
userId) at
Mohio.Website.Controllers.UpdateRequestApiController.CreateUpdateRequest(IContentTypeBaseServiceProvider
contentTypeBaseServiceProvider, IMemberManager memberManager,
MediaFileManager mediaFileManager, IShortStringHelper
shortStringHelper, IMediaService mediaService, IFormCollection
formData) in
/home/vsts/work/1/s/src/Mohio.Website/Controllers/UpdateRequestApiController.cs:line
107”


This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/114646-could-not-enter-monitor-before-timeout-in-content-store