You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think I've managed to recreate a similar instance and the stack trace looks like:
sing host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `/home/midawson/newpull/land/node/out/Release/node --expose-gc --no-concurrent-a'.Program terminated with signal SIGSEGV, Segmentation fault.#0 0x0000000000e9ffe1 in v8::internal::GlobalHandles::Destroy(unsigned long*) ()[Current thread is 1 (Thread 0x7fda22e537c0 (LWP 2218825))]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 0x0000000000e9ffe1 in v8::internal::GlobalHandles::Destroy(unsigned long*) ()#1 0x0000000000ad98dd in napi_resolve_deferred ()#2 0x00007fda20085ebd in Napi::Promise::Deferred::Resolve (this=0x5935dc0, value=0x5945090) at ../../napi-inl.h:2170#3 0x00007fda200b272c in (anonymous namespace)::TSFNWrap::<lambda(Napi::Env, Napi::Reference<Napi::Value>*)>::operator()(Napi::Env, Napi::Reference<Napi::Value> *) const (__closure=0x5939dc8, env=..., ctx=0x5a09dc0) at ../threadsafe_function/threadsafe_function_ctx.cc:51#4 0x00007fda200b386b in Napi::details::ThreadSafeFinalize<Napi::Reference<Napi::Value>, (anonymous namespace)::TSFNWrap::TSFNWrap(const Napi::CallbackInfo&)::<lambda(Napi::Env, Napi::Reference<Napi::Value>*)>, void>::FinalizeWrapperWithContext(napi_env, void *, void *) (env=0x5979870, rawFinalizeData=0x5939dc0, rawContext=0x5a09dc0) at ../../napi-inl.h:245#5 0x0000000000aeb97d in node::Environment::CloseHandle<uv_handle_s, v8impl::(anonymous namespace)::ThreadSafeFunction::CloseHandlesAndMaybeDelete(bool)::{lambda(uv_handle_s*)#1}>(uv_handle_s*, v8impl::(anonymous namespace)::ThreadSafeFunction::CloseHandlesAndMaybeDelete(bool)::{lambda(uv_handle_s*)#1})::{lambda(uv_handle_s*)#1}::_FUN(uv_handle_s*) ()#6 0x00000000015b4155 in uv__finish_close (handle=0x596ed78) at ../deps/uv/src/unix/core.c:303#7 uv__run_closing_handles (loop=0x487e080 <default_loop_struct>) at ../deps/uv/src/unix/core.c:317#8 uv_run (loop=0x487e080 <default_loop_struct>, mode=UV_RUN_DEFAULT) at ../deps/uv/src/unix/core.c:395#9 0x0000000000a63ed5 in node::SpinEventLoop(node::Environment*) () at ../deps/uv/src/unix/core.c:854#10 0x0000000000b64546 in node::NodeMainInstance::Run(node::EnvSerializeInfo const*) () at ../deps/uv/src/unix/core.c:854#11 0x0000000000ae9152 in node::Start(int, char**) () at ../deps/uv/src/unix/core.c:854#12 0x00007fda21b4a7b3 in __libc_start_main () from /lib64/libc.so.6#13 0x0000000000a619ce in _start () at ../deps/uv/src/unix/core.c:854(gdb) Quit
Jul 4 - AIX - Node.js 14.x - crash after
Running test 'threadsafe_function/threadsafe_function'
Running test 'threadsafe_function/threadsafe_function_ctx'
Tests aborted with SIGSEGV
June 28 - OSX 15 - master - crash after
Running test 'threadsafe_function/threadsafe_function'
Running test 'threadsafe_function/threadsafe_function_ctx'
Tests aborted with SIGSEGV
Jun 25 - OSX 14 - 16.x -
Running test 'threadsafe_function/threadsafe_function'
Running test 'threadsafe_function/threadsafe_function_ctx'
Mismatched noop function calls. Expected exactly 1, actual 0.
at Object.exports.mustCall (/Users/iojs/build/workspace/node-test-node-addon-api-new/no
From other issues believe this might have been OSX specific issue
June 22 - Fedora - 14.x - Crash after
Running test 'threadsafe_function/threadsafe_function'
Running test 'threadsafe_function/threadsafe_function_ctx'
Tests aborted with SIGSEGV
npm ERR! Test failed. See
warning: Loadable section ".note.gnu.property" outside of ELF segments
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `/home/midawson/newpull/land/node/out/Debug/node --expose-gc --no-concurrent-arr'.
Program terminated with signal SIGTRAP, Trace/breakpoint trap.
#0 v8::base::OS::<lambda()>::operator() (__closure=<optimized out>) at ../deps/v8/src/base/platform/platform-posix.cc:502
502 IMMEDIATE_CRASH();
[Current thread is 1 (Thread 0x7efe8ee2f7c0 (LWP 1991247))]
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 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 0x0000000002d81368 in V8_Fatal (file=0x36a6a20 "../deps/v8/src/handles/global-handles.cc", line=497,
format=format@entry=0x59240d2 "Debug check failed: %s.") at ../deps/v8/src/base/logging.cc:167
#3 0x0000000002d81383 in v8::base::(anonymous namespace)::DefaultDcheckHandler (file=<optimized out>, line=<optimized out>,
message=<optimized out>) at ../deps/v8/src/base/logging.cc:57
#4 0x000000000166cbfe in v8::internal::GlobalHandles::Node::next_free (this=<optimized out>) at /usr/include/c++/8/bits/basic_string.h:2290
#5 v8::internal::GlobalHandles::NodeSpace<v8::internal::GlobalHandles::Node>::Acquire (object=..., this=0x748d4f0)
at ../deps/v8/src/handles/global-handles.cc:224
#6 v8::internal::GlobalHandles::Create (this=0x748d440, value=...) at ../deps/v8/src/handles/global-handles.cc:937
#7 0x000000000166cd65 in v8::internal::GlobalHandles::Create (this=<optimized out>, value=<optimized out>)
at ../deps/v8/src/objects/tagged-impl.h:38
#8 0x00000000013ca5fd in v8::V8::GlobalizeReference (isolate=0x7467280, obj=0x74d7ef8) at ../deps/v8/src/execution/isolate.h:1125
#9 0x00000000010be9c5 in v8::PersistentBase<v8::Value>::New (isolate=0x7467280, that=0x74d7ef8) at ../deps/v8/include/v8.h:10906
#10 0x00000000010d81d4 in v8::PersistentBase<v8::Value>::Reset<v8::Promise::Resolver> (this=0x74576a0, isolate=0x7467280, other=...)
at ../deps/v8/include/v8.h:10945
#11 0x00000000010d5b40 in napi_create_promise (env=0x75e63c0, deferred=0x74587d8, promise=0x74587e0) at ../src/js_native_api_v8.cc:3042
#12 0x00007efe7ed5fdf2 in Napi::Promise::Deferred::Deferred (this=0x74587d0, env=0x75e63c0) at ../../napi-inl.h:2157
#13 0x00007efe7ed8c520 in (anonymous namespace)::TSFNWrap::Release (this=0x75dc050, info=...)
at ../threadsafe_function/threadsafe_function_ctx.cc:21
#14 0x00007efe7ed8cfac in Napi::InstanceWrap<(anonymous namespace)::TSFNWrap>::<lambda()>::operator()(void) const (this=0x7ffe1c6fbd30)
at ../../napi-inl.h:3617
#15 0x00007efe7ed8dadb in Napi::details::WrapCallback<Napi::InstanceWrap<T>::InstanceMethodCallbackWrapper(napi_env, napi_callback_info) [with T = (anonymous namespace)::TSFNWrap]::<lambda()> >(Napi::InstanceWrap<(anonymous namespace)::TSFNWrap>::<lambda()>) (callback=...)
at ../../napi-inl.h:74
#16 0x00007efe7ed8d029 in Napi::InstanceWrap<(anonymous namespace)::TSFNWrap>::InstanceMethodCallbackWrapper (env=0x75e63c0,
info=0x7ffe1c6fbe90) at ../../napi-inl.h:3610
#17 0x00000000010c9662 in v8impl::(anonymous namespace)::CallbackWrapperBase::<lambda(napi_env)>::operator()(napi_env) const (
__closure=0x7ffe1c6fbe50, env=0x75e63c0) at ../src/js_native_api_v8.cc:311
#18 0x00000000010d67c9 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=0x75e63c0,
call=..., handle_exception=
@0x10d73da: {void (napi_env__ *, v8::Local<v8::Value>)} 0x10d73da <napi_env__::HandleThrow(napi_env__*, v8::Local<v8::Value>)>)
at ../src/js_native_api_v8.h:95
#19 0x00000000010c96d1 in v8impl::(anonymous namespace)::CallbackWrapperBase::InvokeCallback (this=0x7ffe1c6fbe90)
at ../src/js_native_api_v8.cc:310
#20 0x00000000010c9726 in v8impl::(anonymous namespace)::FunctionCallbackWrapper::Invoke (info=...) at ../src/js_native_api_v8.cc:328
--Type <RET> for more, q to quit, c to continue without paging--
#21 0x000000000146bce0 in v8::internal::FunctionCallbackArguments::Call (this=this@entry=0x7ffe1c6fc000, handler=handler@entry=...)
at ../deps/v8/src/api/api-arguments-inl.h:158
#22 0x000000000146cb07 in v8::internal::(anonymous namespace)::HandleApiCallHelper<false> (isolate=isolate@entry=0x7467280, function=...,
function@entry=..., new_target=..., new_target@entry=..., fun_data=..., receiver=..., receiver@entry=..., args=...)
at ../deps/v8/src/base/platform/wrappers.h:37
#23 0x0000000001471762 in v8::internal::Builtin_Impl_HandleApiCall (args=..., isolate=isolate@entry=0x7467280)
at ../deps/v8/src/handles/handles.h:132
#24 0x00000000014724e7 in v8::internal::Builtin_HandleApiCall (args_length=5, args_object=0x7ffe1c6fc1a8, isolate=0x7467280)
at ../deps/v8/src/builtins/builtins-api.cc:131
#25 0x00000000023156a0 in Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit () at ../../deps/v8/src/builtins/torque-internal.tq:84
#26 0x000000000209102b in Builtins_InterpreterEntryTrampoline () at ../../deps/v8/src/objects/string.tq:183
I'm wondering if this is related to the issue we see in the ci or specific to main. Going to run with 16.x to see if we get the same debug checks there.
@KevinEady still trying to narrow down, I agree it's not obvious why some of those failures could/would happen. I'm thinking maybe we are getting memory corruption which then leads to those asserts. Trying to narrow down recreate but seems like it running a single test does not result in the problem.
Turns out the worker in objectwrap_worker_thread was running in parallel with other tests, not sure if that is related to the crash but have a refactored version that makes sure worker has completed before running the rest of the tests to test out.
15000 runs with the refactor and looking good. Heading out for a long weekend so I don't want to leave running but I'll kickoff longer run on Tuesday and then follow up with PR if its still looks good.
Ok so 41595 more successful runs with the change, will submit a PR. There is an unrelated issue I found along the way but will open a different issue fort that.
Activity
mhdawson commentedon Jul 14, 2021
I think I've managed to recreate a similar instance and the stack trace looks like:
mhdawson commentedon Jul 14, 2021
And another one:
mhdawson commentedon Jul 14, 2021
Related to the last crash
mhdawson commentedon Jul 14, 2021
And
mhdawson commentedon Jul 14, 2021
Going to recompile node in debug mode to see if we get any more info as to what is going on in the GlobalHandles code.
mhdawson commentedon Jul 14, 2021
Of note I am testing with current master, we've seen the similar failure in master. From the CI this is what we have seen lately:
mhdawson commentedon Jul 14, 2021
mhdawson commentedon Jul 15, 2021
Seems like a debug check fires in the same place
mhdawson commentedon Jul 15, 2021
I'm wondering if this is related to the issue we see in the ci or specific to main. Going to run with 16.x to see if we get the same debug checks there.
mhdawson commentedon Jul 15, 2021
16.x seems to have less, just 2 in over 10000 runs so far. This is one of the stack traces:
KevinEady commentedon Jul 15, 2021
I'm not sure but all of the stack traces have GlobalHandles Create and Destroy involved... Is there something wrong with the test's code? Should I create handles? For example, I don't create a handle in Finalize because there wasn't one done in the original Node-API tsfn test https://github.com/nodejs/node/blob/4b0776ab64596d1bbd98a93e3de7cee82a7e8130/test/node-api/test_threadsafe_function/binding.c#L167-L188
But this one is odd:
This one is part of the synchronous stack from JavaScript -> C++ binding
node-addon-api/test/threadsafe_function/threadsafe_function_ctx.cc
Line 47 in e02e8a4
mhdawson commentedon Jul 15, 2021
I tried running just the one test and 30000 iterations led to no recreates so trying with larger set of tests.
mhdawson commentedon Jul 15, 2021
@KevinEady still trying to narrow down, I agree it's not obvious why some of those failures could/would happen. I'm thinking maybe we are getting memory corruption which then leads to those asserts. Trying to narrow down recreate but seems like it running a single test does not result in the problem.
mhdawson commentedon Jul 16, 2021
Have been working through removing just a subset of tests. Seems like if I remove just
objectwrap_worker_thread then I got no failures in 26300 runs. Typically I would have gotten failures long before then.
mhdawson commentedon Jul 16, 2021
objectwrap_worker_thread:
mhdawson commentedon Jul 16, 2021
Turns out the worker in objectwrap_worker_thread was running in parallel with other tests, not sure if that is related to the crash but have a refactored version that makes sure worker has completed before running the rest of the tests to test out.
mhdawson commentedon Jul 16, 2021
15000 runs with the refactor and looking good. Heading out for a long weekend so I don't want to leave running but I'll kickoff longer run on Tuesday and then follow up with PR if its still looks good.
mhdawson commentedon Jul 20, 2021
Ok so 41595 more successful runs with the change, will submit a PR. There is an unrelated issue I found along the way but will open a different issue fort that.
doc: update tests to avoid running in parallel
mhdawson commentedon Jul 20, 2021
Submitted #1024
doc: update tests to avoid running in parallel
doc: update tests to avoid running in parallel
doc: update tests to avoid running in parallel
doc: update tests to avoid running in parallel
doc: update tests to avoid running in parallel
doc: update tests to avoid running in parallel