v8::Context::GetCurrent()->Global()

123 views
Skip to first unread message

jas

unread,
Oct 28, 2014, 3:22:27 PM10/28/14
to nod...@googlegroups.com
I have run into a problem and have tried several thing to resolve the problem. The following code:

if (v8::Context::InContext()) {
  cb
->Call(v8::Context::GetCurrent()->Global(), argc, argv);
}

Is causing the following error (from GDB)

#
# Fatal error in ../deps/v8/src/api.h, line 297
# CHECK(allow_empty_handle || that != __null) failed
#


Program received signal SIGTRAP, Trace/breakpoint trap.
0x00000000009768ae in v8::internal::OS::Abort() ()
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.132.el6_5.4.x86_64 libgcc-4.4.7-4.el6.x86_64 libpcap-1.4.0-1.20130826git2dbcaa1.el6.x86_64 libstdc++-4.4.7-4.el6.x86_64
(gdb) bt
#0  0x00000000009768ae in v8::internal::OS::Abort() ()
#1  0x000000000070efed in V8_Fatal ()
#2  0x00000000006dcedb in v8::Function::Call(v8::Handle<v8::Object>, int, v8::Handle<v8::Value>*) ()
#3  0x00007ffff6a7b2ae in Report(uv_async_s*, int) () from /home/jas/projects/mine/libmasscan/build/Release/masscan.node
#4  0x00000000009d5079 in uv__async_event (loop=0xf07600, w=<value optimized out>, nevents=<value optimized out>)
    at
../deps/uv/src/unix/async.c:80
#5  0x00000000009d5303 in uv__async_io (loop=0xf07600, w=0xf07778, events=<value optimized out>) at ../deps/uv/src/unix/async.c:151
#6  0x00000000009e24a8 in uv__io_poll (loop=0xf07600, timeout=-1) at ../deps/uv/src/unix/linux-core.c:271
#7  0x00000000009d5eb8 in uv_run (loop=0xf07600, mode=<value optimized out>) at ../deps/uv/src/unix/core.c:317
#8  0x0000000000982a1c in node::Start(int, char**) ()
#9  0x00007ffff6c9ed5d in __libc_start_main () from /lib64/libc.so.6
#10 0x00000000005a51e9 in _start ()

I thought that checking the current context prior to executing the callback would alleviate the problem but obviously I was wrong. Any assistance is appreciated.

Louis Santillan

unread,
Oct 29, 2014, 10:21:16 AM10/29/14
to nod...@googlegroups.com
It looks like you're trying to call the Global object, which makes no
sense JS since the Global object isn't accessible in that way. It
also wouldn't make sense from the v8 side unless you had set a getter
on it.
> --
> Job board: http://jobs.nodejs.org/
> New group rules:
> https://gist.github.com/othiym23/9886289#file-moderation-policy-md
> Old group rules:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nodejs+un...@googlegroups.com.
> To post to this group, send email to nod...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nodejs/eca9e6a6-0f13-446c-8940-6b138a7750fb%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

jas

unread,
Oct 29, 2014, 12:53:21 PM10/29/14
to nod...@googlegroups.com
Can you explain that since every example and piece of documentation regarding Local<Function>, Persistent<Function> all indicate the inherited function Call() requires access to the current context as indicated by cb->Call(Context::GetCurrent()->Global(), argc, argv).
Reply all
Reply to author
Forward
0 new messages