iOS 7 MapKit Crash: EXC_BAD_ACCESS in [VKRasterOverlayTileSource invalidateRect:level:] - ios

I have an unreproducible crash on iOS 7 only. I'm making heavy use of MKOverlayRenderer to draw shapes on the map. This crash does not happen on iOS 6.
Any ideas of what this might be related to will be useful.
Exception Type: EXC_BAD_ACCESS
Code: KERN_INVALID_ADDRESS at 0x291707628
Stack:
0 libobjc.A.dylib objc_msgSend + 5
1 VectorKit __50-[VKRasterOverlayTileSource invalidateRect:level:]_block_invoke_2 + 38
2 VectorKit -[VKTileKeyMap enumerateKeysAndObjectsUsingBlock:] + 58
3 VectorKit -[VKTilePool enumerateKeysAndObjectsUsingBlock:] + 76
4 VectorKit __50-[VKRasterOverlayTileSource invalidateRect:level:]_block_invoke + 178
5 ... libdispatch.dylib _dispatch_call_block_and_release + 10
6 libdispatch.dylib _dispatch_client_callout + 22
7 libdispatch.dylib _dispatch_main_queue_callback_4CF$VARIANT$mp + 268
8 CoreFoundation __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
9 CoreFoundation __CFRunLoopRun + 1300
10 CoreFoundation CFRunLoopRunSpecific + 522
11 CoreFoundation CFRunLoopRunInMode + 106
12 GraphicsServices GSEventRunModal + 138

I found my problem. Might be that it solves yours too... In dealloc, remove all of the MapViews overlays and the crash should be fixed...

Related

Coredata crash on iOS 16, over-release in -[_PFManagedObjectReferenceQueue _processReferenceQueue:]

We are experiencing a weird issue on iOS16. There is no code change, it works fine on lower OS versions.
The stacktrace is:
The first case
Crashed: com.apple.main-thread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x00000000e5bde410
0
libobjc.A.dylib
objc_release_x21 + 16
1
CoreData
-[_PFManagedObjectReferenceQueue _processReferenceQueue:] + 1020
2
CoreData
-[NSManagedObjectContext _processRecentChanges:] + 112
3
CoreData
_performRunLoopAction + 412
4
CoreFoundation
__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 36
5
CoreFoundation
__CFRunLoopDoObservers + 532
6
CoreFoundation
__CFRunLoopRun + 1048
7
CoreFoundation
CFRunLoopRunSpecific + 612
8
GraphicsServices
GSEventRunModal + 164
9
UIKitCore
-[UIApplication _run] + 888
10
UIKitCore
UIApplicationMain + 340
The second case, I believe this stacktrace has the same root cause as the previous one (same trend, same UI page, only happens on iOS 16).
Crashed: com.apple.main-thread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0033003200390070
0
libobjc.A.dylib
objc_msgSend + 32
1
CoreFoundation
-[__NSArrayM dealloc] + 188
2
MyApplication
MyClass.m - Line 361
-[MyClass loadMessages:] + 361
3
MyApplication
MyClass.m - Line 125
__74-[MyClass requestRecentMessagesAndDiscardExistingMessagesCompletion:]_block_invoke + 125
4
libdispatch.dylib
_dispatch_call_block_and_release + 32
5
libdispatch.dylib
_dispatch_client_callout + 20
6
libdispatch.dylib
_dispatch_main_queue_drain + 928
7
libdispatch.dylib
_dispatch_main_queue_callback_4CF + 44
8
CoreFoundation
__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
9
CoreFoundation
__CFRunLoopRun + 2036
10
CoreFoundation
CFRunLoopRunSpecific + 612
11
GraphicsServices
GSEventRunModal + 164
12
UIKitCore
-[UIApplication _run] + 888
13
UIKitCore
UIApplicationMain + 340
MyClass.m is an Objective-C class, it has a property:
#property (nonatomic, strong) NSArray<Message *> *messages; // Message is NSManagedObject
In the second stacktrace, frame -[OurClass loadMessages:] + 361, the messages array is deallocated:
self.messages = [[NSArray alloc] init...];
So my guess is, somehow the messages are over-released. If the messages are released in MyClass before, then the crash happens as the first stacktrace, otherwise it happens as the second stacktrace.
I've turned on -com.apple.CoreData.ConcurrencyDebug 1 to try to debug this, but no luck.
Any help would be much appreciated. Thanks in advance!

EAAccessoryManager notifyObserversThatAccessoryDisconnectedWithUserInfo crashes iOS 11.1.2

