EXC_BAD_ACCESS KERN_INVALID_ADDRESS iOS crash - ios

I am getting below crash logs across all iOS versions. However, I am not able to figure out the exact cause of this. Is it something to do with accessing a de-allocated object? If yes, is there a way to replicate the scenario since I am not able to.
Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x180771b90 objc_msgSend + 16
1 CoreGraphics 0x182574568 CGColorRetain + 28
2 CoreGraphics 0x182609088 CGGStateSetStrokeColor + 64
3 UIKit 0x186893698 -[UIKBHandwritingStrokeView drawRect:] + 692
4 UIKit 0x1862e2678 -[UIView(CALayerDelegate) drawLayer:inContext:] + 368
5 QuartzCore 0x183c16228 -[CALayer drawInContext:] + 260
6 QuartzCore 0x183c008ac CABackingStoreUpdate_ + 2432
7 QuartzCore 0x183d18360 ___ZN2CA5Layer8display_Ev_block_invoke + 52
8 QuartzCore 0x183bffa88 CA::Layer::display_() + 1368
9 QuartzCore 0x183be17a8 CA::Layer::display_if_needed(CA::Transaction*) + 228
10 QuartzCore 0x183be1494 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 44
11 QuartzCore 0x183be0ab8 CA::Context::commit_transaction(CA::Transaction*) + 252
12 QuartzCore 0x183be0818 CA::Transaction::commit() + 500
13 UIKit 0x186256ff4 _UIApplicationHandleEventQueue + 4980
14 CoreFoundation 0x1810b109c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
15 CoreFoundation 0x1810b0b30 __CFRunLoopDoSources0 + 540
16 CoreFoundation 0x1810ae830 __CFRunLoopRun + 724
17 CoreFoundation 0x180fd8c50 CFRunLoopRunSpecific + 384
18 GraphicsServices 0x1828c0088 GSEventRunModal + 180
19 UIKit 0x1862c2088 UIApplicationMain + 204
20 Smartphone 0x1000e0b78 main (main.m:13)
21 libdispatch.dylib 0x180b768b8 (Missing)
Also I am not able to figure out where exactly the crash is happening. Since I am getting these as part of release build.

Related

What's the reason of App crashing with Crashed: com.apple.main-thread on firstIndex(where:)

I am getting a crash report in Crashlytics as below.
I tried a lot of ways generating this crash, but I am not able to generate this crash
Crashed: com.apple.main-thread
0 MyApp 0x1010d4b1c specialized Collection.firstIndex(where:) + 2433 (MyViewController.swift:2433)
1 MyApp 0x101094ee4 MyViewController.collectionView(_:cellForItemAt:) + 4307881700 (<compiler-generated>:4307881700)
2 MyApp 0x1010c2df4 #objc MyViewController.collectionView(_:cellForItemAt:) + 4308069876
3 UIKitCore 0x1aba8ae74 -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:isFocused:notify:] + 424
4 UIKitCore 0x1aba8f6f0 -[UICollectionView _updateVisibleCellsNow:] + 4352
5 UIKitCore 0x1aba93fbc -[UICollectionView layoutSubviews] + 320
6 UIKitCore 0x1ac6bc17c -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2140
7 QuartzCore 0x1aec242c0 -[CALayer layoutSublayers] + 284
8 QuartzCore 0x1aec2a43c CA::Layer::layout_if_needed(CA::Transaction*) + 480
9 QuartzCore 0x1aec35140 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 136
10 QuartzCore 0x1aeb7d884 CA::Context::commit_transaction(CA::Transaction*, double) + 304
11 QuartzCore 0x1aeba7574 CA::Transaction::commit() + 676
12 QuartzCore 0x1aeba7f68 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 92
13 CoreFoundation 0x1a811de68 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
14 CoreFoundation 0x1a8118d54 __CFRunLoopDoObservers + 416
15 CoreFoundation 0x1a8119320 __CFRunLoopRun + 1308
16 CoreFoundation 0x1a8118adc CFRunLoopRunSpecific + 464
17 GraphicsServices 0x1b20b9328 GSEventRunModal + 104
18 UIKitCore 0x1ac22663c UIApplicationMain + 1936
19 MyApp 0x100d80fa8 main + 30 (MyDatabase.swift:30)
20 libdyld.dylib 0x1a7fa2360 start + 4
Below is the line where the report says on which the crash has been generated.
if let index = cell.array.firstIndex(where: {$0.name == self.name}){
//code here
}
I looked for a lot of solutions out there but couldn't find any right solution for myself.
Thanks!

