Help understanding very cryptic crash report from TestFlight - "mach_msg2_trap"

I have received this crash report via TestFlight and I am not able to discern any useful information from it:

The crash is 100% reproducible on the user's device, but when I do ostensibly the same set of things on my device the crash does not reproduce, so this is all of the information that I have about crash.

Does anyone have some golden nugget of knowledge related to this that they are willing to help me out with?

Show us the whole crash log or look carefully at it yourself. As @eskimo mentioned here the actual crash might be on a different thread, even when you see "Thread 0 crashed".

Here are the rest of the threads (1-6).

So, Thread-2 is actually crashing within "ProcessOutOfLineJob:..." method - unfortunately we don't see the method name on the screenshot to tell what it is. What does the yellow triangle show when you hover over it?

You know that you can reveal the actual crash log in Finder (control click + Show in Finder -> Show Package Contents) - it will reveal more information. Send it here if appropriate.

Do not underestimate the power of hex addresses in the crash log - along with the corresponding binary that can pinpoint you to the right spot in the asm.

Edit: more than likely the crash is somewhere here:

SWIFT_CC(swiftasync)
void ProcessOutOfLineJob::process(Job *job) {
  auto self = cast<ProcessOutOfLineJob>(job);
  DefaultActorImpl *actor = self->Actor;
  delete self;

  // Balances with the swift_release in defaultActorDrain()
  swift_retain(actor);
  return defaultActorDrain(actor); // 'return' forces tail call
}

A full crash report may reveal more.

Here's thread 2 from crashlog.crash:

Thread 2 Crashed:
0   ???                           	0x00000000b71b8091 0x0 + 3072032913
1   libswift_Concurrency.dylib    	0x00000002276b9828 (anonymous namespace)::ProcessOutOfLineJob::process(swift::Job*) + 884 (Actor.cpp:1323)
2   libswift_Concurrency.dylib    	0x00000002276b7eb8 swift::runJobInEstablishedExecutorContext(swift::Job*) + 556 (Actor.cpp:229)
3   libswift_Concurrency.dylib    	0x00000002276b8cd0 swift_job_runImpl(swift::Job*, swift::ExecutorRef) + 72 (Actor.cpp:1563)
4   libdispatch.dylib             	0x0000000199e15e98 _dispatch_root_queue_drain + 396 (queue.c:7051)
5   libdispatch.dylib             	0x0000000199e166c0 _dispatch_worker_thread2 + 164 (queue.c:7119)
6   libsystem_pthread.dylib       	0x0000000199fb0038 _pthread_wqthread + 228 (pthread.c:2631)
7   libsystem_pthread.dylib       	0x0000000199faed94 start_wqthread + 8

and a better screenshot just in case:

Thank you very much for the help!

You didn't show the beginning of the crash report where this information is:

Relevant bits
Incident Identifier: XXX
Hardware Model:      iPhone12,1
Process:             XXX
Path:                XXX
Identifier:          XXX
Version:             XXX
AppStoreTools:       XXX
AppVariant:          XXX
Beta:                YES
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           XXX

Date/Time:          XXX
Launch Time:         XXX
OS Version:          XXX
Release Type:        User
Baseband Version:    XXX
Report Version:      XXX

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000001c0ae4cd0
Exception Note:  EXC_CORPSE_NOTIFY
Termination Reason: SIGNAL 5 Trace/BPT trap: 5
Terminating Process: exc handler [2191]

Also this line from the bottom of the log file, to know exact version and location of libswift_Concurrency.dylib:

0x1c0aab000 - 0x1c0fc1fff libswift_Concurrency.dylib arm64e  <383d0f93bac03e4aaec94b2ed9ed9fc1> /usr/lib/xxxx

Here 0x1c0aab000 is the start of the memory segment, 383d0f93bac03e4aaec94b2ed9ed9fc1 is "a build UUID that uniquely identifies the binary image" and "/usr/lib/xxxx" is the file path where you can get the actual library file. You may use "otool -L ..." to get exact library version. How to go from either of that to the corresponding git commit hash - I don't know.

Ideally you need to know exact version to get the corresponding "Actor.cpp" file and look at line 1323.

