V8 Embeded Application throws Exception randomly. [RangeError: Maximum call stack size exceeded]

21 views
Skip to first unread message

siam...@gmail.com

unread,
Nov 8, 2018, 4:31:03 PM11/8/18
to v8-dev
Hi,

I am using V8 in an asp.net application. I wrote some c++ code to expose some  V8 functionality  to C# via PInvoke.  I create V8 Isolate object (in future we will use isolate pool for reuse.)  for every request and dispose end of the request. In our test environment I found sometimes V8 throws exception (RangeError: Maximum call stack size exceeded). I also verified their is no recursion in script. For that request V8 execute react, react-dom server and a simple script that has react view. In order to repro this I created a simple console app and ran it 10000 times but couldn't repro it. I also ran 200 thread simultaneously which created isolate object and ran script then dispose isolate but still not able to repro this. Do you guys any suggestion how can I dig into this and what is the configuration I am missing for my web application.

Thank you
Siam

Ben Noordhuis

unread,
Nov 9, 2018, 3:48:57 AM11/9/18
to v8-...@googlegroups.com
Start V8 with `--abort_on_stack_or_string_length_overflow` (see
`v8::V8::SetFlagsFromString()`) and, if possible, run your application
in a debugger. The abort backtrace should hopefully yield some clues.

Reasons beyond simple recursion for a stack overflow are complex
regular expressions or (very) deeply nested source code.

If V8 somehow guesses the stack size wrong, you can correct it with
`--stack_size=<size in kb>`. Note that it tells V8 to _assume_ the
stack is this large, not _create_ a stack this large.

Sad al Abdullah

unread,
Nov 9, 2018, 1:29:42 PM11/9/18
to v8-...@googlegroups.com
He Ben,

Thanks a lot for this information. Is there any way to get the current stack_size ?

Thank you
Siam

--
--
v8-dev mailing list
v8-...@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to a topic in the Google Groups "v8-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/v8-dev/FzKre3FQWOA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to v8-dev+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ben Noordhuis

unread,
Nov 10, 2018, 7:08:38 AM11/10/18
to v8-...@googlegroups.com
On Fri, Nov 9, 2018 at 7:29 PM Sad al Abdullah
<siam.abd...@gmail.com> wrote:
> Is there any way to get the current stack_size ?

On Windows? https://docs.microsoft.com/en-us/windows/desktop/api/processthreadsapi/nf-processthreadsapi-getcurrentthreadstacklimits

If you mean V8's default value on your platform, `d8 --help` will print it.
Reply all
Reply to author
Forward
0 new messages