dyedgreen / deno-sqlite

Deno SQLite module
https://deno.land/x/sqlite
MIT License
409 stars 36 forks source link

Strange fatal error #106

Closed qwtel closed 3 years ago

qwtel commented 3 years ago

I'm sometimes getting the following error:

#
# Fatal error in , line 0
# Check failed: allocator->SetPermissions(reinterpret_cast<void*>(region.begin()), region.size(), PageAllocator::kNoAccess).
#
#
#
#FailureMessage Object: 0x16b2f0428
==== C stack trace ===============================

    0   deno                                0x000000010523edcc v8::base::debug::StackTrace::StackTrace() + 24
    1   deno                                0x0000000105242830 v8::platform::(anonymous namespace)::PrintStackTrace() + 24
    2   deno                                0x000000010523b72c V8_Fatal(char const*, ...) + 268
    3   deno                                0x00000001057b9524 v8::internal::wasm::NativeModule::NativeModule(v8::internal::wasm::WasmEngine*, v8::internal::wasm::WasmFeatures const&, v8::internal::VirtualMemory, std::__1::shared_ptr<v8::internal::wasm::WasmModule const>, std::__1::shared_ptr<v8::internal::Counters>, std::__1::shared_ptr<v8::internal::wasm::NativeModule>*) + 0
    4   deno                                0x00000001057bc714 v8::internal::wasm::NativeModule::FreeCode(v8::internal::Vector<v8::internal::wasm::WasmCode* const>) + 44
    5   deno                                0x00000001057c9c70 v8::internal::wasm::WasmEngine::FreeDeadCodeLocked(std::__1::unordered_map<v8::internal::wasm::NativeModule*, std::__1::vector<v8::internal::wasm::WasmCode*, std::__1::allocator<v8::internal::wasm::WasmCode*> >, std::__1::hash<v8::internal::wasm::NativeModule*>, std::__1::equal_to<v8::internal::wasm::NativeModule*>, std::__1::allocator<std::__1::pair<v8::internal::wasm::NativeModule* const, std::__1::vector<v8::internal::wasm::WasmCode*, std::__1::allocator<v8::internal::wasm::WasmCode*> > > > > const&) + 352
    6   deno                                0x00000001057c7cd0 v8::internal::wasm::WasmEngine::PotentiallyFinishCurrentGC() + 564
    7   deno                                0x00000001057c9260 v8::internal::wasm::WasmEngine::ReportLiveCodeForGC(v8::internal::Isolate*, v8::internal::Vector<v8::internal::wasm::WasmCode*>) + 464
    8   deno                                0x00000001057c93e4 v8::internal::wasm::WasmEngine::ReportLiveCodeFromStackForGC(v8::internal::Isolate*) + 276
    9   deno                                0x0000000105397f50 v8::internal::StackGuard::HandleInterrupts() + 2140
    10  deno                                0x00000001056961a8 v8::internal::Runtime_StackGuard(int, unsigned long*, v8::internal::Isolate*) + 312
    11  deno                                0x0000000105b7b04c Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit + 108
    12  deno                                0x0000000105b3a80c Builtins_ArrayIncludes + 620
    13  deno                                0x0000000105b13530 Builtins_InterpreterEntryTrampoline + 272
    14  deno                                0x0000000105b13530 Builtins_InterpreterEntryTrampoline + 272
    15  deno                                0x0000000105b0ff50 construct_stub_create_deopt_addr + 364
    16  deno                                0x0000000105c08d70 Builtins_ConstructHandler + 688
    17  deno                                0x0000000105b13530 Builtins_InterpreterEntryTrampoline + 272
    18  deno                                0x0000000105b13530 Builtins_InterpreterEntryTrampoline + 272
    19  ???                                 0x00003faccc8d0ba8 0x0 + 70011398720424
    20  ???                                 0x00003faccc995cc4 0x0 + 70011399527620
    21  ???                                 0x00003faccc9da404 0x0 + 70011399808004
    22  ???                                 0x00003faccc9af298 0x0 + 70011399631512
    23  ???                                 0x00003faccc95f010 0x0 + 70011399303184
    24  ???                                 0x00003faccc96b710 0x0 + 70011399354128
    25  ???                                 0x00003faccc9a59c4 0x0 + 70011399592388
    26  ???                                 0x00003faccc9a0cd8 0x0 + 70011399572696
    27  ???                                 0x000039b80008ac2c 0x0 + 63462437334060
    28  deno                                0x0000000105b13530 Builtins_InterpreterEntryTrampoline + 272
    29  deno                                0x0000000105b13530 Builtins_InterpreterEntryTrampoline + 272
    30  deno                                0x0000000105b13530 Builtins_InterpreterEntryTrampoline + 272
    31  deno                                0x0000000105b13530 Builtins_InterpreterEntryTrampoline + 272
    32  deno                                0x0000000105b4161c Builtins_AsyncFunctionAwaitResolveClosure + 92
    33  deno                                0x0000000105bc55fc Builtins_PromiseFulfillReactionJob + 60
    34  deno                                0x0000000105b342a0 Builtins_RunMicrotasks + 672
    35  deno                                0x0000000105b10cc8 Builtins_JSRunMicrotasksEntry + 168
    36  ???                                 0x000039b800000000 0x0 + 63462436765696

I've compiled a minimal example here: https://gist.github.com/qwtel/d2728ea41a48f7168bc68cd4785de574

It seems to be related to the use of async and has some race condition-like properties: The queries succeed a random number of times, but usually not more than ~10

sqlite@v2.3.2 deno 1.7.2 (release, aarch64-apple-darwin) v8 8.9.255.3 typescript 4.1.3

qwtel commented 3 years ago

I'm getting this with other wasm modules as well, so I now assume this is a bug in either deno or v8...

dyedgreen commented 3 years ago

Question out of curiosity: Are you running this on the new apple M1 chipset?

qwtel commented 3 years ago

Yes, I was using the ARM version on a M1 mac. I've switched to the x86 version shortly after I wrote this, and it fixed the problem in both wasm modules I've tried. Hopefully something that get's ironed out over time... Seems to be fixed in Deno 1.8