App crash - KERN_PROTECTION_FAILURE

Recently I got a crash with KERN_PROTECTION_FAILURE message while testing the TestFlight build.

Any idea why this is happening? When this happened I am using a TableView which is kind of a form submission with multiple cell types being reused

Start by symbolicating your crash log so you have all of the symbols.

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_PROTECTION_FAILURE at 0x000000016ef6bfe0
VM Region Info: 0x16ef6bfe0 is in 0x16ef68000-0x16ef6c000;  bytes after start: 16352  bytes before end: 31
      REGION TYPE                      START - END             [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      MALLOC_SMALL           0000000117800000-0000000118000000 [ 8192K] rw-/rwx SM=PRV  
      GAP OF 0x56f68000 BYTES
--->  STACK GUARD            000000016ef68000-000000016ef6c000 [   16K] ---/rwx SM=NUL  ... for thread 0
      Stack                  000000016ef6c000-000000016f068000 [ 1008K] rw-/rwx SM=PRV  thread 0

Notice the arrow pointing to the stack guard region. The stack guard is an empty region of memory between between the stack memory for different threads, so that when you overflow the stack, you crash quickly and safely, rather than running into memory for another thread's stack and corrupting that memory while still running.

Notice also the length of the main thread's backtrace — 511 frames, but that's only what was logged, there are more than that. Once you symbolicate the log, look for a pattern in the backtrace where you have your code and how it interacts with the system's code. You're essentially causing infinite recursion which is then blowing into the stack guard.

App crash - KERN_PROTECTION_FAILURE
 
 
Q