TryGhost / node-sqlite3

SQLite3 bindings for Node.js
BSD 3-Clause "New" or "Revised" License
6.23k stars 816 forks source link

Using sqlite3 in my electron will cause ThrowAsJavaScriptException napi_throw error message #1698

Open TW001ChenYI opened 1 year ago

TW001ChenYI commented 1 year ago

Issue Summary

Using sqlite3 in my electron will cause ThrowAsJavaScriptException napi_throw error message

I added a piece of data in main.js. After the execution is completed, the following error will occur, and it will be automatically re-rendered, causing the page to crash, but the data is still written to the database.

FATAL ERROR: Error::ThrowAsJavaScriptException napi_throw
 1: 00007FF7E3F75B46 node::Buffer::New+74422
 2: 00007FF7E3F75CB0 node::OnFatalError+304
 3: 00007FF7E3F75B79 node::Buffer::New+74473
 4: 00007FF7E458868F napi_fatal_error+159
 5: 00007FF8D0651B07
 6: 00007FF8D0651EC6
 7: 00007FF8D066B911
 8: 00007FF7E458B323 node_api_get_module_file_name+2035
 9: 00007FF7E458B6DF node_api_get_module_file_name+2991
10: 00007FF7E458B523 node_api_get_module_file_name+2547
11: 00007FF7E470D022 uv_signal_start_oneshot+1394
12: 00007FF7E3F97710 uv_run+2160
13: 00007FF7E3F9713B uv_run+667
14: 00007FF7E3F50333 node::SetProcessExitHandler+347763
15: 00007FF7E3F50C65 node::SetProcessExitHandler+350117
16: 00007FF7E3EFA1CE node::FreeEnvironment+190
17: 00007FF7E23F2387 node::FreeArrayBufferAllocator+149079
18: 00007FF7E3E002A1 uv_mutex_destroy+1448161
19: 00007FF7E4E6C023 Cr_z_uncompress+160179
20: 00007FF7E499653D uv_fs_poll_getpath+2624749
21: 00007FF7E4336C54 GetHandleVerifier+3649156
22: 00007FF7E4312772 GetHandleVerifier+3500450
23: 00007FF7E4313269 GetHandleVerifier+3503257
24: 00007FF7E437CD18 GetHandleVerifier+3936072
25: 00007FF7E437FFA5 GetHandleVerifier+3949013
26: 00007FF7E3D47862 uv_mutex_destroy+691874
27: 00007FF7E3DF595C uv_mutex_destroy+1404828
28: 00007FF7E3E09D97 uv_mutex_destroy+1487831
29: 00007FF7E3E09B66 uv_mutex_destroy+1487270
30: 00007FF7E3DF4316 uv_mutex_destroy+1399126
31: 00007FF7E44BA64F uv_fs_get_ptr+998815
32: 00007FF7E2B801F2 v8::MemorySpan<unsigned char const >::operator=+605986
33: 00007FF7E44BAEBA uv_fs_get_ptr+1000970
34: 00007FF7E5DC4014 v8_inspector::String16::String16+4001156
35: 00007FF7E5E43677 v8_inspector::String16::String16+4522983
36: 00007FF7E5DC51C6 v8_inspector::String16::String16+4005686
37: 00007FF7E5DE2B5F v8_inspector::String16::String16+4126927
38: 00007FF7E5D93157 v8_inspector::String16::String16+3800775
39: 00007FF7E3FB31D3 uv_sleep+98883
40: 00007FF7E5E32617 v8_inspector::String16::String16+4453255
41: 00007FF7E5E30695 v8_inspector::String16::String16+4445189
42: 00007FF7E3FB3AE5 uv_sleep+101205
43: 00007FF7E395DE60 node::GetEnvironmentIsolateData+9036192
44: 00007FF7E3E0A9DF uv_mutex_destroy+1490975
45: 00007FF7E24C01CF v8::metrics::LongTaskStats::LongTaskStats+417663
46: 00007FF7E24C0F38 v8::metrics::LongTaskStats::LongTaskStats+421096
47: 00007FF7E24BD30C v8::metrics::LongTaskStats::LongTaskStats+405692
48: 00007FF7E24BD4BF v8::metrics::LongTaskStats::LongTaskStats+406127
49: 00007FF7E22439A7 std::Cr::vector<v8::CpuProfileDeoptInfo,std::Cr::allocator<v8::CpuProfileDeoptInfo> >::vector<v8::CpuProfileDeoptInfo,std::Cr::allocator<v8::CpuProfileDeoptInfo> >+59239
50: 00007FF7E6114672 v8_inspector::String16::String16+7476194
51: 00007FF90CBF7614 BaseThreadInitThunk+20
52: 00007FF90DD626A1 RtlUserThreadStart+33

Steps to Reproduce

 const db = new sqlite3.Database(\\public\\Sqlite.db');

        db.run(
            "INSERT INTO test (name,phone) VALUES (?,?);",
            [name,phone
            ],async function (err, res) {
              console.log("1:", await err, res, this.lastID);
         }
          );

        db.close();

Version

v5.1.6

Node.js Version

v16.17.1

How did you install the library?

npm

mdjaman commented 1 year ago

Hello @TW001ChenYI Did you solve your issue? If so can u pls share?

mrpengxinwen commented 2 months ago

How to solve this problem? I'm be crazy with this problem!