I use crashlytics to get the crashes of my app, i am currently Crashlytics version: 3.9.3. Some users are getting a crash that I cannot seem to repro on my machine. This is the logs from Fabric:
Crashed: com.apple.root.default-qos
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x00004a4b9a43bec8
#37. Crashed: com.apple.root.default-qos
0 libobjc.A.dylib 0x7fff6b43d184 objc_release + 36
1 MyApp 0x10805ad2d __66-[AppManager getCountriesDelegate:]_block_invoke (AppManager.m:1412)
2 libdispatch.dylib 0x7fff6c006591 _dispatch_call_block_and_release + 12
3 libdispatch.dylib 0x7fff6bffed50 _dispatch_client_callout + 8
4 libdispatch.dylib 0x7fff6c00bc61 _dispatch_queue_override_invoke + 880
5 libdispatch.dylib 0x7fff6c000941 _dispatch_root_queue_drain + 515
6 libdispatch.dylib 0x7fff6c0006ed _dispatch_worker_thread3 + 101
7 libsystem_pthread.dylib 0x7fff6c2c31ca _pthread_wqthread + 1387
8 libsystem_pthread.dylib 0x7fff6c2c2c4d start_wqthread + 13
- (void) getCountriesDelegate:(id<AppManagerDelegate>)delegate
{
__weak __typeof(id<AppManagerDelegate>) weakDelegate = delegate;
__weak __typeof(self) weakSelf = self;
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ //my function definition
});
There are multiples reasons why you can get a EXC_BAD_ACCESS KERN_INVALID_ADDRESS error code. Appel's documentation says:
EXC_BAD_ACCESS/KERN_INVALID_ADDRESS — This is caused by the thread
accessing unmapped memory. It may be triggered by either a data access
or an instruction fetch; the Thread State section describes how to
tell the difference.
You should look deeply at your class AppManager. As the crashlog said's the crash occurs at line 1412 of file AppManager.m in the method getCountriesWithRespectToPurposeAndFavoriteDelegate:.
Related
I am a relatively new developer and would like some assistance. My app does not crash when I have it hooked up via Xcode. However, when I try to run it again the next day (launching from my phone), it crashes when trying to open it. I am currently debugging the situation and am unsure how to proceed.
I'm having troubles with understanding how a device log crashes work. I was able to get to my device's crashes in Xcode via Window>Device and Simulators>View Device Logs>All Logs. I am able to understand that having an Exception type of "EXC_BREAKPOINT (SIGTRAP)" means that I force unwrap a nil value. I am unsure how through looking at the log (or any other method) that I can locate in my code where this is happening. How can I locate in all my files where this is causing a crash?
Date/Time: 2018-04-05 14:33:48.7121 -0500
Launch Time: 2018-04-05 14:33:47.8058 -0500
OS Version: iPhone OS 11.3 (15E216)
Baseband Version: 1.04.16
Report Version: 104
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x0000000104177ff8
Termination Signal: Trace/BPT trap: 5
Termination Reason: Namespace SIGNAL, Code 0x5
Terminating Process: exc handler [0]
Triggered by Thread: 1
Filtered syslog:
None found
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0:
0 libsystem_kernel.dylib 0x0000000180d07e08 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x0000000180d07c80 mach_msg + 72
2 CoreFoundation 0x000000018124ae40 __CFRunLoopServiceMachPort + 196
3 CoreFoundation 0x0000000181248908 __CFRunLoopRun + 1568
4 CoreFoundation 0x0000000181168da8 CFRunLoopRunSpecific + 552
5 GraphicsServices 0x000000018314b020 GSEventRunModal + 100
6 UIKit 0x000000018b14978c UIApplicationMain + 236
7 &me 0x0000000102cd00e4 0x102bac000 + 1196260
8 libdyld.dylib 0x0000000180bf9fc0 start + 4
Thread 1 name: Dispatch queue: NSOperationQueue 0x1d4224f80 (QOS: UNSPECIFIED)
Thread 1 Crashed:
0 libswiftCore.dylib 0x0000000104177ff8 0x103fd0000 + 1736696
1 libswiftCore.dylib 0x0000000104177ff8 0x103fd0000 + 1736696
2 libswiftCore.dylib 0x00000001040182b8 0x103fd0000 + 295608
3 &me 0x0000000102c9576c 0x102bac000 + 956268
4 &me 0x0000000102c95cbc 0x102bac000 + 957628
5 CFNetwork 0x0000000181831c1c __75-[__NSURLSessionLocal taskForClass:request:uploadFile:bodyData:completion:]_block_invoke + 32
6 CFNetwork 0x000000018184a93c __49-[__NSCFLocalSessionTask _task_onqueue_didFinish]_block_invoke + 152
7 Foundation 0x0000000181ccae88 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 16
8 Foundation 0x0000000181c0c8d0 -[NSBlockOperation main] + 72
9 Foundation 0x0000000181c0bcac -[__NSOperationInternal _start:] + 848
10 libdispatch.dylib 0x0000000180b94ae4 _dispatch_client_callout + 16
11 libdispatch.dylib 0x0000000180bd0b0c _dispatch_block_invoke_direct$VARIANT$armv81 + 216
12 libdispatch.dylib 0x0000000180b94ae4 _dispatch_client_callout + 16
13 libdispatch.dylib 0x0000000180bd0b0c _dispatch_block_invoke_direct$VARIANT$armv81 + 216
14 libdispatch.dylib 0x0000000180bd0a00 dispatch_block_perform$VARIANT$armv81 + 104
15 Foundation 0x0000000181ccc750 __NSOQSchedule_f + 376
16 libdispatch.dylib 0x0000000180b94ae4 _dispatch_client_callout + 16
17 libdispatch.dylib 0x0000000180bd17a8 _dispatch_continuation_pop$VARIANT$armv81 + 416
18 libdispatch.dylib 0x0000000180bd0180 _dispatch_async_redirect_invoke$VARIANT$armv81 + 596
19 libdispatch.dylib 0x0000000180bd63a4 _dispatch_root_queue_drain + 592
20 libdispatch.dylib 0x0000000180bd60f0 _dispatch_worker_thread3 + 112
21 libsystem_pthread.dylib 0x0000000180ec7fac _pthread_wqthread + 1176
22 libsystem_pthread.dylib 0x0000000180ec7b08 start_wqthread + 4
To understand the crash log you can go through the following apple documentation. This is the best explanation I found so far.
https://developer.apple.com/library/content/technotes/tn2151/_index.html
My iOS app uses AFNetworking (2.6.1), and my highest ranking crash is :
Crashed: com.apple.NSURLSession-work
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0004000128ab38a0
This is how most stack traces look like in Crashlytics:
Thread : Crashed: com.apple.NSURLSession-work
0 libobjc.A.dylib 0x180e29bc8 objc_msgSend + 8
1 CFNetwork 0x181df6518 SessionConnectionLoadable::_loaderClientEvent_DidReceiveConnectionCacheKey(HTTPConnectionCacheKey*) + 56
2 CFNetwork 0x181e75178 ___ZN19URLConnectionLoader36protocolDidReceiveConnectionCacheKeyEP22HTTPConnectionCacheKey_block_invoke + 40
3 libdispatch.dylib 0x1811fd630 _dispatch_call_block_and_release + 24
4 libdispatch.dylib 0x1811fd5f0 _dispatch_client_callout + 16
5 libdispatch.dylib 0x181209634 _dispatch_queue_drain + 864
6 libdispatch.dylib 0x1812010f4 _dispatch_queue_invoke + 464
7 libdispatch.dylib 0x18120b504 _dispatch_root_queue_drain + 728
8 libdispatch.dylib 0x18120b224 _dispatch_worker_thread3 + 112
9 libsystem_pthread.dylib 0x181411470 _pthread_wqthread + 1092
10 libsystem_pthread.dylib 0x181411020 start_wqthread + 4
I don't use kvo, and my app uses location and stays in the background at all times.
Any ideas on how to debug / recreate (I can't manage to recreate the issue in a simulator or on a device) ?
Even catching the exception, without knowing where it is or how to handle it correctly would suffice in this case...
I am getting a crash report from my app in production. The stack trace doesn't include any of my code, rather points to code in RestKit itself where it is crashing. The crash itself is hard to reproduce on my side, and seems like some user in production is hitting an edge case. Below is the stack trace:
Thread : Crashed: NSManagedObjectContext 0x1743ecd00
0 libobjc.A.dylib 0x000000019361c0b4 objc_retain + 20
1 MyApp 0x00000001001e64c4 __78-[RKManagedObjectRequestOperation obtainPermanentObjectIDsForInsertedObjects:]_block_invoke (RKManagedObjectRequestOperation.m:873)
2 CoreData 0x0000000181b7d218 developerSubmittedBlockToNSManagedObjectContextPerform + 200
3 libdispatch.dylib 0x0000000193c55954 _dispatch_client_callout + 16
4 libdispatch.dylib 0x0000000193c5f1e4 _dispatch_barrier_sync_f_invoke + 76
5 CoreData 0x0000000181b7d0d8 -[NSManagedObjectContext performBlockAndWait:] + 244
6 MyApp 0x00000001001e62d8 -[RKManagedObjectRequestOperation obtainPermanentObjectIDsForInsertedObjects:] (RKManagedObjectRequestOperation.m:870)
7 MyApp 0x00000001001e34e4 __79-[RKManagedObjectRequestOperation performMappingOnResponseWithCompletionBlock:]_block_invoke345 (RKManagedObjectRequestOperation.m:643)
8 MyApp 0x000000010021c31c -[RKResponseMapperOperation willFinish] (RKResponseMapperOperation.m:317)
9 MyApp 0x000000010021c980 -[RKResponseMapperOperation main] (RKResponseMapperOperation.m:404)
10 Foundation 0x0000000182c601cc -[__NSOperationInternal _start:] + 636
11 Foundation 0x0000000182d21f28 __NSOQSchedule_f + 228
12 libdispatch.dylib 0x0000000193c55954 _dispatch_client_callout + 16
13 libdispatch.dylib 0x0000000193c600a4 _dispatch_queue_drain + 1448
14 libdispatch.dylib 0x0000000193c58a5c _dispatch_queue_invoke + 132
15 libdispatch.dylib 0x0000000193c62318 _dispatch_root_queue_drain + 720
16 libdispatch.dylib 0x0000000193c63c4c _dispatch_worker_thread3 + 108
17 libsystem_pthread.dylib 0x0000000193e3522c _pthread_wqthread + 816
18 libsystem_pthread.dylib 0x0000000193e34ef0 start_wqthread + 4
The crash message itself is:
Crashed: NSManagedObjectContext 0x17198900
EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x915da43f
Any hints/directions as to how I can go about debugging this issue?
Thanks.
Ran into this, had setup the core data stack twice on accident, removing the second initialization fixed the issue.
The crash report is here:
>Exception Type: SIGSEGV
>Exception Codes: SEGV_ACCERR at 0x16b
>Crashed Thread: 3
>Thread 3 Crashed:
>0 libobjc.A.dylib 0x0000000195e7bbc8 objc_msgSend + 8
>1 MSProject 0x00000001001888a4 -[MStateDataAnalysis stopRecogniseTask] (MStateDataAnalysis.m:85)
>.....
>7 libdispatch.dylib 0x00000001964e5954 _dispatch_client_callout + 16
>8 libdispatch.dylib 0x00000001964fc010 _dispatch_source_latch_and_call + 2052
>9 libdispatch.dylib 0x00000001964e7abc _dispatch_source_invoke + 288
>10 libdispatch.dylib 0x00000001964f2318 _dispatch_root_queue_drain + 720
>11 libdispatch.dylib 0x00000001964f3c4c _dispatch_worker_thread3 + 108
>12 libsystem_pthread.dylib 0x00000001966c522c _pthread_wqthread + 816
>13 libsystem_pthread.dylib 0x00000001966c4ef0 start_wqthread + 4
The [MStateDataAnalysis stopRecogniseTask] (MStateDataAnalysis.m:85) class line 85 is:
85 while (![_lock tryLock]) {
[NSThread sleepForTimeInterval:0.1];
}
_resultArray = nil;
_metroFlagArray = nil;
[_lock unlock];
The lock is:
#property(nonatomic, strong) NSLock * lock;
Because the _resultArray and _metroFlagArray is used in two thread,so I use lock。But I don't know what's wrong,there are small probability crash.
This is a bit of a weird one.
In my code, I have this line:
NSMutableArray *unresolvedPlayers = [NSMutableArray arrayWithCapacity:3];
This seems like a perfectly valid line. I crashed on this line with this stack trace (I have replaced my app name with xxxxxxxxx):
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0xc158f710
Triggered by Thread: 7
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0:
0 libsystem_kernel.dylib 0x3870d648 syscall_thread_switch + 8
1 libsystem_platform.dylib 0x3879a79a _os_lock_handoff_lock_slow + 74
2 libsystem_malloc.dylib 0x38748ece szone_malloc_should_clear + 50
3 libsystem_malloc.dylib 0x3874c444 malloc_zone_calloc + 92
4 libsystem_malloc.dylib 0x3874c3d2 calloc + 46
5 libobjc.A.dylib 0x380c8414 class_createInstance + 36
6 CoreFoundation 0x2a5773d0 __CFAllocateObject2 + 8
7 CoreFoundation 0x2a48c86a +[__NSArrayM __new:::::] + 38
8 CoreFoundation 0x2a48fd7c -[__NSPlaceholderArray initWithCapacity:] + 100
9 CoreFoundation 0x2a497e88 +[NSMutableArray arrayWithCapacity:] + 36
10 xxxxxxxxxx 0x001730f4 -[HostManager setHost:timestamp:] (HostManager.m:703)
11 xxxxxxxxxx 0x0016ff10 -[HostManager initSessionFromInvitation:] (HostManager.m:46)
12 xxxxxxxxxx 0x000ea68e -[NetworkController updateWithMatch:] (NetworkController.m:894)
13 xxxxxxxxxx 0x000ea418 __72-[NetworkController invitePlayersToMatch:playerGroup:completionHandler:]_block_invoke544 (NetworkController.m:844)
14 GameCenterFoundation 0x31263936 __72-[GKMatchmaker invitePlayersWithRequest:serverHosted:completionHandler:]_block_invoke601 + 42
15 libdispatch.dylib 0x38620420 _dispatch_call_block_and_release + 8
16 libdispatch.dylib 0x3862040c _dispatch_client_callout + 20
17 libdispatch.dylib 0x3862b1b0 _dispatch_main_queue_callback_4CF$VARIANT$mp + 708
18 CoreFoundation 0x2a53762c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 4
19 CoreFoundation 0x2a535d4c __CFRunLoopRun + 1508
20 CoreFoundation 0x2a482b2c CFRunLoopRunSpecific + 472
21 CoreFoundation 0x2a48293e CFRunLoopRunInMode + 102
22 GraphicsServices 0x3183904c GSEventRunModal + 132
23 UIKit 0x2da786ec UIApplicationMain + 1436
24 xxxxxxxxxx 0x000503b2 main (main.m:16)
25 libdyld.dylib 0x3865baac start + 0
How is it possible that my memory has gotten corrupted up to this point that allocating a new NSMutableArray would cause this to happen? I'm not even sure where to start with debugging this one. I am not sure this is easily reproducible.
As a side note, it happened when inviting nearby players to a realtime GameCenter match.
EDIT: I just realized this is crashing on Thread 7. This is what Thread 7 looks like:
Thread 7 name: Dispatch queue: com.apple.root.default-qos
Thread 7 Crashed:
0 libobjc.A.dylib 0x380cbf66 objc_msgSend + 6
1 GameCenterFoundation 0x31285efc -[GKMatchmaker(Nearby) inviteAnyNearbyPlayersWithRequest:] + 960
2 GameCenterFoundation 0x312636a8 __72-[GKMatchmaker invitePlayersWithRequest:serverHosted:completionHandler:]_block_invoke + 256
3 GameCenterFoundation 0x3129ae92 __39-[GKDispatchGroup notifyOnQueue:block:]_block_invoke44 + 10
4 libdispatch.dylib 0x38620420 _dispatch_call_block_and_release + 8
5 libdispatch.dylib 0x3862c2d6 _dispatch_root_queue_drain + 846
6 libdispatch.dylib 0x3862d1f6 _dispatch_worker_thread3 + 102
7 libsystem_pthread.dylib 0x3879de22 _pthread_wqthread + 666
8 libsystem_pthread.dylib 0x3879db74 start_wqthread + 4
So, this is probably a bug with GameCenter.
Crash in objc_msgSend can indicate that message destination object is deallocated already. Try to enable zombie objects and keep your eyes on logs.