Alternatively, if you have the libswift_Concurrency.dylib binary file you can atos it. You'll need the numbers (0x00000002276b9828, 884 and the start of the segment are the numbers you'd need to put to atos to get the corresponding line).


It doesn't actually help much yet :slight_smile: Now you understand where the crash is, approximately or exactly – the next question is how do you fix it..

Thank you for the ideas and suggestions. I'll try out the deep digging techniques shortly if I remain stuck.

The full (only slightly redacted) crash report ...
Process:               XXX [21520]
Path:                  /Applications/XXX.app/Contents/MacOS/XXX
Identifier:            XXX
Version:               1.0 (15)
App Item ID:           1667297799
Code Type:             ARM-64
Parent Process:        launchd [1]
User ID:               501

Date/Time:             2023-05-03 08:29:58.1817 -0500
OS Version:            macOS 13.4 (22F5027f)
Report Version:        12
Anonymous UUID:        

Sleep/Wake UUID:       D4C12A76-46AE-4E7C-8F9D-0BD46DB41BC1

Time Awake Since Boot: 850000 seconds
Time Since Wake:       47 seconds

System Integrity Protection: enabled

Crashed Thread:        2

Exception Type:        EXC_BAD_ACCESS (SIGBUS)
Exception Codes:       UNKNOWN_0x101 at 0x00000000b71b8091
Exception Codes:       0x0000000000000101, 0x00000000b71b8091

Termination Reason:    Namespace SIGNAL, Code 10 Bus error: 10
Terminating Process:   exc handler [21520]

VM Region Info: 0xb71b8091 is not in any region.  Bytes before following region: 1302232943
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      __TEXT                      104ba0000-1053f0000    [ 8512K] r-x/r-x SM=COW  ...S/XXX

Thread 0:
0   libsystem_kernel.dylib        	0x0000000199f73f14 mach_msg2_trap + 8
1   libsystem_kernel.dylib        	0x0000000199f86240 mach_msg2_internal + 80 (mach_msg.c:201)
2   libsystem_kernel.dylib        	0x0000000199f7cb78 mach_msg_overwrite + 604 (mach_msg.c:0)
3   libsystem_kernel.dylib        	0x0000000199f74290 mach_msg + 24 (mach_msg.c:323)
4   CoreFoundation                	0x000000019a092888 __CFRunLoopServiceMachPort + 160 (CFRunLoop.c:2622)
5   CoreFoundation                	0x000000019a091168 __CFRunLoopRun + 1208 (CFRunLoop.c:3005)
6   CoreFoundation                	0x000000019a09055c CFRunLoopRunSpecific + 612 (CFRunLoop.c:3418)
7   HIToolbox                     	0x00000001a39c6df4 RunCurrentEventLoopInMode + 292 (EventLoop.c:455)
8   HIToolbox                     	0x00000001a39c6c30 ReceiveNextEventCommon + 648 (EventBlocking.c:384)
9   HIToolbox                     	0x00000001a39c6988 _BlockUntilNextEventMatchingListInModeWithFilter + 76 (EventBlocking.c:171)
10  AppKit                        	0x000000019d2aff58 _DPSNextEvent + 636 (CGDPSReplacement.m:818)
11  AppKit                        	0x000000019d2af0f4 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 716 (appEventRouting.m:407)
12  AppKit                        	0x000000019d2a3558 -[NSApplication run] + 464 (NSApplication.m:3414)
13  AppKit                        	0x000000019d27a9a8 NSApplicationMain + 880 (NSApplication.m:9401)
14  SwiftUI                       	0x00000001c2ab4e34 specialized runApp(_:) + 148
15  SwiftUI                       	0x00000001c3c14ec8 runApp<A>(_:) + 164 (AppKitApp.swift:13)
16  SwiftUI                       	0x00000001c349610c static App.main() + 128 (App.swift:114)
17  XXX                   	0x0000000104ba6e18 static XXX.$main() + 28 (XXX.swift:13)
18  XXX                   	0x0000000104ba6e18 main + 40 (XXX.swift:0)
19  dyld                          	0x0000000199c5bf28 start + 2236 (dyldMain.cpp:1165)

