Skip to content

Debug check failed when Node.js compiled in Debug mode #1025

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mhdawson opened this issue Jul 20, 2021 · 3 comments
Closed

Debug check failed when Node.js compiled in Debug mode #1025

mhdawson opened this issue Jul 20, 2021 · 3 comments

Comments

@mhdawson
Copy link
Member

When Node.js is compiled as debug and used to run the Node-api tests the functionrefernce test fails with a Fatal error:

Running test 'external'
Running test 'function'
Running test 'functionreference'


#
# Fatal error in ../deps/v8/src/objects/tagged-impl.h, line 92
# Debug check failed: kCanBeWeak || (!IsSmi() == (((static_cast<i::Tagged_t>(ptr_) & ::i::kHeapObjectTagMask) == ::i::kHeapObjectTag))).
#
#
#
#FailureMessage Object: 0x7fff116bde10
 1: 0x1061791 node::DumpBacktrace(_IO_FILE*) [/home/midawson/newpull/land/node/out/Debug/node]
 2: 0x1204d6b  [/home/midawson/newpull/land/node/out/Debug/node]
 3: 0x1204d8b  [/home/midawson/newpull/land/node/out/Debug/node]
 4: 0x2d82057 V8_Fatal(char const*, int, char const*, ...) [/home/midawson/newpull/land/node/out/Debug/node]
 5: 0x2d82083  [/home/midawson/newpull/land/node/out/Debug/node]
 6: 0x146cf34 v8::internal::Handle<v8::internal::Object> v8::internal::CustomArguments<v8::FunctionCallbackInfo<v8::Value> >::GetReturnValue<v8::internal::Object>(v8::internal::Isolate*) [/home/midawson/newpull/land/node/out/Debug/node]
 7: 0x146d19b v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/home/midawson/newpull/land/node/out/Debug/node]
 8: 0x146dfb7  [/home/midawson/newpull/land/node/out/Debug/node]
 9: 0x1472c12  [/home/midawson/newpull/land/node/out/Debug/node]
10: 0x1473997 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/home/midawson/newpull/land/node/out/Debug/node]
11: 0x2317020  [/home/midawson/newpull/land/node/out/Debug/node]
Tests aborted with SIGTRAP
@mhdawson
Copy link
Member Author

mhdawson commented Jul 20, 2021

Stack trace from core file under gdb

#0  0x00007f9eed4867ff in raise () from /lib64/libc.so.6
[Current thread is 1 (Thread 0x7f9eee77b7c0 (LWP 3445048))]
Missing separate debuginfos, use: yum debuginfo-install glibc-2.28-127.el8.x86_64 libgcc-8.3.1-5.1.el8.x86_64 libstdc++-8.3.1-5.1.el8.x86_64
(gdb) bt
#0  0x00007f9eed4867ff in raise () from /lib64/libc.so.6
#1  0x00007f9eed470c35 in abort () from /lib64/libc.so.6
#2  0x0000000001145f2a in node::Abort () at ../src/node_errors.cc:254
#3  0x0000000001146d89 in node::OnFatalError (location=0x66911a0 "Error::ThrowFatalError", message=0x678ca80 "This is a fatal error")
    at ../src/node_errors.cc:444
#4  0x0000000001146c12 in node::FatalError (location=0x66911a0 "Error::ThrowFatalError", message=0x678ca80 "This is a fatal error")
    at ../src/node_errors.cc:415
#5  0x00000000010f29fd in napi_fatal_error (location=0x7f9eec210713 "Error::ThrowFatalError", location_len=18446744073709551615, 
    message=0x7f9eec2106fd "This is a fatal error", message_len=18446744073709551615) at ../src/node_api.cc:763
#6  0x00007f9eec1a14e0 in Napi::Error::Fatal (location=0x7f9eec210713 "Error::ThrowFatalError", message=0x7f9eec2106fd "This is a fatal error")
    at ../../napi-inl.h:2364
