Repository navigation
sqlite3@5.0.0 - NAPI Fatal Errors #1381
Description
Activity
Additional error
FATAL ERROR: v8::HandleScope::CreateHandle() Cannot create a handle without a HandleScope 1: 0x9fd5f0 node::Abort() [/home/nodejs/.nvm/versions/node/v14.7.0/bin/node] 2: 0x94a45d node::FatalError(char const*, char const*) [/home/nodejs/.nvm/versions/node/v14.7.0/bin/node] 3: 0xb706ba v8::Utils::ReportApiFailure(char const*, char const*) [/home/nodejs/.nvm/versions/node/v14.7.0/bin/node] 4: 0xcdcdf2 v8::internal::HandleScope::Extend(v8::internal::Isolate*) [/home/nodejs/.nvm/versions/node/v14.7.0/bin/node] 5: 0xb720d1 v8::HandleScope::CreateHandle(v8::internal::Isolate*, unsigned long) [/home/nodejs/.nvm/versions/node/v14.7.0/bin/node] 6: 0x9bb045 napi_get_reference_value [/home/nodejs/.nvm/versions/node/v14.7.0/bin/node] 7: 0x7fe5adbe4286 Napi::Reference<Napi::Function>::Value() const [/app/node_modules/sqlite3/lib/binding/napi-v3-linux-x64/node_sqlite3.node] 8: 0x7fe5adbe47f5 node_sqlite3::Database::HasInstance(Napi::Value) [/app/node_modules/sqlite3/lib/binding/napi-v3-linux-x64/node_sqlite3.node] 9: 0x7fe5adbfa1af node_sqlite3::Statement::Statement(Napi::CallbackInfo const&) [/app/node_modules/sqlite3/lib/binding/napi-v3-linux-x64/node_sqlite3.node] 10: 0x7fe5adc08446 Napi::ObjectWrap<node_sqlite3::Statement>::ConstructorCallbackWrapper(napi_env__*, napi_callback_info__*)::{lambda()#1}::operator()() const [/app/node_modules/sqlite3/lib/binding/napi-v3-linux-x64/node_sqlite3.node] 11: 0x7fe5adc07d5e Napi::ObjectWrap<node_sqlite3::Statement>::ConstructorCallbackWrapper(napi_env__*, napi_callback_info__*) [/app/node_modules/sqlite3/lib/binding/napi-v3-linux-x64/node_sqlite3.node] 12: 0x9b40df [/home/nodejs/.nvm/versions/node/v14.7.0/bin/node] 13: 0xbdd915 [/home/nodejs/.nvm/versions/node/v14.7.0/bin/node] 14: 0xbddf1f [/home/nodejs/.nvm/versions/node/v14.7.0/bin/node] 15: 0xbde546 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/home/nodejs/.nvm/versions/node/v14.7.0/bin/node] 16: 0x13cc9d9 [/home/nodejs/.nvm/versions/node/v14.7.0/bin/node] Process finished with exit code 134 (interrupted by signal 6: SIGABRT)Attached fatal error report
report.20200914.153842.32355.0.001.zipFatal errors triggered only in case of usage sqlite3 in worker_threads. If we using sqlite3 from the main thread - application working stable
Reacted by sopheak and Imtiaz Shakil Siddique- changed the title
[-]FATAL ERROR: Error::ThrowAsJavaScriptException napi_throw[/-][+]sqlite3@5.0.0 - FATAL ERROR: Error::ThrowAsJavaScriptException napi_throw[/+]on Sep 15, 2020 - changed the title
[-]sqlite3@5.0.0 - FATAL ERROR: Error::ThrowAsJavaScriptException napi_throw[/-][+]sqlite3@5.0.0 - NAPI fatal errors[/+]on Sep 15, 2020 - changed the title
[-]sqlite3@5.0.0 - NAPI fatal errors[/-][+]sqlite3@5.0.0 - NAPI Fatal Errors[/+]on Sep 15, 2020 I'm having the same errors, I've also tried installing sqlite3@5.0.0 with the
--build-from-sourceflag but the issue persists.
The error only appears when runing a query in a worker thread.Same error with sqlite3@5.0.2
Reacted by Carlos E. Salazar, Joaquín Serna, Jamie Greeff, Kevin Ansfield, Jeff Klassen and Imtiaz Shakil Siddiquenodejs: v15.6.0
sqlite3: v5.0.2
When runing sqlite query in one worker thread is okay.
const worker = new Worker('./worker.js', { workerData: opts });
But for if more than one worker thread cause the same error.
const worker2 = new Worker('./worker.js', { workerData: opts });Reacted by CoukaratchaThis isn't just present with worker threads. This throws the same error even if the query is run from the main thread.
if(isMainThread){ worker.on('exit', ()=>{ db.serialize(() => { db.each(`SELECT sellers as sellers, results as no_of_results FROM maps WHERE category = ?`, [category], (err, row) => { if (err) { console.log(err); } console.log(row.sellers + "\t" + row.no_of_results); }); }); }) }This also throws the same error mentioned by @akazakou.... #1367 says that it fixes this. But we're still getting the same error...
Reacted by Imtiaz Shakil SiddiqueI've hit this in both
5.0.0and5.0.2. Fortunately, in my project, I am able to downgrade without issue; I'm now using4.2.0and no longer hit the issue.I'll be sure to keep tabs on this so I can update when it's fixed! 👍
- added a commit that references this issue
on Sep 23, 2021 Another related issue: #1223
better-sqlite3 claims to have implemented at: WiseLibs/better-sqlite3#237 BTW
Reacted by Imtiaz Shakil SiddiqueCould be unrelated but just had similar problems in my
electron 17.0.0app.
The solution for me was ensuring to close the db connection before the worker_thread exits.Would you be able to try with v5.0.3? 🙂
I am getting this while using node 14.9.2. Do we have any solution?
Here is the stack trace
FATAL ERROR: Error::ThrowAsJavaScriptException napi_throw 1: 0xa3aaf0 node::Abort() [/opt/hostedtoolcache/node/14.19.2/x64/bin/node] 2: 0x970199 node::FatalError(char const*, char const*) [/opt/hostedtoolcache/node/14.19.2/x64/bin/node] 3: 0x9701a2 [/opt/hostedtoolcache/node/14.19.2/x64/bin/node] 4: 0xa07ddb napi_fatal_error [/opt/hostedtoolcache/node/14.19.2/x64/bin/node] 5: 0x7fae8ca3c3de [/home/runner/work/keyv/keyv/node_modules/sqlite3/lib/binding/napi-v6-linux-glibc-x64/node_sqlite3.node] 6: 0x7fae8ca3ca92 Napi::Error::ThrowAsJavaScriptException() const [/home/runner/work/keyv/keyv/node_modules/sqlite3/lib/binding/napi-v6-linux-glibc-x64/node_sqlite3.node] 7: 0x7fae8ca3d017 Napi::Function::MakeCallback(napi_value__*, unsigned long, napi_value__* const*, napi_async_context__*) const [/home/runner/work/keyv/keyv/node_modules/sqlite3/lib/binding/napi-v6-linux-glibc-x64/node_sqlite3.node] 8: 0x7fae8ca59e40 node_sqlite3::Statement::Work_AfterAll(napi_env__*, napi_status, void*) [/home/runner/work/keyv/keyv/node_modules/sqlite3/lib/binding/napi-v6-linux-glibc-x64/node_sqlite3.node] 9: 0xa0a329 node::ThreadPoolWork::ScheduleWork()::{lambda(uv_work_s*, int)#2}::_FUN(uv_work_s*, int) [/opt/hostedtoolcache/node/14.19.2/x64/bin/node] 10: 0x13bc2fd [/opt/hostedtoolcache/node/14.19.2/x64/bin/node] 11: 0x13c0a86 [/opt/hostedtoolcache/node/14.19.2/x64/bin/node] 12: 0x13d2ff4 [/opt/hostedtoolcache/node/14.19.2/x64/bin/node] 13: 0x13c13d8 uv_run [/opt/hostedtoolcache/node/14.19.2/x64/bin/node] 14: 0x9d1428 node::Environment::CleanupHandles() [/opt/hostedtoolcache/node/14.19.2/x64/bin/node] 15: 0x9d6b56 node::Environment::RunCleanup() [/opt/hostedtoolcache/node/14.19.2/x64/bin/node] 16: 0x9917f7 node::FreeEnvironment(node::Environment*) [/opt/hostedtoolcache/node/14.19.2/x64/bin/node] 17: 0xafd4af node::worker::Worker::Run() [/opt/hostedtoolcache/node/14.19.2/x64/bin/node] 18: 0xafd6f8 [/opt/hostedtoolcache/node/14.19.2/x64/bin/node] 19: 0x7fae9721e[609](https://github.com/jaredwray/keyv/runs/6500107069?check_suite_focus=true#step:6:610) [/lib/x86_64-linux-gnu/libpthread.so.0] 20: 0x7fae97143163 clone [/lib/x86_64-linux-gnu/libc.so.6]the problem happens with v5.1.6 using node v18
Reacted by ZHAO- added a commit that references this issue
on May 21, 2025
Got an error for
sqlite3@5.0.0. My code using sqlite3 in worker_threads with massive read operations. Database stored in memory.