SnosMe / uiohook-napi

MIT License
182 stars 40 forks source link

random crash at launch time with latest electron macos #50

Open acemtp opened 6 months ago

acemtp commented 6 months ago

Electron 30 MacOs 14.5 Node 20

this following code is in the app.on('ready') callback:

uIOhook.on('mousemove', evt => {
   evt.display = screen.getPrimaryDisplay();
    m.call('mouseMove', evt);
  });
  uIOhook.on('click', evt => { m.call('mouseClick', evt); });
  uIOhook.on('keyup', evt => { m.call('key', evt); });

  uIOhook.start();

And about 50% of the time I run the app in dev, I have this error. I tried to find on internet what could it be without success

FATAL ERROR: tsfn_to_js_proxy napi_call_function
----- Native stack trace -----

 1: 0x1145227b8 node::Buffer::New(v8::Isolate*, char*, unsigned long) [/Users/user/project/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 2: 0x1145228a8 node::OnFatalError(char const*, char const*) [/Users/user/project/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 3: 0x1144cef00 napi_fatal_error [/Users/user/project/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 4: 0x1045093f0 AddonStart [/Users/user/project/node_modules/uiohook-napi/build/Release/uiohook_napi.node]
 5: 0x1144d25ac node_api_get_module_file_name [/Users/user/project/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 6: 0x10d7e32f8 uv_async_send [/Users/user/project/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 7: 0x10d7f3e4c uv_free_interface_addresses [/Users/user/project/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 8: 0x10d7e37c0 uv_run [/Users/user/project/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 9: 0x10d9871a8 node::FreeArrayBufferAllocator(node::ArrayBufferAllocator*) [/Users/user/project/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
10: 0x110ae92b8 std::sys::pal::unix::os::errno::h12fdde1c2329795a [/Users/user/project/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
11: 0x110b03798 std::sys::pal::unix::os::errno::h12fdde1c2329795a [/Users/user/project/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
12: 0x110b03da8 std::sys::pal::unix::os::errno::h12fdde1c2329795a [/Users/user/project/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
13: 0x110b4dcd0 std::process::id::h056ebf195753a258 [/Users/user/project/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
14: 0x10d759600  [/Users/user/project/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
15: 0x110b4ce98 std::process::id::h056ebf195753a258 [/Users/user/project/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
16: 0x188ae24d8 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ [/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation]
17: 0x188ae246c __CFRunLoopDoSource0 [/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation]
18: 0x188ae21dc __CFRunLoopDoSources0 [/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation]
19: 0x188ae0dc8 __CFRunLoopRun [/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation]
20: 0x188ae0434 CFRunLoopRunSpecific [/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation]
21: 0x19328419c RunCurrentEventLoopInMode [/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox]
22: 0x193283fd8 ReceiveNextEventCommon [/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox]
23: 0x193283d30 _BlockUntilNextEventMatchingListInModeWithFilter [/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox]
24: 0x18c33fd68 _DPSNextEvent [/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit]
25: 0x18cb35808 -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] [/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit]
26: 0x18c33309c -[NSApplication run] [/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit]
27: 0x110b4e8ec std::process::id::h056ebf195753a258 [/Users/user/project/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
28: 0x110b4c85c std::process::id::h056ebf195753a258 [/Users/user/project/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
29: 0x110b04410 std::sys::pal::unix::os::errno::h12fdde1c2329795a [/Users/user/project/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
30: 0x110acf740 std::sys::pal::unix::os::errno::h12fdde1c2329795a [/Users/user/project/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
31: 0x10fc9f61c v8::internal::compiler::CompilationDependencies::FieldTypeDependencyOffTheRecord(v8::internal::compiler::MapRef, v8::internal::compiler::MapRef, v8::internal::InternalIndex, v8::internal::compiler::ObjectRef) const [/Users/user/project/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
32: 0x10fca109c v8::internal::compiler::CompilationDependencies::FieldTypeDependencyOffTheRecord(v8::internal::compiler::MapRef, v8::internal::compiler::MapRef, v8::internal::InternalIndex, v8::internal::compiler::ObjectRef) const [/Users/user/project/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
33: 0x10fc9cf50 v8::internal::compiler::CompilationDependencies::FieldTypeDependencyOffTheRecord(v8::internal::compiler::MapRef, v8::internal::compiler::MapRef, v8::internal::InternalIndex, v8::internal::compiler::ObjectRef) const [/Users/user/project/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
34: 0x10db1a644 v8::CodeEvent::GetScriptLine() [/Users/user/project/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
35: 0x10db1b6a4 v8::CodeEvent::GetScriptLine() [/Users/user/project/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
36: 0x10db1b51c v8::CodeEvent::GetScriptLine() [/Users/user/project/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
37: 0x10db19e5c v8::CodeEvent::GetScriptLine() [/Users/user/project/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
38: 0x10db1a020 v8::CodeEvent::GetScriptLine() [/Users/user/project/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
39: 0x10d7f451c ElectronMain [/Users/user/project/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
40: 0x18867a0e0 start [/usr/lib/dyld]
WtecHtec commented 5 months ago

Error: No native build was found for platform=darwin arch=arm64 runtime=electron abi=116 uv=1 armv=8 libc=glibc node=18.16.1 electron=26.6.10

longhun12346 commented 5 months ago

@acemtp I met this crash too. I finally find out it's caused by my js callback code throw exception. Mybe it can help you with this. I suggest you can try comment out the three “m.call('xxx', evt);” and see whether the crash happends again.

longhun12346 commented 5 months ago

@WtecHtec you should cd to node_modules/uiohook-napi and run node-gyp rebuild --runtime=electron --target=26.6.10 --abi=116

acemtp commented 5 months ago

Thanks, I'll test that