0

During performance testing, I am hitting the following issue when the load increases on my presentation servers for DCPs.

2017 - 04 - 21 00: 06: 38, 419[9] ERROR - Internal Server Error System.Web.HttpException(0x80004005): 
Internal Server Error-- - > System.IndexOutOfRangeException: Index was outside the bounds of the array.at System.Collections.Generic.Dictionary `2.Insert(TKey key, TValue value, Boolean add)    at 
DD4T.Utils.DD4TConfiguration.GetExpirationForCacheRegion(String region)    at DD4T.Utils.Caching.DefaultCacheAgent.FindCacheItemPolicy(String key, Object item, String region)    at DD4T.Utils.Caching.DefaultCacheAgent.Store(String key, String region, Object item, List`
1 dependOnTcmUris) at 
DD4T.Factories.ComponentPresentationFactory.TryGetComponentPresentation(IComponentPresentation & cp, String componentUri, String templateUri) at Sdl.Web.Tridion.Mapping.DefaultProvider.GetEntityModel(String id, Localization localization) at MYWEBSITE.Site.MINE.Controllers.MYCONTROLLER.RENDERDCPWITHHTML(String id) at lambda_method(Closure, ControllerBase, Object[]) at
 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary `2 parameters)    at
 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`
 2 parameters) at System.Web.Mvc.Async.AsyncControllerActionInvoker. < BeginInvokeSynchronousActionMethod > b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult `2.CallEndDelegate(IAsyncResult asyncResult)    at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)    at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass48.<InvokeActionMethodFilterAsynchronouslyRecursive>b__41() at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult)    at
 System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() at
 System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult)    at
 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult)    at System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState)    at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`
1. CallEndDelegate(IAsyncResult asyncResult) at
 System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid `1.CallEndDelegate(IAsyncResult asyncResult)    at
 System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)    at
 System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState)    at
 System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`
1. CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) at
 System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean & completedSynchronously)

I am running into the following issue with DXA 1.2 and DD4T master version. I did see a couple of issues with DD4T code and seem to have the fixes in my source as well.

I do have the fix incorporated with https://github.com/dd4t/DD4T.Core/issues/91 at https://github.com/dd4t/DD4T.Core/blob/master/source/DD4T.Utils/DD4TConfiguration.cs and also for https://github.com/dd4t/DD4T.Core/issues/96 at https://github.com/dd4t/DD4T.Core/blob/master/source/DD4T.Factories/ComponentPresentationFactory.cs

Am I missing anything? The issue occurs sporadically but still an issue!

1
  • For us also we had the same issue but fixed after "Replaced Dictionary with Concurrent Dictionary" fix, recommending to upgrade to latest DD4T 2.0 version with better caching mechanism and performance improvements you can also integrate ActiveMQ caching. so that during the load never clear the caching until there is no republish
    – Velmurugan
    Jun 3, 2017 at 6:52

1 Answer 1

0

You could also use a ConcurrentDictionary for this.

Existing method GetExpirationForCacheRegion in the DD4TConfiguration class

Make sure to replace

private Dictionary<string, int> _expirationPerRegion = new Dictionary<string, int>();

with:

private ConcurrentDictionary<string, int> _expirationPerRegion = new ConcurrentDictionary<string, int>();

Override the DD4TConfiguration class in your application or upgrade to latest DD4T version will fix this issue.

For information on this issue here you can find: https://github.com/dd4t/DD4T.Core/issues/62

I hope it helps to fix this issue

1
  • 2
    If you're copy/pasting answers from others... it would be nice to fix their typos too :) (tho -> to)
    – Nuno Linhares
    Dec 7, 2017 at 13:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.