React.NET: JavaScriptEngineSwitcher.Core.JsRuntimeException: Unknown error; potential stack overflow detected

I set the AllowMsieEngine flag to false and i get the following error:

An Error Occurred,Unknown error; potential stack overflow detected","Exception":"JavaScriptEngineSwitcher.Core.JsRuntimeException: Unknown error; potential stack overflow detected ---> Microsoft.ClearScript.ScriptEngineException: Unknown error; potential stack overflow detected
   at V8Exception.ThrowScriptEngineException(V8Exception* )
   at Microsoft.ClearScript.V8.V8ContextProxyImpl.Execute(String gcDocumentName, String gcCode, Boolean evaluate, Boolean discard)
   at Microsoft.ClearScript.V8.V8ScriptEngine.<>c__DisplayClass1b.<Execute>b__19()
   at Microsoft.ClearScript.ScriptEngine.ScriptInvoke[T](Func`1 func)
   at Microsoft.ClearScript.V8.V8ScriptEngine.BaseScriptInvoke[T](Func`1 func)
   at Microsoft.ClearScript.V8.V8ScriptEngine.<>c__DisplayClass25`1.<ScriptInvoke>b__24()
   at Microsoft.ClearScript.V8.?A0x792c8756.InvokeAction(Void* pvActionRef)
   at Microsoft.ClearScript.V8.V8ContextProxyImpl.InvokeWithLock(Action gcAction)
   at Microsoft.ClearScript.V8.V8ScriptEngine.ScriptInvoke[T](Func`1 func)
   at Microsoft.ClearScript.V8.V8ScriptEngine.Execute(String documentName, String code, Boolean evaluate, Boolean discard)
   at JavaScriptEngineSwitcher.V8.V8JsEngine.InnerEvaluate(String expression)
   --- End of inner exception stack trace ---
   at JavaScriptEngineSwitcher.V8.V8JsEngine.InnerEvaluate(String expression)
   at JavaScriptEngineSwitcher.V8.V8JsEngine.InnerEvaluate[T](String expression)
   at JavaScriptEngineSwitcher.V8.V8JsEngine.InnerHasVariable(String variableName)
   at JavaScriptEngineSwitcher.Core.JsEngineBase.HasVariable(String variableName)
   at React.ReactEnvironment.EnsureUserScriptsLoaded()
   at React.ReactEnvironment.CreateComponent[T](String componentName, T props, String containerId)
   at React.Web.Mvc.HtmlHelperExtensions.React[T](HtmlHelper htmlHelper, String componentName, T props, String htmlTag, String containerId, Boolean clientOnly, Boolean serverOnly)
   at ASP._Page_Views_Shared__Header_cshtml.Execute() in d:\home\site\wwwroot\Views\Shared\_Header.cshtml:line 19
   at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
   at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
   at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
   at System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance)
   at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)
   at System.Web.Mvc.HtmlHelper.RenderPartialInternal(String partialViewName, ViewDataDictionary viewData, Object model, TextWriter writer, ViewEngineCollection viewEngineCollection)
   at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData)
   at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model)
   at ASP._Page_Views_Shared__WebsiteLayout_cshtml.Execute() in d:\home\site\wwwroot\Views\Shared\_WebsiteLayout.cshtml:line 101
   at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
   at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
   at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
   at System.Web.WebPages.WebPageBase.<>c__DisplayClass3.<RenderPageCore>b__2(TextWriter writer)
   at System.Web.WebPages.HelperResult.WriteTo(TextWriter writer)
   at System.Web.WebPages.WebPageBase.Write(HelperResult result)
   at System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action`1 body)
   at System.Web.WebPages.WebPageBase.PopContext()
   at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
   at System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance)
   at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)
   at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)
   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.AsyncResultWrapper.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
   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.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
   at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
   at System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`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.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
   at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
   at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 2
  • Comments: 16 (4 by maintainers)

Most upvoted comments

Hi @szarouski I’m sorry that I didn’t post here the results as I said, but I totally forgot :\

What I can say is that after I’ve switched (like the piece of code in my previous post), this error completly disappeared even with heavier load (1000 concurrent requests). So for us was really great news, and maybe this engine could be set as default in react.net.

Side effects we didn’t noticed any, and our application is running as before but this time without errors 😄

I can’t say much about performance, because we didn’t measure the response time when using v8 (we were more worried to fix the error), but according to the benchmark I previously wrote using ChakraCore should be as performant as v8 if not better. But as I said, I can’t confirm that… I just hope the guy is right 😃

Hi. I’m facing the same issue here.

We are developing a azure web app based in asp.net mvc and react.net for some months and now when is close to prd date we are doing some performance tests.

The guy who is performing these tests says that this situation only happens when we have hundreds of concurrent request (+/- above 200). With a few (10-50) such error does not happen.

I tried to google a bit, but unfortunately there’s not much about this. Anyway, according to stackoverflow the problem seems to be related with SetAllowMsieEngine(false) and therefore using V8 engine, which from what I understood is now the default engine used by react.net.

We tried that and apparently from the first tests we did it seems to work when setting SetAllowMsieEngine(true).

Now, since SetAllowMsieEngine is deprecated I’m trying to figure out a solution by setting other engine directly on JsEngineSwitcher. According to this benchmark it seems that ChakraCore is the winner.

So, I tried to set ChakraCore as js engine (I’m sorry but I’m a bit new in all of this and not sure if is correct and will work):

JsEngineSwitcher engineSwitcher = JsEngineSwitcher.Instance;
engineSwitcher.EngineFactories
    .AddChakraCore()
    .AddMsie( new MsieSettings() { EngineMode = JsEngineMode.Auto } );

engineSwitcher.DefaultEngineName = ChakraCoreJsEngine.EngineName;

We’ll tests and check. If the tests succeed, I’ll share the results.

I’m heavily using react.net in our web site, so I would not like to remove it right now and test everything, so if this solution will work great (at least for me), however I think the initial error “potential stack overflow detected” should be somehow fixed and I see for several months nothing new in this thread :\