iOS: Understanding SIGABRT crash from Crashlytics - ios

So I am receiving Crashlytics crash report for my iOS App. For some of the users the app has been crashing giving SIGABRT in the crash log.
I have been trying to find the cause of this error for countless hours but due to rarity of the error (around 1-2% users) I have been unable to reproduce the error and, due to limited amount of information from Crashlytics, I have been unable to find the root cause of this error.
The deployment target is iOS 7 for the app and devices of all sizes with iOS 10+ are experiencing the crash (I am not sure if iOS 9, 8 or 7 are also experiencing the error — Crashlytics is only showing crashes on iOS 10+)
Here is the stack trace:
CRASH_INFO_ENTRY_1
*** error for object 0x17127f4c0: Invalid pointer dequeued from free list
CRASH_INFO_ENTRY_0
abort() called
Crashed: com.apple.main-thread
SIGABRT ABORT 0x000000018e2ea014
#0. Crashed: com.apple.main-thread
0 libsystem_kernel.dylib 0x18f6ca014 __pthread_kill + 8
1 libsystem_pthread.dylib 0x18f791460 pthread_kill + 112
2 libsystem_c.dylib 0x18f63e3f4 abort + 140
3 libsystem_malloc.dylib 0x18f70ea38
_nano_vet_and_size_of_live + 330
4 libsystem_malloc.dylib 0x18f710bf0
_nano_malloc_check_clear + 392
5 libsystem_malloc.dylib 0x18f70fbb4 nano_calloc + 80
6 libsystem_malloc.dylib 0x18f701180 malloc_zone_calloc + 152
7 libsystem_malloc.dylib 0x18f7010c4 calloc + 40
8 libobjc.A.dylib 0x18f131cfc cache_t::reallocate(unsigned int, unsigned int) + 52
9 libobjc.A.dylib 0x18f1321fc cache_fill + 216
10 libobjc.A.dylib 0x18f13cd00 lookUpImpOrForward + 412
11 libobjc.A.dylib 0x18f147258 _objc_msgSend_uncached + 56
12 UIKit 0x1967274e8 -[UITableView _endCellAnimationsWithContext:] + 13964
13 Champion 0x100097bf4 -[MatchdayComposeController controllerDidChangeContent:] (MatchdayComposeController.m:427)
14 CoreData 0x192abfe28 __82-[NSFetchedResultsController(PrivateMethods) _core_managedObjectContextDidChange:]_block_invoke + 4760
15 CoreData 0x192abeb80 -[NSFetchedResultsController(PrivateMethods) _core_managedObjectContextDidChange:] + 124
16 CoreFoundation 0x19069622c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 20
17 CoreFoundation 0x190695930 _CFXRegistrationPost + 400
18 CoreFoundation 0x1906956ac ___CFXNotificationPost_block_invoke + 60
19 CoreFoundation 0x190704b9c -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1504
20 CoreFoundation 0x1905d7bf4 _CFXNotificationPost + 376
21 Foundation 0x1910de6bc -[NSNotificationCenter postNotificationName:object:userInfo:] + 68
22 CoreData 0x1929eed1c -[NSManagedObjectContext(_NSInternalNotificationHandling) _postObjectsDidChangeNotificationWithUserInfo:] + 724
23 CoreData 0x192a75170 -[NSManagedObjectContext(_NSInternalChangeProcessing) _createAndPostChangeNotification:deletions:updates:refreshes:deferrals:wasMerge:] + 1336
24 CoreData 0x1929ed338 -[NSManagedObjectContext(_NSInternalChangeProcessing) _processRecentChanges:] + 2116
25 CoreData 0x1929ebe3c -[NSManagedObjectContext save:] + 416
26 Champion 0x10008e2ac -[AppDelegate saveContext] (AppDelegate.m:263)
27 Champion 0x10009d1d4 +[Globals saveManagedObjectContext] (Globals.m:157)
28 Champion 0x10006ee4c -[EntitySyncClient saveUpdates:] (EntitySyncClient.m:232)
29 Champion 0x1000690a0 -[MatchController datepickerDidChangeValue:] (MatchController.m:994)
30 UIKit 0x1965799a0 -[UIApplication sendAction:to:from:forEvent:] + 96
31 UIKit 0x196579920 -[UIControl sendAction:to:forEvent:] + 80
32 UIKit 0x196563dd0 -[UIControl _sendActionsForEvents:withEvent:] + 452
33 UIKit 0x196e62c44 -[_UIDatePickerView pickerView:didSelectRow:inComponent:] + 540
34 UIKit 0x1967b965c -[UIPickerView _sendSelectionChangedForComponent:notify:] + 116
35 UIKit 0x1967b9894 -[UIPickerView _sendSelectionChangedFromTable:notify:] + 344
36 UIKit 0x196ce6878 -[UIPickerTableView _scrollingFinished] + 188
37 UIKit 0x196ce6a50 -[UIPickerTableView scrollViewDidEndDecelerating:] + 28
38 UIKit 0x196857abc -[UIScrollView(UIScrollViewInternal) _scrollViewDidEndDeceleratingForDelegate] + 132
39 UIKit 0x1966ed2cc -[UIScrollView(UIScrollViewInternal) _stopScrollDecelerationNotify:] + 332
40 UIKit 0x1966ece08 -[UIScrollView _smoothScrollWithUpdateTime:] + 2356
41 QuartzCore 0x1938ff640 CA::Display::DisplayLinkItem::dispatch(unsigned long long) + 44
42 QuartzCore 0x1938ff4ec CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 444
43 IOKit 0x190968570 IODispatchCalloutFromCFMessage + 372
44 CoreFoundation 0x19069256c __CFMachPortPerform + 180
45 CoreFoundation 0x1906aa934 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 56
46 CoreFoundation 0x1906aa0e8 __CFRunLoopDoSource1 + 436
47 CoreFoundation 0x1906a7bcc __CFRunLoopRun + 1840
48 CoreFoundation 0x1905d6048 CFRunLoopRunSpecific + 444
49 GraphicsServices 0x192059198 GSEventRunModal + 180
50 UIKit 0x1965af818 -[UIApplication _run] + 684
51 UIKit 0x1965aa550 UIApplicationMain + 208
52 Champion 0x1000b082c main (main.m:14)
53 libdispatch.dylib 0x18f5b85b8 (Missing)
I would be extremely grateful for any kind of assistance. I would also be grateful if I can get any kind of pointers for reproducing Crashlytics errors.
Updating the Question with Code
In the controllerDidChangeContent: mainly the table view is ending updates.
- (void)controllerDidChangeContent:(NSFetchedResultsController *)controller {
[self.tableView endUpdates];
if(controller.fetchedObjects.count == 0){
self.showsNoMatchesHint = YES;
}
else{
self.showsNoMatchesHint = NO;
}
}

Given the last gasp of your program was in _endCellAnimationsWithContext, and these types of animations usually occur on completion of cell editing, I'd look into problems when that particular table is completing a cell edit operation. There's a picker view and a notification also going on in there, so that should narrow it down some. Good luck.

It looks like caused by this line of code
[self.tableView endUpdates];
I would suggest you to make sure the logic of -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView is correct. For example, it doesn't return 0 while the array is empty. Good luck.

Related

iOS Keyboard Extension crash before any of my code runs

I have been getting crash reports like this for a keyboard extension I have developed and am either confused about how to read the stack trace or why it is occurring or both and I was hoping someone could help me clear this up.
Below is the stack trace:
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0xd15db9df
Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x37949f66 objc_msgSend + 5
1 UIKit 0x2cd57f05 -[_UIViewControllerTransitionContext completeTransition:] + 52
2 UIKit 0x2d10ac1f __95-[_UIWindowAnimationController _performLayoutAnimationWithContext:windowGeometryUpdatingBlock:]_block_invoke88 + 26
3 UIKit 0x2cc7b8e1 -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 308
4 UIKit 0x2cc7b4f9 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 184
5 UIKit 0x2cc7b40f -[UIViewAnimationState animationDidStop:finished:] + 70
6 QuartzCore 0x2c660fe7 CA::Layer::run_animation_callbacks(void*) + 234
7 libdispatch.dylib 0x37ecdc6f _dispatch_client_callout + 22
8 libdispatch.dylib 0x37ed9553 _dispatch_main_queue_callback_4CF$VARIANT$mp + 1322
9 CoreFoundation 0x295ac889 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
10 CoreFoundation 0x295aafa9 __CFRunLoopRun + 1512
11 CoreFoundation 0x294f69a1 CFRunLoopRunSpecific + 476
12 CoreFoundation 0x294f67b3 CFRunLoopRunInMode + 106
13 GraphicsServices 0x30e911a9 GSEventRunModal + 136
14 UIKit 0x2cca7635 UIApplicationMain + 1440
15 libxpc.dylib 0x3806f9e3 _xpc_objc_main + 706
16 libxpc.dylib 0x38071009 xpc_main + 168
17 Foundation 0x2a3ec289 service_connection_handler + 162
18 PlugInKit 0x32c5ff75 -[PKService run] + 508
19 PlugInKit 0x32c5fc4b +[PKService main] + 58
20 PlugInKit 0x32c5ffa9 +[PKService _defaultRun:arguments:] + 20
21 libextension.dylib 0x371b60c5 NSExtensionMain + 48
22 libdyld.dylib 0x37f0baaf start + 2
In the left column where it lists the libraries (correct term?) I don't see any reference to my code. In other crash logs there is always some reference to a class in my app or something but I don't see that in this one. What does that mean? Is the crash occurring before my code executes and this is an Apple issue I can ignore?
It's an Apple Bug. The keyboard extension I work on has a nearly identical crash report. Fortunately, this only seems to happen on iOS 8, though I have seen a similar one that affects iOS 9.
I would file a bug report with Apple, and include a copy of the stack trace.

EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x000000008346beb8

I get the following crash log from Crashlytics for my app. My code do not call msgpack_zone_free or msgpack parse method at all and so I'm confused how that happened. I'm unable to reproduce this crash myself so I'm left to analyze the issue from the crash report itself. Any pointers to what I need to check will be very helpful.
This is not a case of low memory as I see free memory from Crashlytics.
Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x0000000192953bd0 objc_msgSend + 16
1 CoreFoundation 0x00000001820d5228 CFRelease + 524
2 CoreFoundation 0x00000001821e62ac -[__NSArrayM removeAllObjects] + 284
3 MyApp 0x00000001004a69e0 msgpack_zone_free
4 MyApp 0x00000001004a4afc msgpack_zone_free
5 CoreFoundation 0x000000018219cae4 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 20
6 CoreFoundation 0x00000001820db220 _CFXNotificationPost + 2060
7 Foundation 0x0000000182fdac60 -[NSNotificationCenter postNotificationName:object:userInfo:] + 72
8 UIKit 0x0000000186c32e98 -[UIApplication _handleApplicationDectivationWithScene:shouldForceExit:transitionContext:completion:] + 1132
9 UIKit 0x0000000186c3b370 __88-[UIApplication _handleApplicationLifecycleEventWithScene:transitionContext:completion:]_block_invoke + 92
10 UIKit 0x0000000186c3b2f8 -[UIApplication _handleApplicationLifecycleEventWithScene:transitionContext:completion:] + 380
11 UIKit 0x0000000186c2ec2c -[UIApplication scene:didUpdateWithDiff:transitionContext:completion:] + 512
12 FrontBoardServices 0x000000018a45d62c __31-[FBSSerialQueue performAsync:]_block_invoke + 28
13 CoreFoundation 0x00000001821aea28 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 20
14 CoreFoundation 0x00000001821adb30 __CFRunLoopDoBlocks + 312
15 CoreFoundation 0x00000001821ac154 __CFRunLoopRun + 1756
16 CoreFoundation 0x00000001820d90a4 CFRunLoopRunSpecific + 396
17 GraphicsServices 0x000000018b2735a4 GSEventRunModal + 168
18 UIKit 0x0000000186a0aaa4 UIApplicationMain + 1488
19 MyApp 0x00000001000cce40 main (main.m:16)
20 libdyld.dylib 0x0000000192faea08 start + 4
Thanks.

Random SIGSEGV NSFetchedResultsController crash

Receiving random crash reports related to NSFetchedResultsController updates to a UITableView, but I'm having a difficult time deciphering the crash log since it's all internal iOS methods.
This occurs at random times after data is fetched from a server in a background queue and the app populates new NSManagedObjects in the background into a Core Data Persistent Store.
Does anyone have an understanding of what may be going on here?
SIGSEGV
0 libobjc.A.dylib 0x3930b752 lookUpImpOrForward + 46
1 libobjc.A.dylib 0x39303feb _class_lookupMethodAndLoadCache3 + 35
2 libobjc.A.dylib 0x39303db9 _objc_msgSend_uncached + 25
3 UIKit 0x317b2bbf __66-[UISectionRowData refreshWithSection:tableView:tableViewRowData:]_block_invoke + 451
4 UIKit 0x31778179 -[UISectionRowData refreshWithSection:tableView:tableViewRowData:] + 3717
5 UIKit 0x3189c95b -[UITableViewRowData ensureAllSectionsAreValid] + 167
6 UIKit 0x31873f29 -[UITableView _endCellAnimationsWithContext:] + 217
7 CoreData 0x2ecae7dd -[NSFetchedResultsController(PrivateMethods) _managedObjectContextDidChange:] + 4013
8 CoreFoundation 0x2eef4121 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 13
9 CoreFoundation 0x2ee68317 _CFXNotificationPost + 1719
10 Foundation 0x2f84cdcd -[NSNotificationCenter postNotificationName:object:userInfo:] + 77
11 CoreData 0x2ecad813 -[NSManagedObjectContext(_NSInternalNotificationHandling) _postObjectsDidChangeNotificationWithUserInfo:] + 79
12 CoreData 0x2ecad7ab -[NSManagedObjectContext(_NSInternalChangeProcessing) _createAndPostChangeNotification:withDeletions:withUpdates:withRefreshes:] + 299
13 CoreData 0x2ecabe13 -[NSManagedObjectContext(_NSInternalChangeProcessing) _processRecentChanges:] + 2367
14 CoreData 0x2ed159e3 -[NSManagedObjectContext(_NestedContextSupport) _parentProcessSaveRequest:inContext:error:] + 1315
15 CoreData 0x2ed1632f __82-[NSManagedObjectContext(_NestedContextSupport) executeRequest:withContext:error:]_block_invoke + 563
16 libdispatch.dylib 0x397f31a7 _dispatch_barrier_sync_f_slow_invoke + 67
17 libdispatch.dylib 0x397ebd67 _dispatch_client_callout + 23
18 libdispatch.dylib 0x397f27c1 _dispatch_main_queue_callback_4CF$VARIANT$mp + 269
19 CoreFoundation 0x2eefc821 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
20 CoreFoundation 0x2eefb0f5 __CFRunLoopRun + 1301
21 CoreFoundation 0x2ee65ce7 CFRunLoopRunSpecific + 523
22 CoreFoundation 0x2ee65acb CFRunLoopRunInMode + 107
23 GraphicsServices 0x33b86283 GSEventRunModal + 139
24 UIKit 0x31707a41 UIApplicationMain + 1137
25 0x000ba53f main (main.m:16)

iOS Crash with name SIGSEGV, reason main

I'm using Crittercism (SDK 4.1.2) crash reporting service to catch reports on my iOS app. i've been getting this crash many times and i've no idea why it's happening.
Name: SIGSEGV - Reason: Main
Crashed Thread
0 libobjc.A.dylib 0x397c4b26 objc_msgSend + 6
1 UIKit 0x31965a2d -[UIScrollView(UIScrollViewInternal) _scrollViewAnimationEnded:finished:] + 177
2 UIKit 0x31a0e4b3 -[UIAnimator stopAnimation:] + 471
3 UIKit 0x31a0de9d -[UIAnimator(Static) _advanceAnimationsOfType:withTimestamp:] + 285
4 UIKit 0x31a0dd7d -[UIAnimator(Static) _LCDHeartbeatCallback:] + 53
5 QuartzCore 0x315419cf _ZN2CA7Display15DisplayLinkItem8dispatchEv + 99
6 QuartzCore 0x31541779 _ZN2CA7Display11DisplayLink14dispatch_itemsEyyy + 345
7 IOMobileFramebuffer 0x3411b76d IOMobileFramebufferVsyncNotifyFunc + 105
8 IOKit 0x2fdd9a75 IODispatchCalloutFromCFMessage + 249
9 CoreFoundation 0x2f0b7e21 __CFMachPortPerform + 137
10 CoreFoundation 0x2f0c29df __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 35
11 CoreFoundation 0x2f0c297b __CFRunLoopDoSource1 + 347
12 CoreFoundation 0x2f0c114f __CFRunLoopRun + 1399
13 CoreFoundation 0x2f02bc27 CFRunLoopRunSpecific + 523
14 CoreFoundation 0x2f02ba0b CFRunLoopRunInMode + 107
15 GraphicsServices 0x33cff283 GSEventRunModal + 139
16 UIKit 0x318cf049 UIApplicationMain + 1137
17 AppName 0x000b1fef main + 67
Not sure if this is the case for you, but I've had a similar crash caused by a button in an UIView trying to invoke a callback method on a already released object. The UI was displayed, and then the object was released.