#7  0x00007f9eec1bcb56 in (anonymous namespace)::ThrowFatalError () at ../error.cc:215
#8  0x00007f9eec1a9d16 in Napi::details::CallbackData<void (*)(Napi::CallbackInfo const&), void>::Wrapper(napi_env__*, napi_callback_info__*)::{lambda()#1}::operator()() const (this=0x7ffdecaf02d0) at ../../napi-inl.h:130
#9  0x00007f9eec1a9efc in Napi::details::WrapCallback<Napi::details::CallbackData<void (*)(Napi::CallbackInfo const&), void>::Wrapper(napi_env__*, napi_callback_info__*)::{lambda()#1}>(Napi::details::CallbackData<void (*)(Napi::CallbackInfo const&), void>::Wrapper(napi_env__*, napi_callback_info__*)::{lambda()#1}) (callback=...) at ../../napi-inl.h:74
#10 0x00007f9eec1a9d89 in Napi::details::CallbackData<void (*)(Napi::CallbackInfo const&), void>::Wrapper (env=0x668b8b0, info=0x7ffdecaf0420)
    at ../../napi-inl.h:125
#11 0x00000000010c9632 in v8impl::(anonymous namespace)::CallbackWrapperBase::<lambda(napi_env)>::operator()(napi_env) const (
    __closure=0x7ffdecaf03e0, env=0x668b8b0) at ../src/js_native_api_v8.cc:311
#12 0x00000000010d67c1 in napi_env__::CallIntoModule<v8impl::(anonymous namespace)::CallbackWrapperBase::InvokeCallback()::<lambda(napi_env)> >(v8impl::(anonymous namespace)::CallbackWrapperBase::<lambda(napi_env)> &&, void (&&)(napi_env__ *, v8::Local<v8::Value>)) (this=0x668b8b0, 
    call=..., handle_exception=
    @0x10d73d2: {void (napi_env__ *, v8::Local<v8::Value>)} 0x10d73d2 <napi_env__::HandleThrow(napi_env__*, v8::Local<v8::Value>)>)
    at ../src/js_native_api_v8.h:95
#13 0x00000000010c96a1 in v8impl::(anonymous namespace)::CallbackWrapperBase::InvokeCallback (this=0x7ffdecaf0420)
    at ../src/js_native_api_v8.cc:310
#14 0x00000000010c96f6 in v8impl::(anonymous namespace)::FunctionCallbackWrapper::Invoke (info=...) at ../src/js_native_api_v8.cc:328
#15 0x000000000146d190 in v8::internal::FunctionCallbackArguments::Call (this=this@entry=0x7ffdecaf0590, handler=handler@entry=...)
    at ../deps/v8/src/api/api-arguments-inl.h:158
#16 0x000000000146dfb7 in v8::internal::(anonymous namespace)::HandleApiCallHelper<false> (isolate=isolate@entry=0x65f9000, function=..., 
    function@entry=..., new_target=..., new_target@entry=..., fun_data=..., receiver=..., receiver@entry=..., args=...)
    at ../deps/v8/src/base/platform/wrappers.h:37
#17 0x0000000001472c12 in v8::internal::Builtin_Impl_HandleApiCall (args=..., isolate=isolate@entry=0x65f9000)
    at ../deps/v8/src/handles/handles.h:132
#18 0x0000000001473997 in v8::internal::Builtin_HandleApiCall (args_length=5, args_object=0x7ffdecaf0730, isolate=0x65f9000)
    at ../deps/v8/src/builtins/builtins-api.cc:131
#19 0x0000000002317020 in Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit () at ../../deps/v8/src/builtins/torque-internal.tq:84
#20 0x00000000020929ab in Builtins_InterpreterEntryTrampoline () at ../../deps/v8/src/objects/string.tq:183

@mhdawson
Copy link
Member Author

Stack trace when running under gdb which is more helpful, not sure why it's different bu in any case:

hread 1 "node" received signal SIGTRAP, Trace/breakpoint trap.
v8::base::OS::<lambda()>::operator() (__closure=<optimized out>) at ../deps/v8/src/base/platform/platform-posix.cc:502
502	    IMMEDIATE_CRASH();
Missing separate debuginfos, use: yum debuginfo-install libgcc-8.3.1-5.1.el8.x86_64 libstdc++-8.3.1-5.1.el8.x86_64
(gdb) bt
#0  v8::base::OS::<lambda()>::operator() (__closure=<optimized out>) at ../deps/v8/src/base/platform/platform-posix.cc:502
#1  v8::base::OS::Abort () at ../deps/v8/src/base/platform/platform-posix.cc:502
#2  0x0000000002d82068 in V8_Fatal (file=0x36235a8 "../deps/v8/src/objects/tagged-impl.h", line=92, format=format@entry=0x590eef2 "Debug check failed: %s.")
    at ../deps/v8/src/base/logging.cc:167
