My watch app uses background refresh tasks heavily, and work during task is asynchronous. Sometimes (once in 15-20 background task executions) it gets terminated by OS with 0xc51bad03 reason. Release notes of watchOS3.1 say:
Background Refresh Violations of system resources will result in a crash report for your application. The exception code provides context about the nature of the violation:
- 0xc51bad01 The app used too much CPU time.
- 0xc51bad02 The app took too much wall time.
- 0xc51bad03 The app may not have had sufficient runtime to complete the task.
What does this "may not have had sufficient runtime" mean? What can be possible reason? This kill code have not been explained during WWDC sessions. Looks like this crash does not depend on exact place in my code that is executed at the moment.
Crash report except does not make reason clearer:
Exception Type: EXC_CRASH (SIGKILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: Namespace SPRINGBOARD, Code 0xc51bad03
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x264216d0 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x2642149c mach_msg + 40
2 CoreFoundation 0x267aed88 __CFRunLoopServiceMachPort + 154
3 CoreFoundation 0x267ad04c __CFRunLoopRun + 1068
4 CoreFoundation 0x26701f74 CFRunLoopRunSpecific + 354
5 Foundation 0x2704307c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 246
6 Foundation 0x2708ff5a -[NSRunLoop(NSRunLoop) run] + 80
7 libxpc.dylib 0x265330de _xpc_objc_main + 600
8 libxpc.dylib 0x265346fe xpc_main + 166
9 Foundation 0x27217fea service_connection_handler + 0
10 PlugInKit 0x303eb1be -[PKService run] + 774
11 WatchKit 0x342efe00 main + 134
12 libdyld.dylib 0x26344566 start + 2