socket icon indicating copy to clipboard operation
socket copied to clipboard

Calling createWindow crashes the app

Open garth opened this issue 1 year ago • 2 comments

Calling createWindow causes the app to exit.

import { createWindow } from 'socket:application'

createWindow({
  index: 1,
  path: `/view`,
})

Here is the webview config:

[webview]
root = "/"
default_index  = "index.html"
watch = true

What OS are you using (uname -a, or Windows version)?

Darwin Garths-MacBook-Pro.local 23.2.0 Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:18 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6000 arm64

What version Socket Runtime are you using?

0.5.4 (97fa3f7c)
Installation path: /node_modules/.pnpm/@[email protected]/node_modules/@socketsupply/socket-darwin-arm64/

What programming language are you using (C/C++/Go/Rust)?

node --version v20.11.0

What did you expect to see and what you saw instead?

I expected to see a new window open and load the app view as specified by the path. Instead the app exited.

Here is the crash report ``` Process: SlideBeamer-dev [15770] Path: /Users/USER/*/SlideBeamer-dev.app/Contents/MacOS/SlideBeamer-dev Identifier: com.slidebeamer Version: 1.0.0 (1.0.0) Code Type: ARM-64 (Native) Parent Process: launchd [1] User ID: 501

Date/Time: 2024-01-15 15:14:28.3514 +0100 OS Version: macOS 14.2.1 (23C71) Report Version: 12 Anonymous UUID: A7985302-43AA-0E55-0BDE-52D5FBE4A0BA

Sleep/Wake UUID: 40CEE018-429E-4B74-9257-26BD04411848

Time Awake Since Boot: 1400000 seconds Time Since Wake: 19353 seconds

System Integrity Protection: enabled

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000

Termination Reason: Namespace SIGNAL, Code 6 Abort trap: 6 Terminating Process: SlideBeamer-dev [15770]

Application Specific Information: abort() called

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libsystem_kernel.dylib 0x188f1a0dc __pthread_kill + 8 1 libsystem_pthread.dylib 0x188f51cc0 pthread_kill + 288 2 libsystem_c.dylib 0x188e5da40 abort + 180 3 libc++abi.dylib 0x188f09070 abort_message + 132 4 libc++abi.dylib 0x188ef912c demangling_terminate_handler() + 348 5 libobjc.A.dylib 0x188b9f98c _objc_terminate() + 144 6 libc++abi.dylib 0x188f08434 std::__terminate(void ()()) + 16 7 libc++abi.dylib 0x188f0b520 __cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception) + 88 8 libc++abi.dylib 0x188f0b464 __cxa_throw + 308 9 libobjc.A.dylib 0x188b9601c objc_exception_throw + 420 10 Foundation 0x18a1ec43c -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 188 11 UniformTypeIdentifiers 0x18dca9924 +[UTType(UTTagSpecification) typesWithTag:tagClass:conformingToType:] + 772 12 SlideBeamer-dev 0x10041f10c -[SSCIPCSchemeHandler webView:startURLSchemeTask:] + 8452 13 WebKit 0x1ac039c88 WebKit::WebURLSchemeHandlerCocoa::platformStartTask(WebKit::WebPageProxy&, WebKit::WebURLSchemeTask&) + 80 14 WebKit 0x1ac21bf8c WebKit::WebURLSchemeHandler::startTask(WebKit::WebPageProxy&, WebKit::WebProcessProxy&, WTF::ObjectIdentifierGeneric<WebCore::PageIdentifierType, WTF::ObjectIdentifierMainThreadAccessTraits>, WebKit::URLSchemeTaskParameters&&, WTF::CompletionHandler<void (WebCore::ResourceResponse const&, WebCore::ResourceError const&, WTF::Vector<unsigned char, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>&&)>&&) + 288 15 WebKit 0x1ac1d5e3c WebKit::WebPageProxy::startURLSchemeTaskShared(WTF::Ref<WebKit::WebProcessProxy, WTF::RawPtrTraitsWebKit::WebProcessProxy>&&, WTF::ObjectIdentifierGeneric<WebCore::PageIdentifierType, WTF::ObjectIdentifierMainThreadAccessTraits>, WebKit::URLSchemeTaskParameters&&) + 152 16 WebKit 0x1ac1d5d70 WebKit::WebPageProxy::startURLSchemeTask(WebKit::URLSchemeTaskParameters&&) + 56 17 WebKit 0x1ac59dc84 WebKit::WebPageProxy::didReceiveMessage(IPC::Connection&, IPC::Decoder&) + 27604 18 WebKit 0x1ac66215c IPC::MessageReceiverMap::dispatchMessage(IPC::Connection&, IPC::Decoder&) + 264 19 WebKit 0x1ac21450c WebKit::WebProcessProxy::didReceiveMessage(IPC::Connection&, IPC::Decoder&) + 40 20 WebKit 0x1ac65d0e4 IPC::Connection::dispatchMessage(std::__1::unique_ptr<IPC::Decoder, std::__1::default_deleteIPC::Decoder>) + 324 21 WebKit 0x1ac65d530 IPC::Connection::dispatchIncomingMessages() + 496 22 JavaScriptCore 0x1a4e41ad8 WTF::RunLoop::performWork() + 204 23 JavaScriptCore 0x1a4e429a8 WTF::RunLoop::performWork(void*) + 36 24 CoreFoundation 0x18902fa4c CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 28 25 CoreFoundation 0x18902f9e0 __CFRunLoopDoSource0 + 176 26 CoreFoundation 0x18902f750 __CFRunLoopDoSources0 + 244 27 CoreFoundation 0x18902e340 __CFRunLoopRun + 828 28 CoreFoundation 0x18902d9ac CFRunLoopRunSpecific + 608 29 HIToolbox 0x1935dc448 RunCurrentEventLoopInMode + 292 30 HIToolbox 0x1935dc284 ReceiveNextEventCommon + 648 31 HIToolbox 0x1935dbfdc _BlockUntilNextEventMatchingListInModeWithFilter + 76 32 AppKit 0x18c80a8a4 _DPSNextEvent + 660 33 AppKit 0x18cfe4980 -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 716 34 AppKit 0x18c7fdd50 -[NSApplication run] + 476 35 SlideBeamer-dev 0x1003bb2e8 SSC::App::run() + 40 36 SlideBeamer-dev 0x10039f460 main + 10308 37 dyld 0x188bd10e0 start + 2360

Thread 1: 0 libsystem_pthread.dylib 0x188f4ce28 start_wqthread + 0

Thread 2: 0 libsystem_pthread.dylib 0x188f4ce28 start_wqthread + 0

Thread 3:: Dispatch queue: socket.runtime.core.loop.queue 0 libsystem_kernel.dylib 0x188f179c0 kevent + 8 1 SlideBeamer-dev 0x1004adef8 uv__io_poll + 788 (kqueue.c:256) 2 SlideBeamer-dev 0x10049c4bc uv_run + 408 (core.c:447) 3 SlideBeamer-dev 0x1003cbdc0 SSC::pollEventLoop(SSC::Core*) + 64 4 libdispatch.dylib 0x188d9ecb8 _dispatch_call_block_and_release + 32 5 libdispatch.dylib 0x188da0910 _dispatch_client_callout + 20 6 libdispatch.dylib 0x188da7ea4 _dispatch_lane_serial_drain + 748 7 libdispatch.dylib 0x188da89d4 _dispatch_lane_invoke + 380 8 libdispatch.dylib 0x188db361c _dispatch_root_queue_drain_deferred_wlh + 288 9 libdispatch.dylib 0x188db2e90 _dispatch_workloop_worker_thread + 404 10 libsystem_pthread.dylib 0x188f4e114 _pthread_wqthread + 288 11 libsystem_pthread.dylib 0x188f4ce30 start_wqthread + 8

Thread 4: 0 libsystem_pthread.dylib 0x188f4ce28 start_wqthread + 0

Thread 5: 0 libsystem_pthread.dylib 0x188f4ce28 start_wqthread + 0

Thread 6: 0 libsystem_pthread.dylib 0x188f4ce28 start_wqthread + 0

Thread 7:: JavaScriptCore libpas scavenger 0 libsystem_kernel.dylib 0x188f1506c __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x188f525fc _pthread_cond_wait + 1228 2 JavaScriptCore 0x1a622948c scavenger_thread_main + 1316 3 libsystem_pthread.dylib 0x188f52034 _pthread_start + 136 4 libsystem_pthread.dylib 0x188f4ce3c thread_start + 8

Thread 8: 0 libsystem_pthread.dylib 0x188f4ce28 start_wqthread + 0

Thread 9:: com.apple.coreanimation.render-server 0 libsystem_kernel.dylib 0x188f11874 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x188f23cf0 mach_msg2_internal + 80 2 libsystem_kernel.dylib 0x188f1a4b0 mach_msg_overwrite + 476 3 libsystem_kernel.dylib 0x188f11bf8 mach_msg + 24 4 QuartzCore 0x191135fa4 CA::Render::Server::server_thread(void*) + 544 5 QuartzCore 0x191135d74 thread_fun(void*) + 32 6 libsystem_pthread.dylib 0x188f52034 _pthread_start + 136 7 libsystem_pthread.dylib 0x188f4ce3c thread_start + 8

Thread 10: 0 libsystem_pthread.dylib 0x188f4ce28 start_wqthread + 0

Thread 11: 0 libsystem_kernel.dylib 0x188f11874 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x188f23cf0 mach_msg2_internal + 80 2 libsystem_kernel.dylib 0x188f1a4b0 mach_msg_overwrite + 476 3 libsystem_kernel.dylib 0x188f11bf8 mach_msg + 24 4 CoreFoundation 0x18902fbf4 __CFRunLoopServiceMachPort + 160 5 CoreFoundation 0x18902e4bc __CFRunLoopRun + 1208 6 CoreFoundation 0x18902d9ac CFRunLoopRunSpecific + 608 7 CoreFoundation 0x1890ab704 CFRunLoopRun + 64 8 SlideBeamer-dev 0x1004ad78c uv__cf_loop_runner + 88 (fsevents.c:723) 9 libsystem_pthread.dylib 0x188f52034 _pthread_start + 136 10 libsystem_pthread.dylib 0x188f4ce3c thread_start + 8

Thread 12: 0 libsystem_pthread.dylib 0x188f4ce28 start_wqthread + 0

Thread 13: 0 libsystem_pthread.dylib 0x188f4ce28 start_wqthread + 0

Thread 14:: WebCore: Scrolling 0 libsystem_kernel.dylib 0x188f11874 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x188f23cf0 mach_msg2_internal + 80 2 libsystem_kernel.dylib 0x188f1a4b0 mach_msg_overwrite + 476 3 libsystem_kernel.dylib 0x188f11bf8 mach_msg + 24 4 CoreFoundation 0x18902fbf4 __CFRunLoopServiceMachPort + 160 5 CoreFoundation 0x18902e4bc __CFRunLoopRun + 1208 6 CoreFoundation 0x18902d9ac CFRunLoopRunSpecific + 608 7 CoreFoundation 0x1890ab704 CFRunLoopRun + 64 8 JavaScriptCore 0x1a4e424a4 WTF::Detail::CallableWrapper<WTF::RunLoop::create(char const*, WTF::ThreadType, WTF::Thread::QOS)::$_1, void>::call() + 52 9 JavaScriptCore 0x1a4e5e830 WTF::Thread::entryPoint(WTF::Thread::NewThreadContext*) + 244 10 JavaScriptCore 0x1a4cb9ae4 WTF::wtfThreadEntryPoint(void*) + 16 11 libsystem_pthread.dylib 0x188f52034 _pthread_start + 136 12 libsystem_pthread.dylib 0x188f4ce3c thread_start + 8

Thread 15: 0 libsystem_pthread.dylib 0x188f4ce28 start_wqthread + 0

Thread 16:: CVDisplayLink 0 libsystem_kernel.dylib 0x188f1506c __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x188f52628 _pthread_cond_wait + 1272 2 CoreVideo 0x191919528 CVDisplayLink::waitUntil(unsigned long long) + 328 3 CoreVideo 0x1919185f4 CVDisplayLink::runIOThread() + 504 4 libsystem_pthread.dylib 0x188f52034 _pthread_start + 136 5 libsystem_pthread.dylib 0x188f4ce3c thread_start + 8

Thread 17:: com.apple.NSEventThread 0 libsystem_kernel.dylib 0x188f11874 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x188f23cf0 mach_msg2_internal + 80 2 libsystem_kernel.dylib 0x188f1a4b0 mach_msg_overwrite + 476 3 libsystem_kernel.dylib 0x188f11bf8 mach_msg + 24 4 CoreFoundation 0x18902fbf4 __CFRunLoopServiceMachPort + 160 5 CoreFoundation 0x18902e4bc __CFRunLoopRun + 1208 6 CoreFoundation 0x18902d9ac CFRunLoopRunSpecific + 608 7 AppKit 0x18c934510 _NSEventThread + 144 8 libsystem_pthread.dylib 0x188f52034 _pthread_start + 136 9 libsystem_pthread.dylib 0x188f4ce3c thread_start + 8

Thread 18: 0 libsystem_pthread.dylib 0x188f4ce28 start_wqthread + 0

Thread 19: 0 libsystem_pthread.dylib 0x188f4ce28 start_wqthread + 0

Thread 20: 0 libsystem_pthread.dylib 0x188f4ce28 start_wqthread + 0

Thread 21:: CVDisplayLink 0 libsystem_kernel.dylib 0x188f1506c __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x188f52628 _pthread_cond_wait + 1272 2 CoreVideo 0x191919528 CVDisplayLink::waitUntil(unsigned long long) + 328 3 CoreVideo 0x1919185f4 CVDisplayLink::runIOThread() + 504 4 libsystem_pthread.dylib 0x188f52034 _pthread_start + 136 5 libsystem_pthread.dylib 0x188f4ce3c thread_start + 8

Thread 0 crashed with ARM Thread State (64-bit): x0: 0x0000000000000000 x1: 0x0000000000000000 x2: 0x0000000000000000 x3: 0x0000000000000000 x4: 0x0000000188f0d377 x5: 0x000000016fa62940 x6: 0x000000000000006e x7: 0x0000000000000880 x8: 0x20c9e1932971f0ed x9: 0x20c9e192f602e0ed x10: 0x0000000000000200 x11: 0x000000000000000b x12: 0x0000000000000000 x13: 0x00000000001ff800 x14: 0x00000000000007fb x15: 0x0000000094000859 x16: 0x0000000000000148 x17: 0x00000001e87a3340 x18: 0x0000000000000000 x19: 0x0000000000000006 x20: 0x00000001df731000 x21: 0x0000000000000103 x22: 0x00000001df7310e0 x23: 0x00000001e392e808 x24: 0x000060000226dc10 x25: 0x00000001df78ad48 x26: 0x00000001004d67f9 x27: 0x00000001d81f9d19 x28: 0x0000000000000000 fp: 0x000000016fa628b0 lr: 0x0000000188f51cc0 sp: 0x000000016fa62890 pc: 0x0000000188f1a0dc cpsr: 0x40001000 far: 0x0000000000000000 esr: 0x56000080 Address size fault

Binary Images: 0x1131cc000 - 0x113aa7fff com.apple.audio.codecs.Components (7.0) <8479fc6b-3097-3c2f-b9ac-e1ece564d865> /System/Library/Components/AudioCodecs.component/Contents/MacOS/AudioCodecs 0x100868000 - 0x1008d3fff com.apple.AppleMetalOpenGLRenderer (1.0) <41cb4d99-6a07-366a-9e97-d047ce10daa2> /System/Library/Extensions/AppleMetalOpenGLRenderer.bundle/Contents/MacOS/AppleMetalOpenGLRenderer 0x100710000 - 0x10071bfff libobjc-trampolines.dylib () <7778e0d7-361a-378d-9438-3b2bb48c2154> /usr/lib/libobjc-trampolines.dylib 0x100398000 - 0x1004ebfff com.slidebeamer (1.0.0) <87afd13e-4867-310d-91f0-49e755d0f169> /Users/USER//SlideBeamer-dev.app/Contents/MacOS/SlideBeamer-dev 0x188f10000 - 0x188f4afff libsystem_kernel.dylib () /usr/lib/system/libsystem_kernel.dylib 0x188f4b000 - 0x188f57ff3 libsystem_pthread.dylib () /usr/lib/system/libsystem_pthread.dylib 0x188de7000 - 0x188e65ffb libsystem_c.dylib () /usr/lib/system/libsystem_c.dylib 0x188ef4000 - 0x188f0ffff libc++abi.dylib () /usr/lib/libc++abi.dylib 0x188b7c000 - 0x188bcafe0 libobjc.A.dylib () <9bab9556-7a2a-30a8-acde-010ba8e2367d> /usr/lib/libobjc.A.dylib 0x18a0dd000 - 0x18ad24fff com.apple.Foundation (6.9) <9558b1eb-dda3-3fda-88a5-e785ecdfcd30> /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation 0x18dca1000 - 0x18dcb6fff com.apple.UniformTypeIdentifiers (709) <49f3c65f-c0a9-303b-be16-dea9f38e96af> /System/Library/Frameworks/UniformTypeIdentifiers.framework/Versions/A/UniformTypeIdentifiers 0x1abacf000 - 0x1ac7d2fff com.apple.WebKit (19617) <8f688184-2d15-3ea5-90e0-73647cbe52ce> /System/Library/Frameworks/WebKit.framework/Versions/A/WebKit 0x1a4cb0000 - 0x1a6387fbf com.apple.JavaScriptCore (19617) <59330902-38d2-3e48-aed8-1b6327196141> /System/Library/Frameworks/JavaScriptCore.framework/Versions/A/JavaScriptCore 0x188fb2000 - 0x189489fff com.apple.CoreFoundation (6.9) <47e4ec09-8f6e-30a8-99d0-34024d4f8122> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation 0x1935ac000 - 0x19386bfff com.apple.HIToolbox (2.1.1) /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox 0x18c7d1000 - 0x18daebfff com.apple.AppKit (6.9) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 0x188bcb000 - 0x188c5f347 dyld () <324e4ad9-e01f-3183-b09f-3e20b326643a> /usr/lib/dyld 0x0 - 0xffffffffffffffff ??? () <00000000-0000-0000-0000-000000000000> ??? 0x188d9d000 - 0x188de3fff libdispatch.dylib () /usr/lib/system/libdispatch.dylib 0x1910ee000 - 0x1914b6fff com.apple.QuartzCore (1.11) <4a615554-86bd-36e4-aab6-39c377bdae2c> /System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore 0x1fff3c000 - 0x2002dbfff com.apple.CopresenceCore (1) /System/Library/PrivateFrameworks/CopresenceCore.framework/Versions/A/CopresenceCore 0x191916000 - 0x191973fff com.apple.CoreVideo (1.8) <0bd999bf-c672-3dad-84f7-6eb32330d37f> /System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo

External Modification Summary: Calls made by other processes targeting this process: task_for_pid: 0 thread_create: 0 thread_set_state: 0 Calls made by this process: task_for_pid: 0 thread_create: 0 thread_set_state: 0 Calls made by all processes on this machine: task_for_pid: 0 thread_create: 0 thread_set_state: 0

VM Region Summary: ReadOnly portion of Libraries: Total=1.6G resident=0K(0%) swapped_out_or_unallocated=1.6G(100%) Writable regions: Total=5.8G written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=5.8G(100%)

                            VIRTUAL   REGION 

REGION TYPE SIZE COUNT (non-coalesced) =========== ======= ======= Accelerate framework 128K 1 Activity Tracing 256K 1 CG image 96K 4 ColorSync 624K 31 CoreAnimation 352K 22 CoreGraphics 48K 3 CoreImage 16K 1 CoreUI image data 944K 6 Foundation 16K 1 Kernel Alloc Once 32K 1 MALLOC 1.6G 65 MALLOC guard page 384K 24 STACK GUARD 56.3M 22 Stack 27.1M 22 VM_ALLOCATE 128.2M 12 VM_ALLOCATE (reserved) 3.9G 1 reserved VM address space (unallocated) WebKit Malloc 192.1M 5 __AUTH 3049K 425 __AUTH_CONST 33.4M 648 __CTF 824 1 __DATA 17.3M 638 __DATA_CONST 33.0M 657 __DATA_DIRTY 1960K 239 __FONT_DATA 4K 1 __GLSLBUILTINS 5174K 1 __LINKEDIT 892.8M 5 __OBJC_RO 71.1M 1 __OBJC_RW 2168K 1 __TEXT 766.4M 675 dyld private memory 272K 2 mapped file 210.9M 37 shared memory 880K 15 =========== ======= ======= TOTAL 7.9G 3568 TOTAL, minus reserved VM space 4.0G 3568

</details>
<!--
Your issue may already be reported! Please search on the issue tracker before creating a new one.
If your issue has not been reported yet - please describe your problem with as much details as you can.
Thanks you.
-->

garth avatar Jan 15 '24 14:01 garth

I just noticed that if I remove the default_index = "index.html" setting the app no longer crashes when calling createWindow but then I get a blank page in the new window since the path does not exist on disk.

garth avatar Jan 15 '24 14:01 garth

This works in master. When we release 0.5.5 this should be closed

jwerle avatar Jan 15 '24 17:01 jwerle