FMDatabaseQueue crash

I'm using FMDB in my app. I'm seeing this random crash happening during the app launch.
-(void) addActivities{
[[[DB sharedManager]getSecureQueue] inTransaction:^(FMDatabase * _Nonnull db, BOOL * _Nonnull rollback) {
//process data
}];
}
getSecureQueue returns a FMDatabaseQueue:
_secureQueue= [FMDatabaseQueue databaseQueueWithPath:dbPath];
I checked that _SecureQueue is not nil.
The crash log:
Crashed: fmdb.<FMDatabaseQueue: 0x170242610>
0 libdispatch.dylib 0x18ad83634 _dispatch_barrier_sync_f_slow + 560
1 FMDB 0x101040bd8 -[FMDatabaseQueue beginTransaction:withBlock:] (FMDatabaseQueue.m:228)
2 FMDB 0x101040bd8 -[FMDatabaseQueue beginTransaction:withBlock:] (FMDatabaseQueue.m:228)
3 iPhoneHandheldACT 0x1001e4870 -[HHCTabBarController addActivities] (HHCTabBarController.m:145)
4 iPhoneHandheldACT 0x1001e553c __49-[HHCTabBarController migrateIntoRealm]_block_invoke (HHCTabBarController.m:226)
5 FMDB 0x101040ac4 __30-[FMDatabaseQueue inDatabase:]_block_invoke (FMDatabaseQueue.m:188)
6 libdispatch.dylib 0x18ad729a0 _dispatch_client_callout + 16
7 libdispatch.dylib 0x18ad7fee0 _dispatch_barrier_sync_f_invoke + 84
8 FMDB 0x101040a34 -[FMDatabaseQueue inDatabase:] (FMDatabaseQueue.m:202)
9 iPhoneHandheldACT 0x1001e4ce8 -[HHCTabBarController migrateIntoRealm] (HHCTabBarController.m:181)
10 iPhoneHandheldACT 0x1001e4270 -[HHCTabBarController viewDidLoad] (HHCTabBarController.m:77)
11 UIKit 0x191fecb04 -[UIViewController loadViewIfRequired] + 1036
12 UIKit 0x192004590 -[UIViewController __viewWillAppear:] + 132
13 UIKit 0x192188e18 -[UINavigationController _startCustomTransition:] + 1144
14 UIKit 0x1920a37bc -[UINavigationController _startDeferredTransitionIfNeeded:] + 676
15 UIKit 0x1920a3424 -[UINavigationController __viewWillLayoutSubviews] + 64
16 UIKit 0x1920a3388 -[UILayoutContainerView layoutSubviews] + 188
17 UIKit 0x191fe9cc0 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1200
18 QuartzCore 0x18f1da274 -[CALayer layoutSublayers] + 148
19 QuartzCore 0x18f1cede8 CA::Layer::layout_if_needed(CA::Transaction*) + 292
20 QuartzCore 0x18f1ceca8 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
21 QuartzCore 0x18f14a34c CA::Context::commit_transaction(CA::Transaction*) + 252
22 QuartzCore 0x18f1713ac CA::Transaction::commit() + 504
23 QuartzCore 0x18f171e78 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 120
24 CoreFoundation 0x18be689a8 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
25 CoreFoundation 0x18be66630 __CFRunLoopDoObservers + 372
26 CoreFoundation 0x18bd96dc4 CFRunLoopRunSpecific + 456
27 UIFoundation 0x191f95134 -[NSHTMLReader _loadUsingWebKit] + 1764
28 Foundation 0x18c9af50c __NSThreadPerformPerform + 340
29 CoreFoundation 0x18be6942c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
30 CoreFoundation 0x18be68d9c __CFRunLoopDoSources0 + 540
31 CoreFoundation 0x18be669a8 __CFRunLoopRun + 744
32 CoreFoundation 0x18bd96da4 CFRunLoopRunSpecific + 424
33 GraphicsServices 0x18d801074 GSEventRunModal + 100
34 UIKit 0x192051c9c UIApplicationMain + 208
35 iPhoneHandheldACT 0x1000a7bf4 main (main.m:16)
36 libdyld.dylib 0x18ada559c start + 4
On line 8, it looks like you're already inside an inDatabase call (i.e. you're already in FMDatabaseQueue when you try to enter the queue again). Don't try to enter serial queue when you're already inside that serial queue. At best, you'll deadlock. If you do that at the wrong time (e.g. during app startup), the watchdog process will kill your app with exception code 0x8badf00d ("ate bad food"; lol; see Technical Note TN2151: Understanding and Analyzing Application Crash Reports).