App is crashing while a bluetooth device is disconnected.
I've seen few related threads and they say
"A notification delegate was not reset to nil. A fix has been applied at version 10.3.79."
Following is crash log:
Triggered by Thread: 0
Thread 0 name:
Thread 0 Crashed:
0 libobjc.A.dylib 0x000000018544c430 objc_msgSend + 16
1 ExternalAccessory 0x000000019c07c4dc -[EAAccessoryManager _notifyObserversThatAccessoryDisconnectedWithUserInfo:] + 104 (EAAccessoryManager.m:909)
2 ExternalAccessory 0x000000019c07eddc -[EAAccessoryManager _externalAccessoryDisconnected:] + 928 (EAAccessoryManager.m:1537)
3 CoreAccessories 0x00000001a7892ccc __54-[ACCExternalAccessoryProvider ExternalAccessoryLeft:]_block_invoke + 316 (ACCExternalAccessoryProvider.m:453)
4 libdispatch.dylib 0x0000000185b6d088 _dispatch_call_block_and_release + 24 (init.c:994)
5 libdispatch.dylib 0x0000000185b6d048 _dispatch_client_callout + 16 (object.m:502)
6 libdispatch.dylib 0x0000000185b79b74 _dispatch_main_queue_callback_4CF$VARIANT$mp + 1016 (inline_internal.h:2500)
7 CoreFoundation 0x0000000186191eb0 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12 (CFRunLoop.c:1815)
8 CoreFoundation 0x000000018618fa8c __CFRunLoopRun + 2012 (CFRunLoop.c:3111)
9 CoreFoundation 0x00000001860affb8 CFRunLoopRunSpecific + 436 (CFRunLoop.c:3245)
10 GraphicsServices 0x0000000187f47f84 GSEventRunModal + 100 (GSEvent.c:2245)
11 UIKit 0x000000018f6842e8 UIApplicationMain + 208 (UIApplication.m:3949)
12 MYAPP 0x0000000100ab8d58 main + 172 (main.m:16)
13 libdyld.dylib 0x0000000185bd256c start + 4

Unknown Error: Not reproducible Fatal Exception

My app is experiencing a weird error which I cannot reproduce. I know the existence of this error because some users have reported it to me and I could catch it using the Fabric SDK.
Apparently it happens at any location, at any given time. It doesn't not happen a lot though, it seems to happen once in a while. I have no idea where to start looking for this, because I tried to catch the error running on multiple devices connected to my xcode project, but it just doesn't happen to me, or at least when I am looking for it. Can someone give me a light where to begin to look for it?
The stack trace:
Fatal Exception: NSInvalidArgumentException
0 CoreFoundation 0x18730afe0 __exceptionPreprocess
1 libobjc.A.dylib 0x185d6c538 objc_exception_throw
2 CoreFoundation 0x187311ef4 __methodDescriptionForSelector
3 CoreFoundation 0x18730ef54 ___forwarding___
4 CoreFoundation 0x18720ad4c _CF_forwarding_prep_0
5 Foundation 0x187dff50c __NSThreadPerformPerform
6 CoreFoundation 0x1872b942c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
7 CoreFoundation 0x1872b8d04 __CFRunLoopDoSources0
8 CoreFoundation 0x1872b69a8 __CFRunLoopRun
9 CoreFoundation 0x1871e6da4 CFRunLoopRunSpecific
10 GraphicsServices 0x188c51074 GSEventRunModal
11 UIKit 0x18d49ac9c UIApplicationMain
12 Otelo 0x100230fc4 main (AppDelegate.swift:23)
13 libdyld.dylib 0x1861f559c start
Crashed: com.twitter.crashlytics.ios.exception
0 Otelo 0x1005bb308 CLSProcessRecordAllThreads + 1572
1 Otelo 0x1005bb308 CLSProcessRecordAllThreads + 1572
2 Otelo 0x1005bb1c4 CLSProcessRecordAllThreads + 1248
3 Otelo 0x1005aaa6c CLSHandler + 48
4 Otelo 0x1005b9110 __CLSExceptionRecord_block_invoke + 92
5 libdispatch.dylib 0x1861c29a0 _dispatch_client_callout + 16
6 libdispatch.dylib 0x1861cfee0 _dispatch_barrier_sync_f_invoke + 84
7 Otelo 0x1005b8ba4 CLSExceptionRecord + 212
8 Otelo 0x1005b89cc CLSExceptionRecordNSException + 548
9 Otelo 0x1005b85e0 CLSTerminateHandler() + 396
10 libc++abi.dylib 0x185d5b5d4 std::__terminate(void (*)()) + 16
11 libc++abi.dylib 0x185d5b1a8 __cxa_rethrow + 144
12 libobjc.A.dylib 0x185d6c6f8 objc_exception_rethrow + 44
13 CoreFoundation 0x1871e6e10 CFRunLoopRunSpecific + 532
14 GraphicsServices 0x188c51074 GSEventRunModal + 100
15 UIKit 0x18d49ac9c UIApplicationMain + 208
16 Otelo 0x100230fc4 main (AppDelegate.swift:23)
17 libdyld.dylib 0x1861f559c start + 4