Thread 1:
0   libsystem_kernel.dylib        	0x0000000199f73f14 mach_msg2_trap + 8
1   libsystem_kernel.dylib        	0x0000000199f86240 mach_msg2_internal + 80 (mach_msg.c:201)
2   libsystem_kernel.dylib        	0x0000000199f7cb78 mach_msg_overwrite + 604 (mach_msg.c:0)
3   libsystem_kernel.dylib        	0x0000000199f74290 mach_msg + 24 (mach_msg.c:323)
4   CoreFoundation                	0x000000019a092888 __CFRunLoopServiceMachPort + 160 (CFRunLoop.c:2622)
5   CoreFoundation                	0x000000019a091168 __CFRunLoopRun + 1208 (CFRunLoop.c:3005)
6   CoreFoundation                	0x000000019a09055c CFRunLoopRunSpecific + 612 (CFRunLoop.c:3418)
7   AppKit                        	0x000000019d3da508 _NSEventThread + 172 (NSEvent.m:5060)
8   libsystem_pthread.dylib       	0x0000000199fb3fa8 _pthread_start + 148 (pthread.c:893)
9   libsystem_pthread.dylib       	0x0000000199faeda0 thread_start + 8

Thread 2 Crashed:
0   ???                           	0x00000000b71b8091 0x0 + 3072032913
1   libswift_Concurrency.dylib    	0x00000002276b9828 (anonymous namespace)::ProcessOutOfLineJob::process(swift::Job*) + 884 (Actor.cpp:1323)
2   libswift_Concurrency.dylib    	0x00000002276b7eb8 swift::runJobInEstablishedExecutorContext(swift::Job*) + 556 (Actor.cpp:229)
3   libswift_Concurrency.dylib    	0x00000002276b8cd0 swift_job_runImpl(swift::Job*, swift::ExecutorRef) + 72 (Actor.cpp:1563)
4   libdispatch.dylib             	0x0000000199e15e98 _dispatch_root_queue_drain + 396 (queue.c:7051)
5   libdispatch.dylib             	0x0000000199e166c0 _dispatch_worker_thread2 + 164 (queue.c:7119)
6   libsystem_pthread.dylib       	0x0000000199fb0038 _pthread_wqthread + 228 (pthread.c:2631)
7   libsystem_pthread.dylib       	0x0000000199faed94 start_wqthread + 8

Thread 3:
0   libsystem_pthread.dylib       	0x0000000199faed8c start_wqthread + 0

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

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

Thread 6:
0   libsystem_kernel.dylib        	0x0000000199f7eff0 __select + 8
1   CoreFoundation                	0x000000019a0bc1c8 __CFSocketManager + 636 (CFSocket.c:1340)
2   libsystem_pthread.dylib       	0x0000000199fb3fa8 _pthread_start + 148 (pthread.c:893)
3   libsystem_pthread.dylib       	0x0000000199faeda0 thread_start + 8


Thread 2 crashed with ARM Thread State (64-bit):
    x0: 0x0000000112852740   x1: 0x00006000004ed460   x2: 0xd00000000000001c   x3: 0x80000001053268c0
    x4: 0x00000001053fecb8   x5: 0x0000000105458238   x6: 0x00000000b71b8091   x7: 0x0000000000000000
    x8: 0x0000000280000030   x9: 0xffffffffb24403bd  x10: 0x0000000280000020  x11: 0x0000000000000018
   x12: 0x00000001103b5650  x13: 0x0000000000000000  x14: 0x00000000000005d8  x15: 0x00000000ffff7dff
   x16: 0xfffffffffffffff1  x17: 0x00000001f9c75598  x18: 0x0000000000000000  x19: 0x000000013274ae70
   x20: 0xd00000000000001c  x21: 0x000000013280b048  x22: 0x0000000280000030  x23: 0x0000000000000000
   x24: 0x00000000000000a0  x25: 0x00000002357f1748  x26: 0x00000002357f1758  x27: 0x000000013274ae70
   x28: 0x000000013274ae71   fp: 0x000000016b2e6d70   lr: 0x00000002276b7e00
    sp: 0x000000016b2e6d20   pc: 0x00000000b71b8091 cpsr: 0x20001000
   esr: 0x8a000000 (PC alignment)