iOS app odd crashes [UINavigationController _startCustomTransition:]

I have my app in alpha test, and using fabric to capture the crash logs. I had encountered a crash, and I have the below trace but have no idea what is going on. I tried to reproduce it with Xcode, but hardly can reproduce.
Could any one help on this? or share some ideas?
Thread : Crashed: com.apple.main-thread
0 libsystem_platform.dylib 0x0000000197c7d8d4 OSAtomicCompareAndSwap32Barrier + 12
1 libobjc.A.dylib 0x0000000197468120 realizeClass(objc_class*) + 100
2 libobjc.A.dylib 0x000000019746c930 lookUpImpOrForward + 224
3 libobjc.A.dylib 0x0000000197477db8 _objc_msgSend_uncached_impcache + 56
4 UIKit 0x000000018b66bef4 -[UINavigationController _startCustomTransition:] + 972
5 UIKit 0x000000018b57d630 -[UINavigationController _startDeferredTransitionIfNeeded:] + 468
6 UIKit 0x000000018b57d3fc -[UINavigationController __viewWillLayoutSubviews] + 56
7 UIKit 0x000000018b57d37c -[UILayoutContainerView layoutSubviews] + 200
8 UIKit 0x000000018b4c5d2c -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 572
9 QuartzCore 0x000000018ae1d994 -[CALayer layoutSublayers] + 168
10 QuartzCore 0x000000018ae18564 CA::Layer::layout_if_needed(CA::Transaction*) + 320
11 QuartzCore 0x000000018ae18408 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
12 QuartzCore 0x000000018ae17c08 CA::Context::commit_transaction(CA::Transaction*) + 276
13 QuartzCore 0x000000018ae1798c CA::Transaction::commit() + 436
14 UIKit 0x000000018b4c7c48 _UIApplicationHandleEventQueue + 1700
15 CoreFoundation 0x0000000186cd29ec __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
16 CoreFoundation 0x0000000186cd1c90 __CFRunLoopDoSources0 + 264
17 CoreFoundation 0x0000000186ccfd40 __CFRunLoopRun + 712
18 CoreFoundation 0x0000000186bfd0a4 CFRunLoopRunSpecific + 396
19 GraphicsServices 0x000000018fd975a4 GSEventRunModal + 168
20 UIKit 0x000000018b52eaa4 UIApplicationMain + 1488
21 MCompass 0x00000001001631c8 main (main.m:16)
22 libdyld.dylib 0x0000000197ad2a08 start + 4
It is hard to tell without seeing some more details, but maybe this can help: http://aplus.rs/2013/beware-a-crashing-bug-lurks-with-uinavigationcontroller-transitions/

App crash in main method

