kriszyp / lmdb-js

Simple, efficient, ultra-fast, scalable data store wrapper for LMDB
Other
482 stars 39 forks source link

Crash in getViewAddress #117

Closed devongovett closed 2 years ago

devongovett commented 2 years ago

Another case of #102:

#
# Fatal error in , line 0
# Check failed: result.second.
#
#
#
#FailureMessage Object: 0x70000957a410
 1: 0x1001142e2 node::NodePlatform::GetStackTracePrinter()::$_3::__invoke() [/Users/ittai/.nvm/versions/node/v14.15.4/bin/node]
 2: 0x1010106d2 V8_Fatal(char const*, ...) [/Users/ittai/.nvm/versions/node/v14.15.4/bin/node]
 3: 0x1004d59b4 v8::internal::GlobalBackingStoreRegistry::Register(std::__1::shared_ptr<v8::internal::BackingStore>) [/Users/ittai/.nvm/versions/node/v14.15.4/bin/node]
 4: 0x1001fb626 v8::ArrayBuffer::GetBackingStore() [/Users/ittai/.nvm/versions/node/v14.15.4/bin/node]
 5: 0x10008140b node::Buffer::Data(v8::Local<v8::Value>) [/Users/ittai/.nvm/versions/node/v14.15.4/bin/node]
 6: 0x1086b78ec getViewAddress(Nan::FunctionCallbackInfo<v8::Value> const&) [/Users/ittai/Documents/GitHub/pueblo/node_modules/lmdb/prebuilds/darwin-x64/node.abi83.node]
 7: 0x1086b641d Nan::imp::FunctionCallbackWrapper(v8::FunctionCallbackInfo<v8::Value> const&) [/Users/ittai/Documents/GitHub/pueblo/node_modules/lmdb/prebuilds/darwin-x64/node.abi83.node]
 8: 0x10025a4e8 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/Users/ittai/.nvm/versions/node/v14.15.4/bin/node]
 9: 0x100259a7c 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) [/Users/ittai/.nvm/versions/node/v14.15.4/bin/node]
10: 0x1002591a2 v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/Users/ittai/.nvm/versions/node/v14.15.4/bin/node]
11: 0x100a7a359 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit [/Users/ittai/.nvm/versions/node/v14.15.4/bin/node]
error Command failed with signal "SIGILL".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Looks like the fix in 8ee74ab7e48dd8de6613cdfa005ccee50056f70a was applied to getAddress but not getViewAddress, or perhaps it subsequently changed which one was exported? https://github.com/DoctorEvidence/lmdb-js/commit/771be6633b9687b163fc4b8f8764fe19ae5a6136#diff-aeb482d3eecf1ef6258ceba33cffc959ae211758ffc79e4ca6d889c9719fa30aL23

kriszyp commented 2 years ago

Ok, if this is the zero-length buffer bug, should be fixed in v2.1.2. Sorry about that, must have been a merge issue; and I am not sure I understand why the unit test I added for parcel isn't catching that (https://github.com/DoctorEvidence/lmdb-js/blob/master/test/index.test.js#L97).