Modules\Orchard.OutputCache\Services\DefaultTagCache.cs:line 18 -- Index was outside the bounds of the array.

Topics: Administration, Announcements, Core, Customizing Orchard, Francais (French), General, Installing Orchard, Localization, Troubleshooting, Writing modules, Writing themes
Jul 5 at 3:46 PM
Hi,

Please help me with this below issue, after this happens any thing i am searching in orchard getting this error, to clear the issue i am recycling app pool every time.

Orchard version : Orchard 1.7.2

Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 7/5/2016 10:13:12 AM
Event time (UTC): 7/5/2016 2:13:12 PM
Event ID: 1ff476bea86940aa83faa8ce76fe7ea7
Event sequence: 643
Event occurrence: 292
Event detail code: 0

Application information:
Application domain: /LM/W3SVC/3/ROOT-1-131122008007811192 
Trust level: Full 
Application Virtual Path: / 
Application Path: D:\Apps\Webapplications\Orchard.Web\ 
Machine name: PRODserver 
Process information:
Process ID: 11260 
Process name: w3wp.exe 
Account name: NT AUTHORITY\SYSTEM 
Exception information:
Exception type: IndexOutOfRangeException 
Exception message: Index was outside the bounds of the array.
at System.Collections.Generic.List1.Contains(T item)
at System.Collections.ObjectModel.Collection
1.Contains(T item)
at Orchard.OutputCache.Services.DefaultTagCache.Tag(String tag, String[] keys) in d:\Apps\Webapplications\Orchard.Web\Modules\Orchard.OutputCache\Services\DefaultTagCache.cs:line 18
at Orchard.OutputCache.Filters.OutputCacheFilter.OnResultExecuted(ResultExecutedContext filterContext) in d:\Apps\Webapplications\Orchard.Web\Modules\Orchard.OutputCache\Filters\OutputCacheFilter.cs:line 403
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 continuation)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func
1 continuation)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 continuation)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList
1 filters, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
at System.Web.Mvc.Controller.<>c__DisplayClass1d.<BeginExecuteCore>b__19()
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass1.<MakeVoidDelegate>b__0()
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass81.<BeginSynchronous>b__7(IAsyncResult _)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult
1.End()
at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult1.End()
at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)
at System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult)
at System.Web.Mvc.MvcHandler.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult
1.End()
at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result)
at Orchard.Mvc.Routes.ShellRoute.HttpAsyncHandler.EndProcessRequest(IAsyncResult result)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)



Request information:
Request path: /audit-report/item/34421 
User:  
Is authenticated: False 
Authentication Type:  
Thread account name: NT AUTHORITY\SYSTEM 
Thread information:
Thread ID: 119 
Thread account name: NT AUTHORITY\SYSTEM 
Is impersonating: False 
Stack trace:    at System.Collections.Generic.List`1.Contains(T item)
at System.Collections.ObjectModel.Collection1.Contains(T item)
at Orchard.OutputCache.Services.DefaultTagCache.Tag(String tag, String[] keys) in d:\Apps\Webapplications\Orchard.Web\Modules\Orchard.OutputCache\Services\DefaultTagCache.cs:line 18
at Orchard.OutputCache.Filters.OutputCacheFilter.OnResultExecuted(ResultExecutedContext filterContext) in d:\Apps\Webapplications\Orchard.Web\Modules\Orchard.OutputCache\Filters\OutputCacheFilter.cs:line 403
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func
1 continuation)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 continuation)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func
1 continuation)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList1 filters, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
at System.Web.Mvc.Controller.<>c__DisplayClass1d.<BeginExecuteCore>b__19()
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass1.<MakeVoidDelegate>b__0()
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass8
1.<BeginSynchronous>b__7(IAsyncResult _)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult1.End()
at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult
1.End()
at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)
at System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult)
at System.Web.Mvc.MvcHandler.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End()
at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result)
at Orchard.Mvc.Routes.ShellRoute.HttpAsyncHandler.EndProcessRequest(IAsyncResult result)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)


Custom event details:
Developer
Jul 6 at 9:25 AM
Can you reproduce this on your local machine (with a debugger attached) and a copy of the production DB? That way you might be able to pinpoint the cause of the issue and remedy it.
Jul 6 at 2:37 PM
Edited Jul 6 at 2:51 PM
Thank you sfmskywalker, i have tried in my local machine with back up of production db and i never get this error, and above error also occurs occasionally in production, right now we are doing every 30 minute automatic app pool recycle to avoid this issue.

The best part of this issue is i was not able to reproduce in local and i am not able to identify the pattern or what causing this issue in production

Even i have checked memory counters , processor , everything looks normal..

Any help will be greatly appreciated.
Developer
Jul 6 at 8:01 PM
I see. It looks like a concurrency bug where the code tries to read an item that was removed by another thread. The latest OutputCache module has a slightly different implementation that includes a lock, so odds are that the issue will go away if you upgrade to Orchard latest. If you're not ready to upgrade, then perhaps you can simply copy the ITagCache and DefaultTagCache files from the latest source code into Orchard.OutputCache in your source code solution, fix any compilation issues because of that, and try again.
Jul 7 at 9:21 PM
Thank you sfmskywalker , let me get ITagCache and DefaultTagCache files from latest version and try it. If we see any issues we will go for orchard version upgrade.