I have been getting a rare crash in my app. I am able to track it via hockey app tool integrated with the app. But, unfortunately i am not able to find out any clue about it so as to resolve it.
The crash is happening in the main method of my application in thread 0. I would like to post the stack trace for better analysis. Here it is.
Thread 0 Crashed:
0 libobjc.A.dylib 0x34ed7f46 _objc_msgSend + 6
1 UIKit 0x2ac884cf -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 472
2 UIKit 0x2ac88593 -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 52
3 UIKit 0x2ac7dd21 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2266
4 UIKit 0x2aa962df -[UITableView layoutSubviews] + 184
5 UIKit 0x2a9c0677 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 512
6 QuartzCore 0x2a3e8ccd -[CALayer layoutSublayers] + 134
7 QuartzCore 0x2a3e46b5 CA::Layer::layout_if_needed(CA::Transaction*) + 358
8 QuartzCore 0x2a3e453d CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 14
9 QuartzCore 0x2a3e3f21 CA::Context::commit_transaction(CA::Transaction*) + 222
10 QuartzCore 0x2a3e3d25 CA::Transaction::commit() + 322
11 UIKit 0x2ac0bc43 _UIWindowUpdateVisibleContextOrder + 208
12 UIKit 0x2ac0bad5 +[UIWindow _prepareWindowsPassingTestForAppResume:] + 14
13 UIKit 0x2ac2c8f3 -[UIApplication _updateSnapshotAndStateRestorationArchiveForBackgroundEvent:saveState:exitIfCouldNotRestoreState:] + 200
14 UIKit 0x2ac2bda3 __80-[UIApplication _handleNonLaunchSpecificActions:forScene:withTransitionContext:]_block_invoke_2 + 112
15 libdispatch.dylib 0x3542b8cb _dispatch_call_block_and_release + 8
16 libdispatch.dylib 0x3542b8b7 _dispatch_client_callout + 20
17 libdispatch.dylib 0x3542f0bf __dispatch_main_queue_callback_4CF + 723
18 CoreFoundation 0x274eabe9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 6
19 CoreFoundation 0x274e92e9 __CFRunLoopRun + 1510
20 CoreFoundation 0x27437621 _CFRunLoopRunSpecific + 477
21 CoreFoundation 0x27437433 _CFRunLoopRunInMode + 107
22 GraphicsServices 0x2e7bd0a9 _GSEventRunModal + 137
23 UIKit 0x2aa22359 _UIApplicationMain + 1441
The crash being in the main thread, i don't get any clue of where and how to start tracing this crash.
Any help would be highly appreciated.

UIkit crashes also not able to reproduce

Thread 0: Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x3a6285b0 objc_msgSend + 15
1 UIKit 0x348285f5 -[UINavigationController _startTransition:fromViewController:toViewController:] + 92
2 UIKit 0x348284c1 -[UINavigationController _startDeferredTransitionIfNeeded:] + 324
3 UIKit 0x347f94e9 -[UILayoutContainerView layoutSubviews] + 180
4 UIKit 0x347b8803 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 258
5 QuartzCore 0x34562d8b -[CALayer layoutSublayers] + 214
6 QuartzCore 0x34562929 CA::Layer::layout_if_needed(CA::Transaction*) + 460
7 QuartzCore 0x3456385d CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 16
8 QuartzCore 0x34563243 CA::Context::commit_transaction(CA::Transaction*) + 238
9 QuartzCore 0x34563051 CA::Transaction::commit() + 316
10 UIKit 0x34988369 -[UIApplication _sendOrderedOutContextsAndInvalidate:] + 112
11 UIKit 0x3483863f orderOutContextObserverCallout + 34
12 CoreFoundation 0x329826cd __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 20
13 CoreFoundation 0x329809c1 __CFRunLoopDoObservers + 276
14 CoreFoundation 0x32980c91 __CFRunLoopRun + 608
15 CoreFoundation 0x328f3ebd CFRunLoopRunSpecific + 356
16 CoreFoundation 0x328f3d49 CFRunLoopRunInMode + 104
17 GraphicsServices 0x364a62eb GSEventRunModal + 74
18 UIKit 0x34809301 UIApplicationMain + 1120
19 test 0x000f610f main (main.m:16)
I get this error in my crashlytics but not able to reproduce this error. Can any one help me to solve this how can i get rid of this crash.

Resources