Skip to content

The embedded Node.js example leads to a crash #42670

@mmomtchev

Description

@mmomtchev

Version

18.x

Platform

Linux

Subsystem

Embedded Node

What steps will reproduce the bug?

Compile and run the example from https://github.com/nodejs/node/blob/master/doc/api/embedding.md

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior?

A working example

What do you see instead?

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff24ba700 (LWP 352617)]
[New Thread 0x7ffff1cb9700 (LWP 352618)]
[New Thread 0x7ffff14b8700 (LWP 352619)]
[New Thread 0x7ffff0cb7700 (LWP 352620)]
[New Thread 0x7fffebfff700 (LWP 352621)]
[New Thread 0x7ffff2a84700 (LWP 352622)]
FATAL ERROR: v8::HandleScope::CreateHandle() Cannot create a handle without a HandleScope
 1: 0x7ffff3707ddc node::Abort() [/home/mmom/src/node/out/Release/libnode.so.105]
 2: 0x7ffff36014a8  [/home/mmom/src/node/out/Release/libnode.so.105]
 3: 0x7ffff412e2e1 v8::Utils::ReportApiFailure(char const*, char const*) [/home/mmom/src/node/out/Release/libnode.so.105]
 4: 0x7ffff42b3aa6 v8::internal::HandleScope::Extend(v8::internal::Isolate*) [/home/mmom/src/node/out/Release/libnode.so.105]
 5: 0x7ffff412f73d v8::HandleScope::CreateHandle(v8::internal::Isolate*, unsigned long) [/home/mmom/src/node/out/Release/libnode.so.105]
 6: 0x7ffff362fe76 node::CommonEnvironmentSetup::context() const [/home/mmom/src/node/out/Release/libnode.so.105]
 7: 0x5555555568f8  [/home/mmom/src/embedded_node/embedded_node]
 8: 0x555555556ccc  [/home/mmom/src/embedded_node/embedded_node]
 9: 0x7ffff26a00b3 __libc_start_main [/lib/x86_64-linux-gnu/libc.so.6]
10: 0x55555555666e  [/home/mmom/src/embedded_node/embedded_node]

Thread 1 "embedded_node" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007ffff269e859 in __GI_abort () at abort.c:79
#2  0x00007ffff3707de9 in node::Abort() () from /home/mmom/src/node/out/Release/libnode.so.105
#3  0x00007ffff36014a8 in node::OnFatalError(char const*, char const*) () from /home/mmom/src/node/out/Release/libnode.so.105
#4  0x00007ffff412e2e1 in v8::Utils::ReportApiFailure(char const*, char const*) () from /home/mmom/src/node/out/Release/libnode.so.105
#5  0x00007ffff42b3aa6 in v8::internal::HandleScope::Extend(v8::internal::Isolate*) () from /home/mmom/src/node/out/Release/libnode.so.105
#6  0x00007ffff412f73d in v8::HandleScope::CreateHandle(v8::internal::Isolate*, unsigned long) () from /home/mmom/src/node/out/Release/libnode.so.105
#7  0x00007ffff362fe76 in node::CommonEnvironmentSetup::context() const () from /home/mmom/src/node/out/Release/libnode.so.105
#8  0x00005555555568f8 in RunNodeInstance (platform=0x555555587b60, args=std::vector of length 1, capacity 1 = {...}, exec_args=std::vector of length 0, capacity 0) at embedded_node.cc:23
#9  0x0000555555556ccc in main (argc=1, argv=0x7fffffffdda8) at embedded_node.cc:77
(gdb) frame 8
#8  0x00005555555568f8 in RunNodeInstance (platform=0x555555587b60, args=std::vector of length 1, capacity 1 = {...}, exec_args=std::vector of length 0, capacity 0) at embedded_node.cc:23
23	        v8::Context::Scope context_scope(setup->context());

Additional information

A handle scope is missing

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions