App crashes a lot with RunCurrentEventLoopInMode

I have developed and distributed a Mac app on App Store. From the Organizer in Xcode, I noticed that it has a lot of crashes. And 90% of these crashes is the same crash as following:

Thread 0 Crashed: 0 libsystem_kernel.dylib 0x00007ff81ce27112 __pthread_kill + 10 1 libsystem_pthread.dylib 0x00007ff81ce5d233 pthread_kill + 263 2 libsystem_c.dylib 0x00007ff81cda9d10 abort + 123 3 libc++abi.dylib 0x00007ff81ce1a0b2 abort_message + 241 4 libc++abi.dylib 0x00007ff81ce0b1fd demangling_terminate_handler() + 266 5 libobjc.A.dylib 0x00007ff81cd08509 _objc_terminate() + 96 6 libc++abi.dylib 0x00007ff81ce194d7 std::__terminate(void (*)()) + 8 7 libc++abi.dylib 0x00007ff81ce19488 std::terminate() + 56 8 libdispatch.dylib 0x00007ff81cca6cdd _dispatch_client_callout + 28 9 libdispatch.dylib 0x00007ff81cca9746 _dispatch_continuation_pop + 460 10 libdispatch.dylib 0x00007ff81ccbaa5a _dispatch_source_invoke + 2150 11 libdispatch.dylib 0x00007ff81ccb3518 _dispatch_main_queue_callback_4CF + 759 12 CoreFoundation 0x00007ff81cf625d9 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 9 13 CoreFoundation 0x00007ff81cf236ae __CFRunLoopRun + 2752 14 CoreFoundation 0x00007ff81cf2252d CFRunLoopRunSpecific + 563 15 HIToolbox 0x00007ff825b403e1 RunCurrentEventLoopInMode + 292 16 HIToolbox 0x00007ff825b40137 ReceiveNextEventCommon + 587 17 HIToolbox 0x00007ff825b3fed5 _BlockUntilNextEventMatchingListInModeWithFilter + 70 18 AppKit 0x00007ff81f94d8f0 _DPSNextEvent + 886 19 AppKit 0x00007ff81f94bf5c -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1411 20 AppKit 0x00007ff81f93e359 -[NSApplication run] + 586 21 AppKit 0x00007ff81f9121f8 NSApplicationMain + 816

How to fix this issue?

Answered by DTS Engineer in 803899022

Your crash reports all have a crashing thread backtrace like this:

Thread 0 Crashed:
0  libsystem_kernel.dylib  … __pthread_kill + 8
1  libsystem_pthread.dylib … pthread_kill + 288 (pthread.c:1681)
2  libsystem_c.dylib       … abort + 180 (abort.c:118)
3  libc++abi.dylib         … abort_message + 132 (abort_message.cpp:78)
4  libc++abi.dylib         … demangling_terminate_handler() + 348 (cxa_default_handlers.cpp:77)
5  libobjc.A.dylib         … _objc_terminate() + 144 (objc-exception.mm:496)
6  libc++abi.dylib         … std::__terminate(void (*)()) + 16 (cxa_handlers.cpp:59)
7  libc++abi.dylib         … std::terminate() + 108 (cxa_handlers.cpp:88)
8  libdispatch.dylib       … _dispatch_client_callout + 40 (object.m:564)
9  libdispatch.dylib       … _dispatch_continuation_pop + 600 (queue.c:306)
10 libdispatch.dylib       … _dispatch_source_latch_and_call + 420 (source.c:596)
11 libdispatch.dylib       … _dispatch_source_invoke + 832 (source.c:961)
12 libdispatch.dylib       … _dispatch_main_queue_drain + 744 (queue.c:7813)
13 libdispatch.dylib       … _dispatch_main_queue_callback_4CF + 44 (queue.c:7973)
14 CoreFoundation          … __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16 (CFRunLoop.c:1780)
15 CoreFoundation          … __CFRunLoopRun + 1996 (CFRunLoop.c:3149)
16 CoreFoundation          … CFRunLoopRunSpecific + 608 (CFRunLoop.c:3420)
17 HIToolbox               … RunCurrentEventLoopInMode + 292 (EventLoop.c:455)
18 HIToolbox               … ReceiveNextEventCommon + 648 (EventBlocking.c:384)
19 HIToolbox               … _BlockUntilNextEventMatchingListInModeWithFilter + 76 (EventBlocking.c:171)
20 AppKit                  … _DPSNextEvent + 660 (CGDPSReplacement.m:806)
21 AppKit                  … -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:deque…
22 AppKit                  … -[NSApplication run] + 476 (NSApplication.m:3509)
23 AppKit                  … NSApplicationMain + 880 (NSApplication.m:10132)
24 dyld                    … start + 2360 (dyldMain.cpp:1269)

