Repository navigation
function_reference test failure when using Debug build of node v20.13.1 #1511
Copy link
Copy link
Closed
Labels
Description
Using node v20.13.1 built with debug configuration according to Building: Building a debug build fails:
> node-addon-api@8.0.0 test
> /Users/kevineady/Projects/node/out/Debug/node test
napiVersion:9
Testing with Node-API Version '9'.
Starting test suite
Running test 'addon'
Running test 'addon_build'
....
Running test 'function_reference'
#
# Fatal error in ../deps/v8/src/objects/tagged-impl.h, line 142
# Debug check failed: kCanBeWeak || (!IsSmi() == HAS_STRONG_HEAP_OBJECT_TAG(ptr_)).
#
#
#
#FailureMessage Object: 0x16afc4988
----- Native stack trace -----
1: 0x104ef3bd8 node::DumpNativeBacktrace(__sFILE*) [/Users/kevineady/Projects/node/out/Debug/node]
2: 0x105142570 node::NodePlatform::GetStackTracePrinter()::$_3::operator()() const [/Users/kevineady/Projects/node/out/Debug/node]
3: 0x10514252c node::NodePlatform::GetStackTracePrinter()::$_3::__invoke() [/Users/kevineady/Projects/node/out/Debug/node]
4: 0x106f645d4 V8_Fatal(char const*, int, char const*, ...) [/Users/kevineady/Projects/node/out/Debug/node]
5: 0x106f64170 std::__1::enable_if<!std::is_function<std::__1::remove_pointer<char>::type>::value && !std::is_enum<char>::value && has_output_operator<char, v8::base::CheckMessageStream>::value, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>::type v8::base::PrintCheckOperand<char>(char) [/Users/kevineady/Projects/node/out/Debug/node]
6: 0x1054d6ce4 v8::internal::Object::IsApiCallResultType() const [/Users/kevineady/Projects/node/out/Debug/node]
7: 0x1054d6b28 v8::internal::Handle<v8::internal::Object> v8::internal::CustomArguments<v8::FunctionCallbackInfo<v8::Value>>::GetReturnValue<v8::internal::Object>(v8::internal::Isolate*) const [/Users/kevineady/Projects/node/out/Debug/node]
8: 0x1054d6974 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/Users/kevineady/Projects/node/out/Debug/node]
9: 0x1054d56e0 v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, unsigned long*, int) [/Users/kevineady/Projects/node/out/Debug/node]
10: 0x1054d4304 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/Users/kevineady/Projects/node/out/Debug/node]
11: 0x1064a24a4 Builtins_CEntry_Return1_ArgvOnStack_BuiltinExit [/Users/kevineady/Projects/node/out/Debug/node]
12: 0x106407404 Builtins_InterpreterEntryTrampoline [/Users/kevineady/Projects/node/out/Debug/node]
13: 0x106407404 Builtins_InterpreterEntryTrampoline [/Users/kevineady/Projects/node/out/Debug/node]
14: 0x106407404 Builtins_InterpreterEntryTrampoline [/Users/kevineady/Projects/node/out/Debug/node]
15: 0x10cb233d0
16: 0x1064437d0 Builtins_AsyncFunctionAwaitResolveClosure [/Users/kevineady/Projects/node/out/Debug/node]
17: 0x106519480 Builtins_PromiseFulfillReactionJob [/Users/kevineady/Projects/node/out/Debug/node]
18: 0x1064309ec Builtins_RunMicrotasks [/Users/kevineady/Projects/node/out/Debug/node]
19: 0x106404cd4 Builtins_JSRunMicrotasksEntry [/Users/kevineady/Projects/node/out/Debug/node]
20: 0x1056db714 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/Users/kevineady/Projects/node/out/Debug/node]
21: 0x1056dc6f4 v8::internal::(anonymous namespace)::InvokeWithTryCatch(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/Users/kevineady/Projects/node/out/Debug/node]
22: 0x1056dcca8 v8::internal::Execution::TryRunMicrotasks(v8::internal::Isolate*, v8::internal::MicrotaskQueue*) [/Users/kevineady/Projects/node/out/Debug/node]
23: 0x1057272b4 v8::internal::MicrotaskQueue::RunMicrotasks(v8::internal::Isolate*) [/Users/kevineady/Projects/node/out/Debug/node]
24: 0x10572702c v8::internal::MicrotaskQueue::PerformCheckpointInternal(v8::Isolate*) [/Users/kevineady/Projects/node/out/Debug/node]
25: 0x104e3548c node::InternalCallbackScope::Close() [/Users/kevineady/Projects/node/out/Debug/node]
26: 0x104e352a8 node::InternalCallbackScope::~InternalCallbackScope() [/Users/kevineady/Projects/node/out/Debug/node]
27: 0x104e34db8 node::InternalCallbackScope::~InternalCallbackScope() [/Users/kevineady/Projects/node/out/Debug/node]
28: 0x105039684 node::fs::FSReqPromise<node::AliasedBufferBase<double, v8::Float64Array>>::Resolve(v8::Local<v8::Value>) [/Users/kevineady/Projects/node/out/Debug/node]
29: 0x105055178 node::fs::AfterNoArgs(uv_fs_s*) [/Users/kevineady/Projects/node/out/Debug/node]
30: 0x10503b16c node::MakeLibuvRequestCallback<uv_fs_s, void (*)(uv_fs_s*)>::Wrapper(uv_fs_s*) [/Users/kevineady/Projects/node/out/Debug/node]
31: 0x1063d8584 uv__fs_done [/Users/kevineady/Projects/node/out/Debug/node]
32: 0x1063ca6d4 uv__work_done [/Users/kevineady/Projects/node/out/Debug/node]
33: 0x1063d3690 uv__async_io [/Users/kevineady/Projects/node/out/Debug/node]
34: 0x1063f6f08 uv__io_poll [/Users/kevineady/Projects/node/out/Debug/node]
35: 0x1063d4090 uv_run [/Users/kevineady/Projects/node/out/Debug/node]
36: 0x104e38540 node::SpinEventLoopInternal(node::Environment*) [/Users/kevineady/Projects/node/out/Debug/node]
37: 0x1050cf80c node::NodeMainInstance::Run(node::ExitCode*, node::Environment*) [/Users/kevineady/Projects/node/out/Debug/node]
38: 0x1050cf3d8 node::NodeMainInstance::Run() [/Users/kevineady/Projects/node/out/Debug/node]
39: 0x104fb1cd0 node::StartInternal(int, char**) [/Users/kevineady/Projects/node/out/Debug/node]
40: 0x104fb18ec node::Start(int, char**) [/Users/kevineady/Projects/node/out/Debug/node]
41: 0x10699a1c4 main [/Users/kevineady/Projects/node/out/Debug/node]
42: 0x18d1d1058 start [/usr/lib/dyld]
Tests aborted with SIGTRAP
The same failure happens when calling node --expose-gc test/function_reference.js directly, so the failure is not related to other tests.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
github-actions commentedon Sep 3, 2024
This issue is stale because it has been open many days with no activity. It will be closed soon unless the stale label is removed or a comment is made.
KevinEady commentedon Jun 27, 2025
@KevinEady to check if this is still the case
KevinEady commentedon Jul 3, 2025
The error has changed to a SEGV on debug version of Node.js v22.17.0.
I've pinpointed it to this line:
https://github.com/KevinEady/node-addon-api/blob/600fe6c114a127ea11fc7909e08bf623dfadea95/test/function_reference.js#L55
But it is not an issue with the C++ function
ConstructRefFromExisitingRefitself ... It seems to be the caller calling it.KevinEady commentedon Jul 11, 2025
We discussed this in the 11 July Node-API Meeting.
We need to identify if there is a problem with (1) our use of the APIs or (2) how the Node.js Debug build executes our addon.
The test failing is a "move function reference test"
node-addon-api/test/function_reference.cc
Lines 32 to 40 in 915edb3
Napi::Functions are being called and returned correctly -- both thefunction_reference.jscall to our addon'sConstructRefFromExisitingRef, as well as this function's call tomovedRef({}).@legendecas mentioned he will take a look when he gets a chance ... This is a bit too in the weeds of my Node.js knowledge to troubleshoot any further 😅
KevinEady commentedon Aug 1, 2025
@KevinEady to check if #1676 fixes the above crash