macOS app crashes on first launch from TestFlight

2024_06_09_testflight_launch_crash_log.txt Running my macOS app the first time after installing via TestFlight crashes on launch. Every subsequent run works fine (including completely quitting the app and re-running it).

Also, building and running directly in XCode both in Debug and Release mode works fine.

I'm on a Mac M2 and the app excludes x86_64 arch.

Here is the trimmed crash log (sanitised full log is attached)


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:   CamHero-macOS-v2-Release [12876]

Application Specific Information:
abort() called


Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	       0x18c81d11c __pthread_kill + 8
1   libsystem_pthread.dylib       	       0x18c854cc0 pthread_kill + 288
2   libsystem_c.dylib             	       0x18c764a40 abort + 180
3   libglib-2.0.0.dylib           	       0x1061e5bd0 g_assertion_message + 464
4   libglib-2.0.0.dylib           	       0x1061e5c44 g_assertion_message_expr + 116
5   libgstlibav.dylib             	       0x10549ede0 gst_ffmpeg_cfg_init + 776
6   libgstlibav.dylib             	       0x10548a4f4 plugin_init + 140
7   libgstreamer-1.0.0.dylib      	       0x10646a458 gst_plugin_register_func + 636
8   libgstreamer-1.0.0.dylib      	       0x106469fe4 gst_plugin_register_static + 212
9   libgstlibav.dylib             	       0x10548a45c gst_plugin_libav_register + 92
10  CamHero-macOS-v2-Release      	       0x104a01624 gst_ios_init + 900 (gst_ios_init.m:1072)
11  CamHero-macOS-v2-Release      	       0x104a80590 specialized CamHeroMacOSApp.init() + 68 (CamHeroMacOSApp.swift:19)
12  CamHero-macOS-v2-Release      	       0x104a804a4 CamHeroMacOSApp.init() + 4 [inlined]
13  CamHero-macOS-v2-Release      	       0x104a804a4 protocol witness for App.init() in conformance CamHeroMacOSApp + 20 (<compiler-generated>:16)
14  SwiftUI                       	       0x1b7f134e0 0x1b7163000 + 14353632
15  CamHero-macOS-v2-Release      	       0x104a804d8 static CamHeroMacOSApp.$main() + 24 [inlined]
16  CamHero-macOS-v2-Release      	       0x104a804d8 main + 36
17  dyld                          	       0x18c4d90e0 start + 2360

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

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


Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x0000000000000000   x1: 0x0000000000000000   x2: 0x0000000000000000   x3: 0x0000000000000000
    x4: 0x0000600000755680   x5: 0x0000000000000020   x6: 0x0000600000755680   x7: 0xffffffff00008600
    x8: 0x8ddd1ea266cd729b   x9: 0x8ddd1ea3846d2c5b  x10: 0x0000000000001620  x11: 0x00000000dbe367fb
   x12: 0x00000000000007fb  x13: 0x00000000000007fd  x14: 0x00000000dc03683c  x15: 0x000000000000003c
   x16: 0x0000000000000148  x17: 0x00000001eb9f3da0  x18: 0x0000000000000000  x19: 0x0000000000000006
   x20: 0x00000001e2a05ec0  x21: 0x0000000000000103  x22: 0x00000001e2a05fa0  x23: 0x000000016b407508
   x24: 0x0000000000000000  x25: 0x00000001064f8450  x26: 0x000060000080d511  x27: 0x0000000000000000
   x28: 0x0000000000000000   fp: 0x000000016b407460   lr: 0x000000018c854cc0
    sp: 0x000000016b407440   pc: 0x000000018c81d11c cpsr: 0x40001000
   far: 0x0000000000000000  esr: 0x56000080  Address size fault

It seems that the initialisation of one of the gstreamer plug-ins doesn't go well. But, I wonder what might lead to that happening only the first time after launch?

Will appreciate any clues!

EDIT / UPDATE:

If i remove the app completely and install the same version again from TestFlight, app doesn't crash. So it seems the crashing is limited to the very first launch of a new /updated version.

Answered by DTS Engineer in 789902022

It’s hard to say what’s going on here. Frame 4 suggests that the assert includes a message, and I think the next step here is to work out what that message is.

If you run the app from Terminal, it’s likely that the message will be immediately visible. For info on how to do that, see the App Can’t Be Opened section of Resolving Trusted Execution Problems.

Share and Enjoy

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

It’s hard to say what’s going on here. Frame 4 suggests that the assert includes a message, and I think the next step here is to work out what that message is.

If you run the app from Terminal, it’s likely that the message will be immediately visible. For info on how to do that, see the App Can’t Be Opened section of Resolving Trusted Execution Problems.

Share and Enjoy

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

Thank you for pointing me in the direction of running the app from the terminal, as it helped resolve some other issues as well.

While it didn't still give me the error string, the dynamic library throwing the error was OSS, so that helped.

The root of my problem appears to be a plugin cache that one of the dependent frameworks builds the first time it runs, every other time was a cache hit so the problem occurred only on the first launch.

Glad to hear you're making progress!

macOS app crashes on first launch from TestFlight
 
 
Q