Frames 7 through 0 indicate that your app crashed due to an unhandled language exception. Usually when this happens the crash report includes a Last Exception Backtrace section that shows the source of the exception. That’s not present here.

The most common reason for this to be missing is that this is a C++ exception. See here for more details.

Does your app make a lot of use of C++?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Please post a full Apple crash report, be the instructions in Posting a Crash Report.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

This is the full Apple crash report.

Process:               Paint S [85526]
Path:                  /Applications/Paint S.app/Contents/MacOS/Paint S
Identifier:            com.TryBest.Paint
Version:               7.11.2 (2408190016)
App Item ID:           736473980
App External ID:       868296441
Code Type:             ARM-64
Parent Process:        launchd [1]
User ID:               501

Date/Time:             2024-09-11 13:26:19.5906 -0500
OS Version:            macOS 14.6.1 (23G93)
Report Version:        12
Anonymous UUID:        CAB3BF4B-3C4D-1A5E-1B67-6EA4097791A4

Sleep/Wake UUID:       F7E4A3FA-771E-4141-AF98-50B926867D0D

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

System Integrity Protection: enabled

Crashed Thread:        0

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

Termination Reason:    Namespace SIGNAL, Code 6 Abort trap: 6
Terminating Process:   Paint S [85526]

Thread 0 Crashed:
0   libsystem_kernel.dylib        	0x00000001830fd5f0 __pthread_kill + 8 (:-1)
1   libsystem_pthread.dylib       	0x0000000183135c20 pthread_kill + 288 (pthread.c:1721)
2   libsystem_c.dylib             	0x0000000183042a30 abort + 180 (abort.c:118)
3   libc++abi.dylib               	0x00000001830ecd08 abort_message + 132 (abort_message.cpp:78)
4   libc++abi.dylib               	0x00000001830dcfc0 demangling_terminate_handler() + 348 (cxa_default_handlers.cpp:77)
5   libobjc.A.dylib               	0x0000000182d77bf0 _objc_terminate() + 144 (objc-exception.mm:496)
6   libc++abi.dylib               	0x00000001830ec0cc std::__terminate(void (*)()) + 16 (cxa_handlers.cpp:59)
7   libc++abi.dylib               	0x00000001830ec070 std::terminate() + 108 (cxa_handlers.cpp:88)
8   libdispatch.dylib             	0x0000000182f853fc _dispatch_client_callout + 40 (object.m:579)
9   libdispatch.dylib             	0x0000000182f888ec _dispatch_continuation_pop + 600 (queue.c:321)
10  libdispatch.dylib             	0x0000000182f9c7f0 _dispatch_source_latch_and_call + 420 (source.c:596)
11  libdispatch.dylib             	0x0000000182f9b3b4 _dispatch_source_invoke + 832 (source.c:961)
12  libdispatch.dylib             	0x0000000182f93ac8 _dispatch_main_queue_drain + 748 (queue.c:7898)
13  libdispatch.dylib             	0x0000000182f937cc _dispatch_main_queue_callback_4CF + 44 (queue.c:8058)
14  CoreFoundation                	0x0000000183256ad4 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16 (CFRunLoop.c:1780)
15  CoreFoundation                	0x0000000183214258 __CFRunLoopRun + 1996 (CFRunLoop.c:3149)
16  CoreFoundation                	0x0000000183213434 CFRunLoopRunSpecific + 608 (CFRunLoop.c:3420)
17  HIToolbox                     	0x000000018d9bd19c RunCurrentEventLoopInMode + 292 (EventLoop.c:455)
18  HIToolbox                     	0x000000018d9bcfd8 ReceiveNextEventCommon + 648 (EventBlocking.c:384)
19  HIToolbox                     	0x000000018d9bcd30 _BlockUntilNextEventMatchingListInModeWithFilter + 76 (EventBlocking.c:171)
20  AppKit                        	0x0000000186a72cc8 _DPSNextEvent + 660 (CGDPSReplacement.m:810)
21  AppKit                        	0x00000001872694d0 -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 700 (appEventRouting.m:413)
22  AppKit                        	0x0000000186a65ffc -[NSApplication run] + 476 (NSApplication.m:3513)
23  AppKit                        	0x0000000186a3d240 NSApplicationMain + 880 (NSApplication.m:10143)
24  dyld                          	0x0000000182dab154 start + 2476 (dyldMain.cpp:1298)

[2024-09-11_19-37-16.8487_+0500-9b3de95041b152d8014ed4f36ade910c7c1e6155.crash](https://developer.apple.com/forums/content/attachment/64b37c24-4ba9-4a49-b443-ac483fa7f19a)

[2024-09-11_13-26-19.5906_-0500-46ef74c1f117cfbc38d04b5a24efc823529bb471.crash](https://developer.apple.com/forums/content/attachment/ee411b29-f8a0-432d-9178-83ab2792b0d1)


[2024-09-11_17-53-58.3754_+0530-d907ae8ccd370b536edcfc5fd5b0f91e873d3ee4.crash](https://developer.apple.com/forums/content/attachment/23aef497-ca3b-4302-9ef0-626af88449e4)

Your crash reports all have a crashing thread backtrace like this:

Thread 0 Crashed:
0  libsystem_kernel.dylib  … __pthread_kill + 8
1  libsystem_pthread.dylib … pthread_kill + 288 (pthread.c:1681)
2  libsystem_c.dylib       … abort + 180 (abort.c:118)
3  libc++abi.dylib         … abort_message + 132 (abort_message.cpp:78)
4  libc++abi.dylib         … demangling_terminate_handler() + 348 (cxa_default_handlers.cpp:77)
5  libobjc.A.dylib         … _objc_terminate() + 144 (objc-exception.mm:496)
6  libc++abi.dylib         … std::__terminate(void (*)()) + 16 (cxa_handlers.cpp:59)
7  libc++abi.dylib         … std::terminate() + 108 (cxa_handlers.cpp:88)
8  libdispatch.dylib       … _dispatch_client_callout + 40 (object.m:564)
9  libdispatch.dylib       … _dispatch_continuation_pop + 600 (queue.c:306)
10 libdispatch.dylib       … _dispatch_source_latch_and_call + 420 (source.c:596)
11 libdispatch.dylib       … _dispatch_source_invoke + 832 (source.c:961)
12 libdispatch.dylib       … _dispatch_main_queue_drain + 744 (queue.c:7813)
13 libdispatch.dylib       … _dispatch_main_queue_callback_4CF + 44 (queue.c:7973)
14 CoreFoundation          … __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16 (CFRunLoop.c:1780)
15 CoreFoundation          … __CFRunLoopRun + 1996 (CFRunLoop.c:3149)
16 CoreFoundation          … CFRunLoopRunSpecific + 608 (CFRunLoop.c:3420)
17 HIToolbox               … RunCurrentEventLoopInMode + 292 (EventLoop.c:455)
18 HIToolbox               … ReceiveNextEventCommon + 648 (EventBlocking.c:384)
19 HIToolbox               … _BlockUntilNextEventMatchingListInModeWithFilter + 76 (EventBlocking.c:171)
20 AppKit                  … _DPSNextEvent + 660 (CGDPSReplacement.m:806)
21 AppKit                  … -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:deque…
22 AppKit                  … -[NSApplication run] + 476 (NSApplication.m:3509)
23 AppKit                  … NSApplicationMain + 880 (NSApplication.m:10132)
24 dyld                    … start + 2360 (dyldMain.cpp:1269)

Frames 7 through 0 indicate that your app crashed due to an unhandled language exception. Usually when this happens the crash report includes a Last Exception Backtrace section that shows the source of the exception. That’s not present here.

The most common reason for this to be missing is that this is a C++ exception. See here for more details.

Does your app make a lot of use of C++?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

There is another similar crash report. Frames 7 through 0 indicate that the app crashed due to an unhandled language exception. But the exception reason is: *** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]

Process:               Paint S [88362]
Path:                  /Applications/Paint S.app/Contents/MacOS/Paint S
Identifier:            com.TryBest.Paint
Version:               7.8.3 (2403120805)
App Item ID:           736473980
App External ID:       864367045
Code Type:             ARM-64
Parent Process:        launchd [1]
User ID:               501

Date/Time:             2024-03-19 12:41:59.0936 +0200
OS Version:            macOS 14.4 (23E214)
Report Version:        12
Anonymous UUID:        08D591C1-63DA-95A7-396A-5FD17C48AB75

Sleep/Wake UUID:       01D06BE6-DF76-47D3-9867-784706B4EFF5

Time Awake Since Boot: 330000 seconds
Time Since Wake:       10956 seconds

System Integrity Protection: enabled

Crashed Thread:        0

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Reason:      *** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]

Termination Reason:    Namespace SIGNAL, Code 6 Abort trap: 6
Terminating Process:   Paint S [88362]

Kernel Triage:
VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter
VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter
VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter
VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter
VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter


Thread 0 Crashed:
0   libsystem_kernel.dylib        	0x000000019e29aa60 __pthread_kill + 8
1   libsystem_pthread.dylib       	0x000000019e2d2c20 pthread_kill + 288 (pthread.c:1717)
2   libsystem_c.dylib             	0x000000019e1dfa20 abort + 180 (abort.c:118)
3   libc++abi.dylib               	0x000000019e289d30 abort_message + 132 (abort_message.cpp:78)
4   libc++abi.dylib               	0x000000019e279fe8 demangling_terminate_handler() + 348 (cxa_default_handlers.cpp:77)
5   libobjc.A.dylib               	0x000000019df181d0 _objc_terminate() + 144 (objc-exception.mm:496)
6   libc++abi.dylib               	0x000000019e2890f4 std::__terminate(void (*)()) + 16 (cxa_handlers.cpp:59)
7   libc++abi.dylib               	0x000000019e289098 std::terminate() + 108 (cxa_handlers.cpp:88)
8   libdispatch.dylib             	0x000000019e1223fc _dispatch_client_callout + 40 (object.m:579)
9   libdispatch.dylib             	0x000000019e1258ec _dispatch_continuation_pop + 600 (queue.c:321)
10  libdispatch.dylib             	0x000000019e1397f0 _dispatch_source_latch_and_call + 420 (source.c:596)
11  libdispatch.dylib             	0x000000019e1383b4 _dispatch_source_invoke + 832 (source.c:961)
12  libdispatch.dylib             	0x000000019e130ac8 _dispatch_main_queue_drain + 748 (queue.c:7898)
13  libdispatch.dylib             	0x000000019e1307cc _dispatch_main_queue_callback_4CF + 44 (queue.c:8058)
14  CoreFoundation                	0x000000019e3f34ac __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16 (CFRunLoop.c:1780)
15  CoreFoundation                	0x000000019e3b0c30 __CFRunLoopRun + 1996 (CFRunLoop.c:3149)
16  CoreFoundation                	0x000000019e3afe0c CFRunLoopRunSpecific + 608 (CFRunLoop.c:3420)
17  HIToolbox                     	0x00000001a8b4b000 RunCurrentEventLoopInMode + 292 (EventLoop.c:455)
18  HIToolbox                     	0x00000001a8b4ae3c ReceiveNextEventCommon + 648 (EventBlocking.c:384)
19  HIToolbox                     	0x00000001a8b4ab94 _BlockUntilNextEventMatchingListInModeWithFilter + 76 (EventBlocking.c:171)
20  AppKit                        	0x00000001a1c08970 _DPSNextEvent + 660 (CGDPSReplacement.m:810)
21  AppKit                        	0x00000001a23fadec -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 700 (appEventRouting.m:413)
22  AppKit                        	0x00000001a1bfbcb8 -[NSApplication run] + 476 (NSApplication.m:3513)
23  AppKit                        	0x00000001a1bd2f54 NSApplicationMain + 880 (NSApplication.m:10136)
24  dyld                          	0x000000019df4a0e0 start + 2360 (dyldMain.cpp:1298)
[2024-03-19_12-41-59.0936_+0200-023f789a22d2587e41bf4990cddaee62fdacfe5e.crash](https://developer.apple.com/forums/content/attachment/028c7834-dff8-463f-9eb5-a53daa5cddfd)

App crashes a lot with RunCurrentEventLoopInMode
 
 
Q