#3  0x0000000002d82083 in v8::base::(anonymous namespace)::DefaultDcheckHandler (file=<optimized out>, line=<optimized out>, message=<optimized out>)
    at ../deps/v8/src/base/logging.cc:57
#4  0x000000000146cf34 in v8::internal::TaggedImpl<(v8::internal::HeapObjectReferenceType)1, unsigned long>::IsStrong (this=0x7fffffffd0f0)
    at ../deps/v8/src/objects/heap-object.h:222
#5  v8::internal::TaggedImpl<(v8::internal::HeapObjectReferenceType)1, unsigned long>::IsHeapObject (this=0x7fffffffd0f0)
    at ../deps/v8/src/objects/tagged-impl.h:75
#6  v8::internal::Object::VerifyApiCallResultType (this=0x7fffffffd0f0) at ../deps/v8/src/api/api-arguments-inl.h:24
#7  v8::internal::CustomArguments<v8::FunctionCallbackInfo<v8::Value> >::GetReturnValue<v8::internal::Object> (this=this@entry=0x7fffffffd260, 
    isolate=isolate@entry=0x60cdcf0) at ../deps/v8/src/api/api-arguments-inl.h:48
#8  0x000000000146d19b in v8::internal::FunctionCallbackArguments::Call (this=this@entry=0x7fffffffd260, handler=handler@entry=...)
    at ../deps/v8/src/api/api-arguments-inl.h:159
#9  0x000000000146dfb7 in v8::internal::(anonymous namespace)::HandleApiCallHelper<false> (isolate=isolate@entry=0x60cdcf0, function=..., function@entry=..., 
    new_target=..., new_target@entry=..., fun_data=..., receiver=..., receiver@entry=..., args=...) at ../deps/v8/src/base/platform/wrappers.h:37
#10 0x0000000001472c12 in v8::internal::Builtin_Impl_HandleApiCall (args=..., isolate=isolate@entry=0x60cdcf0) at ../deps/v8/src/handles/handles.h:132
#11 0x0000000001473997 in v8::internal::Builtin_HandleApiCall (args_length=6, args_object=0x7fffffffd408, isolate=0x60cdcf0)
    at ../deps/v8/src/builtins/builtins-api.cc:131
#12 0x0000000002317020 in Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit () at ../../deps/v8/src/builtins/torque-internal.tq:84
#13 0x00000000020929ab in Builtins_InterpreterEntryTrampoline () at ../../deps/v8/src/objects/string.tq:183

@mhdawson
Copy link
Member Author

Believe I have the fix, testing a PR now.

mhdawson added a commit to mhdawson/io.js that referenced this issue Jul 21, 2021
fixes: nodejs/node-addon-api#1025

The functionreference test from the node-api tests
was reporting a failed v8 check when Node.js was compiled
as debug. The failure was because an exception was
pending but the C++ wrappers were returning
a return value that was invalid.

Signed-off-by: Michael Dawson <[email protected]>
mhdawson added a commit to mhdawson/io.js that referenced this issue Jul 21, 2021
fixes: nodejs/node-addon-api#1025

The functionreference test from the node-api tests
was reporting a failed v8 check when Node.js was compiled
as debug. The failure was because an exception was
pending but the C++ wrappers were returning
a return value that was invalid.

Signed-off-by: Michael Dawson <[email protected]>
danielleadams pushed a commit to nodejs/node that referenced this issue Aug 16, 2021
fixes: nodejs/node-addon-api#1025

The functionreference test from the node-api tests
was reporting a failed v8 check when Node.js was compiled
as debug. The failure was because an exception was
pending but the C++ wrappers were returning
a return value that was invalid.

Signed-off-by: Michael Dawson <[email protected]>

PR-URL: #39476
Fixes: nodejs/node-addon-api#1025
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
targos pushed a commit to nodejs/node that referenced this issue Sep 4, 2021
fixes: nodejs/node-addon-api#1025

The functionreference test from the node-api tests
was reporting a failed v8 check when Node.js was compiled
as debug. The failure was because an exception was
pending but the C++ wrappers were returning
a return value that was invalid.

Signed-off-by: Michael Dawson <[email protected]>

PR-URL: #39476
Fixes: nodejs/node-addon-api#1025
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant