Skip to content
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

Segmentation fault in node 13 #48

Closed
swahlgren-r7 opened this issue Dec 9, 2019 · 1 comment
Closed

Segmentation fault in node 13 #48

swahlgren-r7 opened this issue Dec 9, 2019 · 1 comment

Comments

@swahlgren-r7
Copy link

Requiring ffi-napi module results in a segmentation fault:

$ node -e "var ffi = require('ffi-napi')"
zsh: segmentation fault (core dumped)  node -e "var ffi = require('ffi-napi')"

Tested with node version v13.3.0.

@gengjiawen
Copy link

gengjiawen commented Dec 27, 2019

Same on Node.js 13.5.0. Works on Node.js 12.

fish: 'node -e "var ffi = require('ffi…' terminated by signal SIGSEGV (Address boundary error)

Detailed log with debug version of Node.js on master

cc @addaleax

#
# Fatal error in ../../deps/v8/src/objects/backing-store.cc, line 581
# Check failed: result.second.
#
#
#

#FailureMessage Object: 0x7ffeefbfc180
 1: 0x1000cba5c node::DumpBacktrace(__sFILE*) [/usr/local/bin/node_g]
 2: 0x1002df436 node::NodePlatform::GetStackTracePrinter()::$_3::operator()() const [/usr/local/bin/node_g]
 3: 0x1002df3f9 node::NodePlatform::GetStackTracePrinter()::$_3::__invoke() [/usr/local/bin/node_g]
 4: 0x101cbe535 V8_Fatal(char const*, int, char const*, ...) [/usr/local/bin/node_g]
 5: 0x1009a6dd0 v8::internal::GlobalBackingStoreRegistry::Register(std::__1::shared_ptr<v8::internal::BackingStore>) [/usr/local/bin/node_g]
 6: 0x10050943e v8::ArrayBuffer::GetBackingStore() [/usr/local/bin/node_g]
 7: 0x100188498 node::Buffer::New(node::Environment*, char*, unsigned long, void (*)(char*, void*), void*) [/usr/local/bin/node_g]
 8: 0x1001882b6 node::Buffer::New(v8::Isolate*, char*, unsigned long, void (*)(char*, void*), void*) [/usr/local/bin/node_g]
 9: 0x100173455 napi_create_external_buffer [/usr/local/bin/node_g]
10: 0x1100469a8 Napi::Buffer<char> Napi::Buffer<char>::New<Napi::Value FFI::WrapPointer<_ffi_type>(Napi::Env, _ffi_type*, unsigned long)::'lambda'(Napi::Env, char*)>(napi_env__*, char*, unsigned long, _ffi_type) [/Users/daniel/code/node-ffi-napi/build/Release/ffi_bindings.node]
11: 0x110041e93 FFI::FFI::InitializeBindings(Napi::Env, Napi::Object) [/Users/daniel/code/node-ffi-napi/build/Release/ffi_bindings.node]
12: 0x110045828 __napi_Init(napi_env__*, napi_value__*) [/Users/daniel/code/node-ffi-napi/build/Release/ffi_bindings.node]
13: 0x10017ea5f napi_module_register_by_symbol(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Context>, napi_value__* (*)(napi_env__*, napi_value__*))::$_0::operator()(napi_env__*) const [/usr/local/bin/node_g]
14: 0x10017e920 void napi_env__::CallIntoModule<napi_module_register_by_symbol(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Context>, napi_value__* (*)(napi_env__*, napi_value__*))::$_0&, void napi_env__::CallIntoModuleThrow<napi_module_register_by_symbol(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Context>, napi_value__* (*)(napi_env__*, napi_value__*))::$_0>(napi_module_register_by_symbol(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Context>, napi_value__* (*)(napi_env__*, napi_value__*))::$_0&&)::'lambda'(napi_env__*, v8::Local<v8::Value>)>(napi_module_register_by_symbol(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Context>, napi_value__* (*)(napi_env__*, napi_value__*))::$_0&&, void napi_env__::CallIntoModuleThrow<napi_module_register_by_symbol(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Context>, napi_value__* (*)(napi_env__*, napi_value__*))::$_0>(napi_module_register_by_symbol(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Context>, napi_value__* (*)(napi_env__*, napi_value__*))::$_0&&)::'lambda'(napi_env__*, v8::Local<v8::Value>)&&) [/usr/local/bin/node_g]
15: 0x100172041 void napi_env__::CallIntoModuleThrow<napi_module_register_by_symbol(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Context>, napi_value__* (*)(napi_env__*, napi_value__*))::$_0>(napi_module_register_by_symbol(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Context>, napi_value__* (*)(napi_env__*, napi_value__*))::$_0&&) [/usr/local/bin/node_g]
16: 0x100171f0b napi_module_register_by_symbol(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Context>, napi_value__* (*)(napi_env__*, napi_value__*)) [/usr/local/bin/node_g]
17: 0x100172129 napi_module_register_cb(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Context>, void*) [/usr/local/bin/node_g]
18: 0x100186923 node::binding::DLOpen(v8::FunctionCallbackInfo<v8::Value> const&)::$_0::operator()(node::binding::DLib*) const [/usr/local/bin/node_g]
19: 0x100186232 decltype(std::__1::forward<node::binding::DLOpen(v8::FunctionCallbackInfo<v8::Value> const&)::$_0&>(fp)(std::__1::forward<node::binding::DLib*>(fp0))) std::__1::__invoke<node::binding::DLOpen(v8::FunctionCallbackInfo<v8::Value> const&)::$_0&, node::binding::DLib*>(node::binding::DLOpen(v8::FunctionCallbackInfo<v8::Value> const&)::$_0&, node::binding::DLib*&&) [/usr/local/bin/node_g]
20: 0x1001861d2 bool std::__1::__invoke_void_return_wrapper<bool>::__call<node::binding::DLOpen(v8::FunctionCallbackInfo<v8::Value> const&)::$_0&, node::binding::DLib*>(node::binding::DLOpen(v8::FunctionCallbackInfo<v8::Value> const&)::$_0&, node::binding::DLib*&&) [/usr/local/bin/node_g]
21: 0x100186192 std::__1::__function::__alloc_func<node::binding::DLOpen(v8::FunctionCallbackInfo<v8::Value> const&)::$_0, std::__1::allocator<node::binding::DLOpen(v8::FunctionCallbackInfo<v8::Value> const&)::$_0>, bool (node::binding::DLib*)>::operator()(node::binding::DLib*&&) [/usr/local/bin/node_g]
22: 0x100185154 std::__1::__function::__func<node::binding::DLOpen(v8::FunctionCallbackInfo<v8::Value> const&)::$_0, std::__1::allocator<node::binding::DLOpen(v8::FunctionCallbackInfo<v8::Value> const&)::$_0>, bool (node::binding::DLib*)>::operator()(node::binding::DLib*&&) [/usr/local/bin/node_g]
23: 0x1001843cd std::__1::__function::__value_func<bool (node::binding::DLib*)>::operator()(node::binding::DLib*&&) const [/usr/local/bin/node_g]
24: 0x100183a20 std::__1::function<bool (node::binding::DLib*)>::operator()(node::binding::DLib*) const [/usr/local/bin/node_g]
25: 0x10017f6c0 node::Environment::TryLoadAddon(char const*, int, std::__1::function<bool (node::binding::DLib*)> const&) [/usr/local/bin/node_g]
26: 0x10017f5ec node::binding::DLOpen(v8::FunctionCallbackInfo<v8::Value> const&) [/usr/local/bin/node_g]
27: 0x1005cf6f8 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/usr/local/bin/node_g]
28: 0x1005cdbbf 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::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/usr/local/bin/node_g]
29: 0x1005cbedc v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/usr/local/bin/node_g]
30: 0x1005cb94c v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/node_g]
31: 0x1012fd660 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit [/usr/local/bin/node_g]
32: 0x1010d757b Builtins_InterpreterEntryTrampoline [/usr/local/bin/node_g]
33: 0x1010d757b Builtins_InterpreterEntryTrampoline [/usr/local/bin/node_g]
fish: 'node_g example/abs.js' terminated by signal SIGILL (Illegal instruction)

addaleax added a commit to addaleax/node that referenced this issue Dec 30, 2019
Manage the napi_env refcount from Finalizer instances, as the
finalizer may refer to the napi_env until it is deleted.

Fixes: nodejs#31134
Fixes: node-ffi-napi/node-ffi-napi#48
targos pushed a commit to nodejs/node that referenced this issue Jan 6, 2020
Manage the napi_env refcount from Finalizer instances, as the
finalizer may refer to the napi_env until it is deleted.

Fixes: #31134
Fixes: node-ffi-napi/node-ffi-napi#48
PR-URL: #31140
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
targos pushed a commit to nodejs/node that referenced this issue Jan 14, 2020
Manage the napi_env refcount from Finalizer instances, as the
finalizer may refer to the napi_env until it is deleted.

Fixes: #31134
Fixes: node-ffi-napi/node-ffi-napi#48
PR-URL: #31140
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
BethGriggs pushed a commit to nodejs/node that referenced this issue Feb 6, 2020
Manage the napi_env refcount from Finalizer instances, as the
finalizer may refer to the napi_env until it is deleted.

Fixes: #31134
Fixes: node-ffi-napi/node-ffi-napi#48
PR-URL: #31140
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
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.

2 participants