v8 shell crashes with Fatal error in v8::ToLocalChecked Empty MaybeLocal.

2,107 views
Skip to first unread message

Jane Chen

unread,
Oct 5, 2015, 3:25:22 PM10/5/15
to v8-users
[jchen@jchen-z620 x64.release]$ ./shell
V8 version 4.7.0 (candidate) [sample shell]
> read();
(shell):1: Bad parameters
read();
^

#
# Fatal error in v8::ToLocalChecked
# Empty MaybeLocal.
#

Illegal instruction (core dumped)

This is with a build made with either:

make -j8 x64.debug -werror=no GYPFLAGS="-Dv8_use_external_startup_data=0 -Dcomponent=shared_library"

or:

make -j8 x64.release -werror=no GYPFLAGS="-Dv8_use_external_startup_data=0 -Dcomponent=shared_library"

I see this with my embedding application as well as long as I throw an exception from a callback.  Am I missing something or should I use a more stable branch?  If so, which branch of v8 works with the above?

Thanks in advance.

Jakob Kummerow

unread,
Oct 5, 2015, 4:59:46 PM10/5/15
to v8-users
The whole point of a MaybeLocal is that it may (or may not) contain a value. Calling .ToLocalChecked() on it is unsafe, unless you happen to know that it can't be empty. shell.cc:416 is doing it wrong. d8.cc:883 is doing it right.

A callback throwing an exception is the canonical example of a function that possibly returns no value, in which case its MaybeLocal return value is empty. The reason we've introduced MaybeLocals is so embedders can be sure they've covered all the places where they have to check for exceptions being thrown, since they can't accidentally convert from MaybeLocal to Local without explicitly checking for emptiness.


--
--
v8-users mailing list
v8-u...@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups "v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jane Chen

unread,
Oct 5, 2015, 7:49:13 PM10/5/15
to v8-users
Thanks.  Any tip in debugging this kind of failures?  I don't seem to get a stack even though I'm using debug build both for v8 and my embedding app.

Jane Chen

unread,
Oct 5, 2015, 8:59:03 PM10/5/15
to v8-users
Actually, forget that.  I do get stack for shell.  Not sure why I'm not getting it in my app.  Looking...
Reply all
Reply to author
Forward
0 new messages