Find Overview: System Out of Memory Exception

Vote:
 
Hi , Recently I have been seing System out of memory exception when I'm trying to search for a file in EPiServer/Find/Index/Explore section. Please tell me what is the reason
#71876
May 31, 2013 9:05
Vote:
 

Can you provide a stacktrace so we can a hint of what might be the problem.

#71879
May 31, 2013 9:16
Vote:
 
Hi Marcus, Please see the below details: Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.] System.Text.RegularExpressions.RegexRunner.DoubleTrack() +27 System.Text.RegularExpressions.RegexRunner.EnsureStorage() +47 System.Text.RegularExpressions.RegexInterpreter.Backtrack() +97 System.Text.RegularExpressions.RegexInterpreter.Go() +13159 System.Text.RegularExpressions.RegexRunner.Scan(Regex regex, String text, Int32 textbeg, Int32 textend, Int32 textstart, Int32 prevlen, Boolean quick) +183 System.Text.RegularExpressions.Regex.Run(Boolean quick, Int32 prevlen, String input, Int32 beginning, Int32 length, Int32 startat) +275 System.Text.RegularExpressions.RegexReplacement.Replace(MatchEvaluator evaluator, Regex regex, String input, Int32 count, Int32 startat) +297 System.Text.RegularExpressions.Regex.Replace(String input, MatchEvaluator evaluator, Int32 count, Int32 startat) +25 System.Text.RegularExpressions.Regex.Replace(String input, MatchEvaluator evaluator) +35 System.Text.RegularExpressions.Regex.Replace(String input, String pattern, MatchEvaluator evaluator) +46 EPiServer.Find.Framework.UI.Controllers.IndexOverviewController.SyntaxHighlightJson(String original) +101 EPiServer.Find.Framework.UI.Controllers.IndexOverviewController.GetDocumentsResult(Int32 pageIndex, SearchResults`1 result) +156 EPiServer.Find.Framework.UI.Controllers.IndexOverviewController.Explore(String query, String types, Nullable`1 page) +921 lambda_method(ExecutionScope , ControllerBase , Object[] ) +198 System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +178 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +148 System.Web.Mvc.<>c__DisplayClassd.b__a() +53 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +258 System.Web.Mvc.<>c__DisplayClassf.b__c() +20 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +195 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +316 System.Web.Mvc.Controller.ExecuteCore() +104 System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +36 System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +7 EPiServer.Shell.Web.Mvc.ModuleMvcHandler.ProcessController(IController controller) +34 EPiServer.Shell.Web.Mvc.ModuleMvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +24 System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) +60 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +13 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +703 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +218. Recently I'm seeing this error in project also after using the Take Method. I have used the below code : var result = query.Take(MaxTakeValue).OrderByDescending(x => x.CreatedDate).Track().GetResult(); Please let me know what I'm doing wrong. Thanks .
#72418
Jun 17, 2013 9:42
Vote:
 

Hi,

How big is the largest document you have indexed? Both the Index overview and your query (using MaxTakeValue) need to be able to store the entire resultset in memory. If you have large documents and fetch them all at once this might give you problems. As for the Index overview you simply need more memory but for your query there are two things you can do:

1. Don't fetch all documents at once by using MaxTakeValue instead page them when needed using Skip + Take.
2. Limit the fields you fetch when querying by using Select() and only fetch the properties that you need and not the entire document.

#72532
Jun 19, 2013 17:01
Vote:
 
Thanks for your reply Henrik.I have some of the documents around 20MB in size.And My Actual requirement is to show 4 items only but I have to show the no. of results found for Search queries . So, I'm using this : 1)var result = query.OrderByDescending(x => x.CreatedDate).Track().Take(Count).GetResult(); 2)var resultCnt = query.Take(MaxTakeValue).GetResult().Count();.In 1) Count is 4 , I'm not getting any problem when I specified the Take(Count=4), But , In 2)I'm trying to specify the max possible value, In My case : MaxTakeValue is 50. Since I want to know How many results found for the search query.In case 1) I'm showing the result.Count() in a lable1 and in Case 2) I have to show the resultCnt.Count() in lable 2 where I'm getting exception. Please tell me is there any way that we can get the count of results in case 2.
#72540
Jun 20, 2013 6:57
Vote:
 

You don't have to fetch all results to know the total number of hits, just use 'result.TotalMatching' as it will return the total number of matching documents.

#72545
Jun 20, 2013 10:52
Vote:
 
Thanks Henrik result.TotalMatching Helped me.
#72581
Jun 21, 2013 18:19
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.