How to understand IOS trace logs

How to understand a trace from an IOS application
top to bottom (or) bottom to top
0 libobjc.A.dylib 0x0000000195b77bc8 objc_msgSend + 4
1 Foundation 0x0000000184edfc84 _NSDescriptionWithStringProxyFunc + 68
2 CoreFoundation 0x0000000183fa9b50 __CFStringAppendFormatCore + 6948
3 CoreFoundation 0x0000000183fa7ff0 _CFStringCreateWithFormatAndArgumentsAux2 + 244
4 CoreFoundation 0x0000000183fc59dc _CFLogvEx2 + 148
5 Foundation 0x0000000184dff660 NSLogv + 104
6 Foundation 0x0000000184dff5e8 NSLog + 20
7 My Mobile 0x00000001005819b0 -[MySDK didFailWithError:] + 272
8 My Mobile 0x00000001005d3974 -[MyServiceManager validate:didFailWithError:] + 1200
9 My Mobile 0x00000001005bb20c __60-[MyHttpCliebt validate]_block_invoke110 + 528
10 MyTIM Mobile 0x00000001005c2ca8 __84-[AFHTTPSessionManager dataTaskWithHTTPMethod:URLString:parameters:success:failure:]_block_invoke87 + 160
11 My Mobile 0x00000001005a7ef0 __72-[AFURLSessionManagerTaskDelegate URLSession:task:didCompleteWithError:]_block_invoke + 220
12 libdispatch.dylib 0x00000001961e1994 _dispatch_call_block_and_release + 20
13 libdispatch.dylib 0x00000001961e1954 _dispatch_client_callout + 12
14 libdispatch.dylib 0x00000001961e620c _dispatch_main_queue_callback_4CF + 1604
15 CoreFoundation 0x0000000183f97544 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
16 CoreFoundation 0x0000000183f955ec __CFRunLoopRun + 1488
17 CoreFoundation 0x0000000183ec0f74 CFRunLoopRunSpecific + 392
18 GraphicsServices 0x000000018d7f36fc GSEventRunModal + 164
19 UIKit 0x0000000188ac2d94 UIApplicationMain + 1484
20 MyTIM Mobile 0x00000001000de4a0 main (main.m:12)
21 libdyld.dylib 0x000000019620ea08 start + 0
Please help me in identifying where the problem actually starts, is it starts at AFURLSessionManagerTaskDelegate (or) MySDK ?
Which is causing the issue, is NSLog causing issue ? or blocks and threads causing this issue?
How to analyze a crash report is described in Technical Note TN2151.

Debug/reproduce EXC_BAD_ACCESS crash in CA::release_objects

I use Crashlytics to track crashes and I am seeing some crashes with the stack trace below:
Crashed: com.apple.main-thread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0xf8560b1c
Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x37a20b66 objc_msgSend + 5
1 CoreFoundation 0x2d5f8e8d CFRelease + 560
2 QuartzCore 0x2fad2965 CA::release_objects(X::List<void const*>*) + 16
3 QuartzCore 0x2fad7dcf -[CAAnimation dealloc] + 54
4 libobjc.A.dylib 0x37a30b0b objc_object::sidetable_release(bool) + 174
5 CoreFoundation 0x2d5f8e8d CFRelease + 560
6 QuartzCore 0x2fada419 CA::Layer::run_animation_callbacks(void*) + 240
7 libdispatch.dylib 0x37f0a0af _dispatch_client_callout + 22
8 libdispatch.dylib 0x37f0c9a9 _dispatch_main_queue_callback_4CF + 268
9 CoreFoundation 0x2d6935b1 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
10 CoreFoundation 0x2d691e7d __CFRunLoopRun + 1308
11 CoreFoundation 0x2d5fc471 CFRunLoopRunSpecific + 524
12 CoreFoundation 0x2d5fc253 CFRunLoopRunInMode + 106
13 GraphicsServices 0x323362eb GSEventRunModal + 138
14 UIKit 0x2feb1845 UIApplicationMain + 1136
It looks like CFRelease is being called on some object twice. The problem is I have no idea which animation is causing the crash. The logs aren't very helpful as the crash happens in different places. How do I go about debugging/reproducing this crash or at the very least logging something so that I know what object is being released twice.

Resources