App crash due to an unhandled System.AggregateException in ImageProcessors CacheTrimmer

  • Updated

App crashed because of System.AggregateException in ImageProcessor CacheTrimmer.

Call stack:

System.Threading.Tasks.Task.ThrowIfExceptional
System.Threading.Tasks.Task.Wait
ImageProcessor.Web.Caching.ImageCacheBase+CacheTrimmer.TimerRelease
System.Threading.ExecutionContext.RunInternal
System.Threading.ExecutionContext.Run
System.Threading.TimerQueueTimer.CallCallback
System.Threading.TimerQueueTimer.Fire
System.Threading.TimerQueue.FireNextTimers
---> (Inner Exception #0) Microsoft.WindowsAzure.Storage.StorageException
Microsoft.WindowsAzure.Storage.Core.Executor.Executor.EndExecuteAsync[[System.__Canon mscorlib]]
Microsoft.WindowsAzure.Storage.Core.Util.AsyncExtensions+<>c__DisplayClass7.b__5
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw
ImageProcessor.Web.Episerver.Azure.AzureBlobCache+<b__10_0>d.MoveNext
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification
ImageProcessor.Web.Caching.ImageCacheBase+CacheTrimmer+d__9.MoveNext
--- End of inner exception stack trace ---
---> (Inner Exception #1) System.Net.WebException
Microsoft.WindowsAzure.Storage.Shared.Protocol.HttpResponseParsers.ProcessExpectedStatusCodeNoException[[System.__Canon mscorlib]]
Microsoft.WindowsAzure.Storage.Blob.CloudBlob.b__33
Microsoft.WindowsAzure.Storage.Core.Executor.Executor.EndGetResponse[[System.__Canon mscorlib]]
--- End of inner exception stack trace ---

Turn it off by adding trimCache="false" to the cache setting in the ImageProcessor cache.config:

<cache name="EpiserverAzureBlobCache"... trimCache="false" />

Note

Exception is related to ImageProcessors trim of its cache and for some reason encounter an issue,
as this is a 3rd party add-on which also now seem to be a retired project by its developers and the issue logged on github for this is gone due to retirement I do not see that it will be investigated by them so the only option is to turn of the cache trimming.

Resolution

You can utilize the image resizing feature in Cloudflare. The added benefit of this is that it will offload the resources needed to resize images from the Azure instances.

See: https://docs.developers.optimizely.com/digital-experience-platform/docs/image-resizing-using-cdn