iosobjective-cxcodensoperationqueue

Objc memory and threading crash caused by xcode 12.4 upgrade


For the last few weeks I have been trying to solve a crash which manifested itself seemingly at random. I believe it coincides with a build being created with xcode 12.4 from 12.3. My sync operation started crashing with an EXC_BAD_ACCESS crash in memory.

I'm using an NSOperationQueue. I've tried using zombie objects but because the error is in a block I cannot see them.

My threads look like this:

App thread state while crashing

And the queue view says developerSubmittedBlockToNSManagedObjectContextPerform.

Does anyone have advice for what could be causing the issue? Or alternative ways to track it down? Thanks


Solution

  • For anyone who might have a similar problem, we eventually tracked the issue down to a core data problem with our database links.

    There were some missing inverse reletionships between our database entities. The leading theory is that because the relationships dont exist the system will deallocate the context. This will then throw the unhelpful threading issue.

    These relationships have been in this state for years and we think that in a recent excode update, the memory managment system may have been updated which exposed the issue.