I have a stack dump from Activity Monitor here that is giving me some trouble, and I’m looking for some thoughts.
For all intents and purposes, I have three threads: the main and two import threads. I also have a SQLite database. As I’ve setup my database, the main thread is never allowed to write to the database. These two threads also do not have write permission. Each thread has its own connection to the database file, and I am not using a critical section to control access, since all three threads should have no trouble reading from the database at the same time.
Yet it locks up, as if I had called CriticalSection.Enter on the main thread. Looking over the dump, it looks like the Xojo framework is handling its own mutex on the file. The main thread is waiting on something, but when the main thread waits, all code stops and the app locks up. I consider this a bug personally, but Xojo hasn’t fixed this in years, so it is what it is.
Anybody have any idea what could be going on?
Analysis of sampling Beacon (pid 82980) every 1 millisecond
Process: Beacon [82980]
Path: /Applications/Beacon.app/Contents/MacOS/Beacon
Load Address: 0x100418000
Identifier: com.thezaz.beacon
Version: 1.6.2.2 (1.6.2.3.2)
Code Type: ARM64
Platform: macOS
Parent Process: ??? [1]
Date/Time: 2023-01-05 12:54:41.905 -0500
Launch Time: 2023-01-05 10:55:16.794 -0500
OS Version: macOS 13.1 (22C65)
Report Version: 7
Analysis Tool: /usr/bin/sample
Physical footprint: 317.9M
Physical footprint (peak): 318.5M
Idle exit: untracked
----
Call graph:
2557 Thread_9139805 DispatchQueue_1: com.apple.main-thread (serial)
+ 2557 start (in dyld) + 2544 [0x1a61ebe50]
+ 2557 main (in Beacon) + 20 [0x103e8eae8]
+ 2557 _Main (in Beacon) + 384 [0x103e97b0c]
+ 2557 REALbasic._RuntimeRun (in Beacon) + 28 [0x100739804]
+ 2557 RuntimeRun (in XojoFramework) + 48 [0x1058f1c30]
+ 2557 -[NSApplication run] (in AppKit) + 464 [0x1a98679e4]
+ 2557 ??? (in XojoFramework) load address 0x105684000 + 0xe5214 [0x105769214]
+ 2557 CallFunctionWithExceptionHandling(void (*)()) (in XojoFramework) + 180 [0x1058f33d4]
+ 2557 Application._CallFunctionWithExceptionHandling%%o<Application>p (in Beacon) + 164 [0x100656fd0]
+ 2557 ??? (in XojoFramework) load address 0x105684000 + 0xe5278 [0x105769278]
+ 2557 ??? (in XojoFramework) load address 0x105684000 + 0xe51f0 [0x1057691f0]
+ 2557 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] (in AppKit) + 728 [0x1a98735b4]
+ 2557 _DPSNextEvent (in AppKit) + 632 [0x1a9874424]
+ 2557 _BlockUntilNextEventMatchingListInModeWithFilter (in HIToolbox) + 72 [0x1afcc7b2c]
+ 2557 ReceiveNextEventCommon (in HIToolbox) + 672 [0x1afcc7de4]
+ 2557 RunCurrentEventLoopInMode (in HIToolbox) + 292 [0x1afcc7fa0]
+ 2557 CFRunLoopRunSpecific (in CoreFoundation) + 612 [0x1a65f2888]
+ 2557 __CFRunLoopRun (in CoreFoundation) + 1896 [0x1a65f3744]
+ 2557 __CFRunLoopDoTimers (in CoreFoundation) + 356 [0x1a660dd5c]
+ 2557 __CFRunLoopDoTimer (in CoreFoundation) + 940 [0x1a660e204]
+ 2557 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ (in CoreFoundation) + 32 [0x1a660e55c]
+ 2557 ??? (in XojoFramework) load address 0x105684000 + 0xe5b38 [0x105769b38]
+ 2557 ??? (in XojoFramework) load address 0x105684000 + 0x27d1b8 [0x1059011b8]
+ 2557 ??? (in XojoFramework) load address 0x105684000 + 0x27f5a8 [0x1059035a8]
+ 2557 xojo::ConditionVariable::Wait(xojo::UniqueLock&) (in XojoFramework) + 20 [0x1057c29e0]
+ 2557 _pthread_cond_wait (in libsystem_pthread.dylib) + 1232 [0x1a6515638]
+ 2557 __psynch_cvwait (in libsystem_kernel.dylib) + 8 [0x1a64d9564]
2557 Thread_9139864: com.apple.NSURLConnectionLoader
+ 2557 thread_start (in libsystem_pthread.dylib) + 8 [0x1a650fe2c]
+ 2557 _pthread_start (in libsystem_pthread.dylib) + 148 [0x1a651506c]
+ 2557 __NSThread__start__ (in Foundation) + 716 [0x1a74f5470]
+ 2557 ??? (in CFNetwork) load address 0x1aad99000 + 0x253500 [0x1aafec500]
+ 2557 CFRunLoopRunSpecific (in CoreFoundation) + 612 [0x1a65f2888]
+ 2557 __CFRunLoopRun (in CoreFoundation) + 1232 [0x1a65f34ac]
+ 2557 __CFRunLoopServiceMachPort (in CoreFoundation) + 160 [0x1a65f4bc0]
+ 2557 mach_msg (in libsystem_kernel.dylib) + 24 [0x1a64d60ec]
+ 2557 mach_msg_overwrite (in libsystem_kernel.dylib) + 540 [0x1a64de5c4]
+ 2557 mach_msg2_internal (in libsystem_kernel.dylib) + 80 [0x1a64e78a4]
+ 2557 mach_msg2_trap (in libsystem_kernel.dylib) + 8 [0x1a64d5d70]
2557 Thread_9139874: com.apple.NSEventThread
+ 2557 thread_start (in libsystem_pthread.dylib) + 8 [0x1a650fe2c]
+ 2557 _pthread_start (in libsystem_pthread.dylib) + 148 [0x1a651506c]
+ 2557 _NSEventThread (in AppKit) + 172 [0x1a999e410]
+ 2557 CFRunLoopRunSpecific (in CoreFoundation) + 612 [0x1a65f2888]
+ 2541 __CFRunLoopRun (in CoreFoundation) + 1232 [0x1a65f34ac]
+ ! 2541 __CFRunLoopServiceMachPort (in CoreFoundation) + 160 [0x1a65f4bc0]
+ ! 2541 mach_msg (in libsystem_kernel.dylib) + 24 [0x1a64d60ec]
+ ! 2541 mach_msg_overwrite (in libsystem_kernel.dylib) + 540 [0x1a64de5c4]
+ ! 2541 mach_msg2_internal (in libsystem_kernel.dylib) + 80 [0x1a64e78a4]
+ ! 2541 mach_msg2_trap (in libsystem_kernel.dylib) + 8 [0x1a64d5d70]
+ 16 __CFRunLoopRun (in CoreFoundation) + 2264 [0x1a65f38b4]
+ 16 __CFRunLoopDoSource1 (in CoreFoundation) + 520 [0x1a65f4ec8]
+ 16 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ (in CoreFoundation) + 60 [0x1a65f4fa8]
+ 16 __CFMachPortPerform (in CoreFoundation) + 260 [0x1a6624420]
+ 16 MessageHandler(__CFMachPort*, void*, long, void*) (in HIToolbox) + 60 [0x1afcd4ae0]
+ 11 PullEventsFromWindowServerOnConnection(unsigned int, unsigned char, __CFMachPortBoost*) (in HIToolbox) + 60 [0x1afcd4b58]
+ : 11 SLEventCreateNextEvent (in SkyLight) + 16 [0x1ab3445a4]
+ : 11 SLSGetNextEventRecordInternal (in SkyLight) + 344 [0x1ab542a8c]
+ : 9 CGSSnarfAndDispatchDatagrams (in SkyLight) + 160 [0x1ab21ae50]
+ : | 9 mach_msg (in libsystem_kernel.dylib) + 24 [0x1a64d60ec]
+ : | 9 mach_msg_overwrite (in libsystem_kernel.dylib) + 540 [0x1a64de5c4]
+ : | 9 mach_msg2_internal (in libsystem_kernel.dylib) + 80 [0x1a64e78a4]
+ : | 9 mach_msg2_trap (in libsystem_kernel.dylib) + 8 [0x1a64d5d70]
+ : 2 CGSSnarfAndDispatchDatagrams (in SkyLight) + 808 [0x1ab21b0d8]
+ : 2 event_datagram_handler(unsigned int, CGSDatagramType, void*, unsigned long, void*) (in SkyLight) + 92 [0x1ab542164]
+ : 2 CGSDecodeEventRecord (in SkyLight) + 56 [0x1ab21b8ec]
+ : 2 SLEventRecordCreateWithBytesAndSource(void const*, unsigned long, __CGEventSource*) (in SkyLight) + 496 [0x1ab344944]
+ : 2 SLEventGetFieldDecodeDescriptor(SLEventToken)::$_18::__invoke(SLSEventRecord*, SLEventToken, SLEventData&) (in SkyLight) + 84 [0x1ab3450f4]
+ : 2 IOHIDEventCreateWithBytes (in IOKit) + 344 [0x1a97054c0]
+ : 2 IOHIDEventAppendEvent (in IOKit) + 60 [0x1a971117c]
+ : 1 CFArrayCreateMutable (in CoreFoundation) + 140 [0x1a6590440]
+ : + 1 CFArrayCreateMutable (in CoreFoundation) + 176 [0x1a6590464]
+ : 1 CFArrayCreateMutable (in CoreFoundation) + 188 [0x1a6590470]
+ : 1 objc_msgSend (in libobjc.A.dylib) + 64 [0x1a61a9840]
+ 5 PullEventsFromWindowServerOnConnection(unsigned int, unsigned char, __CFMachPortBoost*) (in HIToolbox) + 312 [0x1afcd4c54]
+ 5 SLEventCreateNextEvent (in SkyLight) + 16 [0x1ab3445a4]
+ 5 SLSGetNextEventRecordInternal (in SkyLight) + 344 [0x1ab542a8c]
+ 5 CGSSnarfAndDispatchDatagrams (in SkyLight) + 160 [0x1ab21ae50]
+ 5 mach_msg (in libsystem_kernel.dylib) + 24 [0x1a64d60ec]
+ 5 mach_msg_overwrite (in libsystem_kernel.dylib) + 540 [0x1a64de5c4]
+ 5 mach_msg2_internal (in libsystem_kernel.dylib) + 80 [0x1a64e78a4]
+ 5 mach_msg2_trap (in libsystem_kernel.dylib) + 8 [0x1a64d5d70]
2557 Thread_9139912
+ 2557 thread_start (in libsystem_pthread.dylib) + 8 [0x1a650fe2c]
+ 2557 _pthread_start (in libsystem_pthread.dylib) + 148 [0x1a651506c]
+ 2557 ??? (in XojoFramework) load address 0x105684000 + 0x13e6c4 [0x1057c26c4]
+ 2557 ??? (in XojoFramework) load address 0x105684000 + 0x27e6d4 [0x1059026d4]
+ 2557 AnimationKit.Coordinator.ThreadedAnimator_Run%%o<AnimationKit.Coordinator>o<Thread> (in Beacon) + 420 [0x101ec6b74]
+ 2557 Thread.Pause%%o<Thread> (in Beacon) + 16 [0x100643e10]
+ 2557 ??? (in XojoFramework) load address 0x105684000 + 0x27d1b8 [0x1059011b8]
+ 2557 ??? (in XojoFramework) load address 0x105684000 + 0x27f5a8 [0x1059035a8]
+ 2557 xojo::ConditionVariable::Wait(xojo::UniqueLock&) (in XojoFramework) + 20 [0x1057c29e0]
+ 2557 _pthread_cond_wait (in libsystem_pthread.dylib) + 1232 [0x1a6515638]
+ 2557 __psynch_cvwait (in libsystem_kernel.dylib) + 8 [0x1a64d9564]
2557 Thread_9222867
+ 2557 thread_start (in libsystem_pthread.dylib) + 8 [0x1a650fe2c]
+ 2557 _pthread_start (in libsystem_pthread.dylib) + 148 [0x1a651506c]
+ 2557 ??? (in XojoFramework) load address 0x105684000 + 0x13e6c4 [0x1057c26c4]
+ 2557 ??? (in XojoFramework) load address 0x105684000 + 0x27e6d4 [0x1059026d4]
+ 2557 Beacon.Thread.Event_Run%%o<Beacon.Thread> (in Beacon) + 128 [0x100ba5078]
+ 2557 Ark.ImportThread.Event_Run%%o<Ark.ImportThread> (in Beacon) + 23324 [0x101a760a4]
+ 2557 Ark.ImportThread.Import%v%o<Ark.ImportThread>s (in Beacon) + 776 [0x101aa6dd4]
+ 2557 Ark.ImportThread.!ToXojoType%v%v (in Beacon) + 9052 [0x101aaa234]
+ 2557 Ark.ImportThread.!ToXojoType%v%v (in Beacon) + 10380 [0x101aaa764]
+ 2557 Ark.ImportThread.!ToXojoType%v%v (in Beacon) + 7904 [0x101aa9db8]
+ 2557 Ark.ImportThread.!ToXojoType%v%v (in Beacon) + 10380 [0x101aaa764]
+ 2557 Ark.ImportThread.!ToXojoType%v%v (in Beacon) + 7904 [0x101aa9db8]
+ 2557 Ark.ImportThread.!ToXojoType%v%v (in Beacon) + 10488 [0x101aaa7d0]
+ 2557 RuntimeBackgroundTask (in XojoFramework) + 40 [0x1057f6fc4]
+ 2557 ??? (in XojoFramework) load address 0x105684000 + 0x27d1b8 [0x1059011b8]
+ 2557 ??? (in XojoFramework) load address 0x105684000 + 0x27f5a8 [0x1059035a8]
+ 2557 xojo::ConditionVariable::Wait(xojo::UniqueLock&) (in XojoFramework) + 20 [0x1057c29e0]
+ 2557 _pthread_cond_wait (in libsystem_pthread.dylib) + 1232 [0x1a6515638]
+ 2557 __psynch_cvwait (in libsystem_kernel.dylib) + 8 [0x1a64d9564]
2557 Thread_9222868
+ 2557 thread_start (in libsystem_pthread.dylib) + 8 [0x1a650fe2c]
+ 2557 _pthread_start (in libsystem_pthread.dylib) + 148 [0x1a651506c]
+ 2557 ??? (in XojoFramework) load address 0x105684000 + 0x13e6c4 [0x1057c26c4]
+ 2557 ??? (in XojoFramework) load address 0x105684000 + 0x27e6d4 [0x1059026d4]
+ 2557 Beacon.Thread.Event_Run%%o<Beacon.Thread> (in Beacon) + 128 [0x100ba5078]
+ 2557 Ark.ImportThread.Event_Run%%o<Ark.ImportThread> (in Beacon) + 59520 [0x101a7ee08]
+ 2557 Ark.ImportThread.BuildProject%o<Ark.Project>%o<Ark.ImportThread>o<Dictionary>o<Dictionary> (in Beacon) + 119040 [0x101a9cb14]
+ 2557 Ark.Configs.CreateInstance%o<Ark.ConfigGroup>%so<Dictionary>o<Dictionary>o<Ark.Project> (in Beacon) + 5028 [0x100de5e8c]
+ 2557 Ark.Configs.LootDrops.!FromImport%o<Ark.Configs.LootDrops>%o<Dictionary>o<Dictionary>u8f8o<Beacon.StringList> (in Beacon) + 4804 [0x100eddd48]
+ 2557 Ark.LootContainer.!ImportFromConfig%o<Ark.LootContainer>%o<Dictionary>f8o<Beacon.StringList> (in Beacon) + 43924 [0x1011b5f60]
+ 2557 Ark.LootItemSet.!ImportFromConfig%o<Ark.LootItemSet>%o<Dictionary>o<Beacon.Range>f8o<Beacon.StringList> (in Beacon) + 9804 [0x10170cf48]
+ 2557 Ark.LootItemSetEntry.!ImportFromConfig%o<Ark.LootItemSetEntry>%o<Dictionary>o<Beacon.Range>f8o<Beacon.StringList> (in Beacon) + 45132 [0x10174ae20]
+ 2557 Ark.ResolveEngram%o<Ark.Engram>%ssso<Beacon.StringList> (in Beacon) + 1940 [0x100d9e758]
+ 2557 Ark.DataSource.GetEngramsByClass%A1o<Ark.Engram>%o<Ark.DataSource>so<Beacon.StringList> (in Beacon) + 924 [0x10159978c]
+ 2557 Beacon.DataSource.*SQLSelect%o<RowSet>%o<Beacon.DataSource>sA1v (in Beacon) + 536 [0x100c59a50]
+ 2557 Database.SelectSQL%o<RowSet>%o<Database>sA1v (in Beacon) + 64 [0x100494e08]
+ 2557 DatabaseSelectSQL (in XojoFramework) + 72 [0x105809d6c]
+ 2557 ??? (in SQLiteDatabase.dylib) load address 0x1092fc000 + 0x6814 [0x109302814]
+ 2557 ??? (in SQLiteDatabase.dylib) load address 0x1092fc000 + 0xe8b0 [0x10930a8b0]
+ 2557 ??? (in SQLiteDatabase.dylib) load address 0x1092fc000 + 0x9d48 [0x109305d48]
+ 2557 ??? (in SQLiteDatabase.dylib) load address 0x1092fc000 + 0x1da0c [0x109319a0c]
+ 2557 _pthread_mutex_firstfit_lock_slow (in libsystem_pthread.dylib) + 248 [0x1a650fa9c]
+ 2557 _pthread_mutex_firstfit_lock_wait (in libsystem_pthread.dylib) + 84 [0x1a6512144]
+ 2557 __psynch_mutexwait (in libsystem_kernel.dylib) + 8 [0x1a64d8a1c]
2557 Thread_9222870
+ 2557 thread_start (in libsystem_pthread.dylib) + 8 [0x1a650fe2c]
+ 2557 _pthread_start (in libsystem_pthread.dylib) + 148 [0x1a651506c]
+ 2557 ??? (in XojoFramework) load address 0x105684000 + 0x13e6c4 [0x1057c26c4]
+ 2557 ??? (in XojoFramework) load address 0x105684000 + 0x27e6d4 [0x1059026d4]
+ 2557 Beacon.Thread.Event_Run%%o<Beacon.Thread> (in Beacon) + 128 [0x100ba5078]
+ 2557 Ark.ImportThread.Event_Run%%o<Ark.ImportThread> (in Beacon) + 59520 [0x101a7ee08]
+ 2557 Ark.ImportThread.BuildProject%o<Ark.Project>%o<Ark.ImportThread>o<Dictionary>o<Dictionary> (in Beacon) + 119040 [0x101a9cb14]
+ 2557 Ark.Configs.CreateInstance%o<Ark.ConfigGroup>%so<Dictionary>o<Dictionary>o<Ark.Project> (in Beacon) + 5028 [0x100de5e8c]
+ 2557 Ark.Configs.LootDrops.!FromImport%o<Ark.Configs.LootDrops>%o<Dictionary>o<Dictionary>u8f8o<Beacon.StringList> (in Beacon) + 4804 [0x100eddd48]
+ 2557 Ark.LootContainer.!ImportFromConfig%o<Ark.LootContainer>%o<Dictionary>f8o<Beacon.StringList> (in Beacon) + 43924 [0x1011b5f60]
+ 2557 Ark.LootItemSet.!ImportFromConfig%o<Ark.LootItemSet>%o<Dictionary>o<Beacon.Range>f8o<Beacon.StringList> (in Beacon) + 9804 [0x10170cf48]
+ 2557 Ark.LootItemSetEntry.!ImportFromConfig%o<Ark.LootItemSetEntry>%o<Dictionary>o<Beacon.Range>f8o<Beacon.StringList> (in Beacon) + 45132 [0x10174ae20]
+ 2557 Ark.ResolveEngram%o<Ark.Engram>%ssso<Beacon.StringList> (in Beacon) + 1940 [0x100d9e758]
+ 2557 Ark.DataSource.GetEngramsByClass%A1o<Ark.Engram>%o<Ark.DataSource>so<Beacon.StringList> (in Beacon) + 924 [0x10159978c]
+ 2557 Beacon.DataSource.*SQLSelect%o<RowSet>%o<Beacon.DataSource>sA1v (in Beacon) + 536 [0x100c59a50]
+ 2557 Database.SelectSQL%o<RowSet>%o<Database>sA1v (in Beacon) + 64 [0x100494e08]
+ 2557 DatabaseSelectSQL (in XojoFramework) + 72 [0x105809d6c]
+ 2557 ??? (in SQLiteDatabase.dylib) load address 0x1092fc000 + 0x6814 [0x109302814]
+ 2557 ??? (in SQLiteDatabase.dylib) load address 0x1092fc000 + 0xf0f0 [0x10930b0f0]
+ 2557 ??? (in SQLiteDatabase.dylib) load address 0x1092fc000 + 0x925c [0x10930525c]
+ 2557 ??? (in SQLiteDatabase.dylib) load address 0x1092fc000 + 0x15b1c [0x109311b1c]
+ 2557 ??? (in SQLiteDatabase.dylib) load address 0x1092fc000 + 0x42304 [0x10933e304]
+ 2557 ??? (in SQLiteDatabase.dylib) load address 0x1092fc000 + 0xa458 [0x109306458]
+ 2557 RuntimeBackgroundTask (in XojoFramework) + 40 [0x1057f6fc4]
+ 2557 ??? (in XojoFramework) load address 0x105684000 + 0x27d1b8 [0x1059011b8]
+ 2557 ??? (in XojoFramework) load address 0x105684000 + 0x27f5a8 [0x1059035a8]
+ 2557 xojo::ConditionVariable::Wait(xojo::UniqueLock&) (in XojoFramework) + 20 [0x1057c29e0]
+ 2557 _pthread_cond_wait (in libsystem_pthread.dylib) + 1232 [0x1a6515638]
+ 2557 __psynch_cvwait (in libsystem_kernel.dylib) + 8 [0x1a64d9564]
2557 Thread_9223047
2557 start_wqthread (in libsystem_pthread.dylib) + 8 [0x1a650fe20]
2557 _pthread_wqthread (in libsystem_pthread.dylib) + 364 [0x1a651114c]
2557 __workq_kernreturn (in libsystem_kernel.dylib) + 8 [0x1a64d7a1c]
Total number in stack (recursive counted multiple, when >=5):
6 _pthread_start (in libsystem_pthread.dylib) + 148 [0x1a651506c]
6 thread_start (in libsystem_pthread.dylib) + 8 [0x1a650fe2c]
Sort by top of stack, same collapsed (when >= 5):
__psynch_cvwait (in libsystem_kernel.dylib) 10228
mach_msg2_trap (in libsystem_kernel.dylib) 5112
__psynch_mutexwait (in libsystem_kernel.dylib) 2557
__workq_kernreturn (in libsystem_kernel.dylib) 2557