we have a serious crashing bug we can absolutely not get a hold of. The problem is that it happens to happen asynchronously in the background, obviously when the dispatch system cleans up a worker thread. Here are two example stack traces:
Thread 7 Crashed:
0 libobjc.A.dylib 0x3b23b5b0 objc_msgSend + 15
1 Foundation 0x33c03581 -[NSNotificationCenter postNotificationName:object:userInfo:] + 49
2 Foundation 0x33cb3367 __NSFinalizeThreadData + 255
3 CoreFoundation 0x3336cf81 __CFTSDFinalize + 65
4 libsystem_c.dylib 0x3b68a12b _pthread_tsd_cleanup + 174
5 libsystem_c.dylib 0x3b689e03 _pthread_exit + 119
6 libsystem_c.dylib 0x3b68cd02 _pthread_workq_return + 26
7 libsystem_c.dylib 0x3b68ca16 _pthread_wqthread + 366
And:
Thread 8 Crashed:
0 Foundation 0x31bfd2e2 __NSFinalizeThreadData + 122
1 CoreFoundation 0x312b6f81 __CFTSDFinalize + 65
2 libsystem_c.dylib 0x395d412b _pthread_tsd_cleanup + 174
3 libsystem_c.dylib 0x395d3e03 _pthread_exit + 119
4 libsystem_c.dylib 0x395d6d02 _pthread_workq_return + 26
5 libsystem_c.dylib 0x395d6a16 _pthread_wqthread + 366
All these crash reports seem to have the same reason:
Exception Type: SIGSEGV
Exception Codes: SEGV_ACCERR at 0x9209ea83
I got as far as this: It seems there is an NSThreadWillExitNotification
being posted. Crash logs occur more often without the NSNotificationCenter
frame (second example). Regular invocations just pass @"NSThreadWillExitNotification"
, the NSThread
object, nil
userInfo.
All problems I can think of right now is the NSThread object being overreleased somehow. I just checked and all uses we make of NSThread are simple equivalence checks with the main thread. Like so:
if (NSThread.currentThread == NSThread.mainThread) ...
Any insights? Just another weird ARC issue?
Thank you all,
Max