Crash from: ContextKitExtraction +[CKContextContentProviderUIScene _bestVisibleStringForView:usingExecutor:] + 948 (CKContextContentProviderUIScene.m:533)

Any ideas on how to root cause this? Started since iOS 15.x, affecting only small percentage of users. Apple crash report attached. Thanks!

Replies

This is one of those So you crashed in objc_msgSend moments [1] (-:

Consider this:

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000

You’ve crashed dereferencing nil.

And this:

Thread 0 name:
Thread 0 Crashed:
0   libobjc.A.dylib      … lookUpImpOrForward + 52 (objc-runtime-new.h:2061)
1   libobjc.A.dylib      … _objc_msgSend_uncached + 64
2   ContextKitExtraction … +[CKContextContentProviderUIScene _bestVisibleStringForView:usingExecutor:] + 948 (CKContextContentProviderUIScene.m:533)
3   ContextKitExtraction … +[CKContextContentProviderUIScene _donateContentsOfWindow:usingExecutor:withOptions:] + 320 (CKContextContentProviderUIScene.m:310)
4   ContextKitExtraction … __78+[CKContextContentProviderUIScene extractFromScene:usingExecutor:withOptions:]_block_invoke + 56 (CKContextContentProviderUIScene.m:178)
5   ContextKitExtraction … __64-[CKContextExecutor addWorkItemToQueue:withWorkItem:andContext:]_block_invoke + 72 (CKContextExecutor.m:129)
6   libdispatch.dylib    … _dispatch_call_block_and_release + 24 (init.c:1518)

ContextKitExtraction is an internal Apple framework. It’s scheduled a block on the main queue, which is being called by Dispatch (frame 6). It’s working away (frames 5 through 2) and eventually calls objc_msgSend on an object, at which point the Objective-C runtime dereferenced nil.

It’s hard to say anything more definitive based on just a crash report. The most likely cause of problems like this is memory corruption. This could be your fault, but it might also be a bug in the OS iself.

I recommend that you run your app with the standard memory debugging tools to see if you can make the problem more reproducible. If so, that’ll give you more options for your investigation.

Share and Enjoy

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

[1] See this blog post:

http://www.sealiesoftware.com/blog/archive/2008/09/22/objc_explain_So_you_crashed_in_objc_msgSend.html

This is unlikely to help you in this specific case, but it’s a classic in the genre.

Thanks! Looks like in our case the root cause of getting into this situation is that on one ViewController @IBAction func buttonTapped is called twice (sometimes within 30ms). The code inside buttonTapped eventually supposed to open another view, so very likely something got dereferenced in one of the calls. The stack trace was reproduced by calling buttonTapped twice from code. I hope this helps someone one day :)