iOS - Determining the cause of a crash (from a crash report) in _WebTryThreadLock

I have been trying to figure out what is causing one of the top crashes in my iOS application. It looks like there is some layout happening on a background thread which is causing it to crash. Is there any way to determine what I might be doing that is triggering this relayout? I assume from the stack that it is related to a UIWebView when my app is being brought back into the foreground.
Other stackoverflow threads on the topic seem to mention things like triggering a table reload on a background thread. As far as I can see all the webView delegate methods get called on the main thread. Is there some case where this is not true or are there some other methods which get called on a background thread and I'm just not aware?
Web Thread - Crashed.
0 WebCore _WebTryThreadLock(bool) + 297
1 WebCore _WebTryThreadLock(bool) + 288
2 WebCore WebThreadLock + 66
3 UIKit -[UIWebDocumentView(UIWebDocumentViewTextSelecting) selectionBaseWritingDirection] + 10
4 UIKit -[UITextField _currentTextAlignment] + 86
5 UIKit -[UITextField _showsClearButtonWhenNonEmpty:] + 58
6 UIKit -[UITextField _textRectForBounds:forEditing:] + 678
7 UIKit -[UITextField editingRectForBounds:] + 52
8 UIKit -[UITextField editRect] + 70
9 UIKit -[UITextField layoutSubviews] + 1320
10 UIKit -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 258
11 QuartzCore -[CALayer layoutSublayers] + 214
12 QuartzCore CA::Layer::layout_if_needed(CA::Transaction*) + 460
13 QuartzCore CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 16
14 QuartzCore CA::Context::commit_transaction(CA::Transaction*) + 238
15 QuartzCore CA::Transaction::commit() + 316
16 QuartzCore CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 60
17 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 20
18 CoreFoundation __CFRunLoopDoObservers + 276
19 CoreFoundation CFRunLoopRunSpecific + 394
20 CoreFoundation CFRunLoopRunInMode + 104
21 WebCore RunWebThread(void*) + 444
22 libsystem_c.dylib pthread_start + 308
Main - Thread
0 libsystem_kernel.dylib __psynch_mutexwait + 24
1 libsystem_c.dylib pthread_mutex_lock + 392
2 WebCore _WebTryThreadLock(bool) + 336
3 WebCore WebThreadLock + 66
4 WebKit -[WebDatabasePauser applicationWillEnterForeground] + 16
5 CoreFoundation _CFXNotificationPost + 1426
6 Foundation -[NSNotificationCenter postNotificationName:object:userInfo:] + 72
7 UIKit -[UIApplication _sendWillEnterForegroundCallbacks] + 154
8 UIKit -[UIApplication _handleApplicationResumeEvent:] + 1094
9 UIKit -[UIApplication handleEvent:withNewEvent:] + 1292
10 UIKit -[UIApplication sendEvent:] + 72
11 UIKit _UIApplicationHandleEvent + 6154
12 GraphicsServices _PurpleEventCallback + 590
13 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
14 CoreFoundation __CFRunLoopDoSources0 + 212
15 CoreFoundation __CFRunLoopRun + 646
16 CoreFoundation CFRunLoopRunSpecific + 356
17 CoreFoundation CFRunLoopRunInMode + 104
18 GraphicsServices GSEventRunModal + 74
19 UIKit UIApplicationMain + 1120
20 AppName main.m line 23
It seems you are updating UI on the background thread, in your code add this line wherever you are updating your UI and you are fetching data on the background thread:
dispatch_async(dispatch_get_main_queue(), ^{
// Update data here
});
As soon as you, rather code feels that data is there on device and it's time to update the UI corresponding to new data then try and bring back main thread in action.
Hope it helps.

Resources