Binary Images:
       0x104ba0000 -        0x1053effff XXX (arm64)  <4B6BF909-7AF8-3AA7-B18B-A44A80FC2D03> /Applications/XXX.app/Contents/MacOS/XXX
       0x10f940000 -        0x10f94bfff libobjc-trampolines.dylib (arm64e)  <570C31F7-94C6-3B86-AE44-1694DB0A4BCD> /usr/lib/libobjc-trampolines.dylib
       0x199c56000 -        0x199ce4557 dyld (arm64e)  <AED7DD2C-0325-3172-83E7-3BE31F6D4069> /usr/lib/dyld
       0x199e00000 -        0x199e47fff libdispatch.dylib (arm64e)  <78FF427C-107B-33C3-A3C2-577AA588DFF1> /usr/lib/system/libdispatch.dylib
       0x199f73000 -        0x199facfe7 libsystem_kernel.dylib (arm64e)  <222F8841-2BFD-3804-AA0C-F6D80A73FBDF> /usr/lib/system/libsystem_kernel.dylib
       0x199fad000 -        0x199fb9fff libsystem_pthread.dylib (arm64e)  <7AF7B500-9A6E-3121-A66A-397C209B5C83> /usr/lib/system/libsystem_pthread.dylib
       0x19a013000 -        0x19a4ecfff CoreFoundation (arm64e)  <433F10EB-0585-3EDE-9276-05224D8DA19E> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
       0x19d277000 -        0x19e185fff AppKit (arm64e)  <5D521D06-B060-367F-978C-13303EA0DC9C> /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
       0x1a3996000 -        0x1a3cc9fff HIToolbox (arm64e)  <112F06BD-C55A-3939-960E-C5C67BA98E55> /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox
       0x1c2a19000 -        0x1c42b0fff SwiftUI (arm64e)  <078163FA-F3C9-35F9-8FAF-ABB888D9BDBD> /System/Library/Frameworks/SwiftUI.framework/Versions/A/SwiftUI
       0x227677000 -        0x2276d1ffb libswift_Concurrency.dylib (arm64e)  <D3362AF1-B5DD-3922-831B-A5BA6D4ABA6F> /usr/lib/swift/libswift_Concurrency.dylib


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: 2
    thread_create: 0
    thread_set_state: 26

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

                                VIRTUAL   REGION 
REGION TYPE                        SIZE    COUNT (non-coalesced) 
===========                     =======  ======= 
Accelerate framework               128K        1 
Activity Tracing                   256K        1 
CG backing stores                 3520K        4 
CG image                            64K        2 
ColorSync                          576K       26 
CoreAnimation                     14.3M       57 
CoreGraphics                        32K        2 
CoreUI image data                  736K        5 
Foundation                          16K        1 
Image IO                          1056K        2 
Kernel Alloc Once                   32K        1 
MALLOC                           436.3M       58 
MALLOC guard page                  192K       10 
MALLOC_LARGE (reserved)            3.1G        1         reserved VM address space (unallocated)
MALLOC_MEDIUM (reserved)           1.1G        9         reserved VM address space (unallocated)
MALLOC_NANO (reserved)           384.0M        1         reserved VM address space (unallocated)
STACK GUARD                       56.1M        7 
Stack                             11.2M        7 
VM_ALLOCATE                       1200K       12 
__AUTH                            1311K      279 
__AUTH_CONST                      21.9M      485 
__CTF                               824        1 
__DATA                            9801K      471 
__DATA_CONST                      21.8M      488 
__DATA_DIRTY                      1389K      163 
__FONT_DATA                        2352        1 
__LINKEDIT                       803.1M        3 
__OBJC_RO                         66.3M        1 
__OBJC_RW                         2010K        1 
__TEXT                           481.4M      508 
dyld private memory                272K        2 
mapped file                      191.2M       34 
shared memory                      912K       16 
===========                     =======  ======= 
TOTAL                              6.6G     2660 
TOTAL, minus reserved VM space     2.1G     2660 


EOF

BTW, macOS 13.4 (22F5027f) is Beta..
Someone here might recommend a way to get to the corresponding github commit hash.