Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

Commented Issue: V8ScriptEngine does not support stack limits [26]

$
0
0
Hi there,

I'm trying to evaluate how ClearScript's V8 implementation works when it comes to scripts that could contain issues of any kind. One particular case led me to running a script that contains circular reference, such as this one:
```
var cnt=0;
var addCounter=function(){
++cnt;
console.WriteLine('Counter: #'+(cnt));
addCounter();
}
addCounter();
```
When I execute this script via ClearScript.Execute method, I end up with "An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll" (InvokeHelpers.cs, line 144 --> var result = method.Invoke(target, finalArgs);) and there is no way to recover from it. Is there anything that could be done to recover from this error without changing a script section above?

Thanks,
Max
Comments: Hi Max, V8's answer for infinite recursion is the stack limit. The host can specify a boundary beyond which the stack cannot grow during script execution. If it does, V8 generates a recoverable error. Unfortunately ClearScript currently does not leverage this feature. Worse, .NET 4.x views a stack overflow as potential data corruption, so it instantly kills the process with no possibility of recovery. We'll add support for stack limits in an upcoming release of ClearScript. Thanks for reporting this issue!

Viewing all articles
Browse latest Browse all 2297

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>