I have been stuck with this crash for few days and seem to be going nowhere.
Crashed: NSManagedObjectContext 0x14f016920
EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x0000000000000010
Thread : Crashed: NSManagedObjectContext 0x14f016920
0 libobjc.A.dylib 0x000000019953dbd0 objc_msgSend + 16
1 CoreFoundation 0x0000000184969c84 __CFBasicHashDrain + 276
2 CoreFoundation 0x0000000184814da4 CFRelease + 256
3 CoreData 0x0000000184632cf0 -[_NSFaultingMutableSet dealloc] + 68
4 CoreData 0x00000001845f8d3c -[_CDSnapshot dealloc] + 84
5 CoreData 0x00000001846068e0 -[NSManagedObject(_NSInternalMethods) _clearRawPropertiesWithHint:] + 388
6 CoreData 0x00000001846066bc -[NSFaultHandler turnObject:intoFaultWithContext:] + 448
7 CoreData 0x0000000184603e10 -[NSManagedObject dealloc] + 104
8 CoreData 0x0000000184603428 -[_PFManagedObjectReferenceQueue _processReferenceQueue:] + 1076
9 CoreData 0x0000000184681678 __89-[NSManagedObjectContext(_NSInternalNotificationHandling) _registerAyncReferenceCallback]_block_invoke + 104
10 CoreData 0x000000018467bc20 developerSubmittedBlockToNSManagedObjectContextPerform + 196
11 libdispatch.dylib 0x0000000199d25770 _dispatch_client_callout + 16
12 libdispatch.dylib 0x0000000199d3175c _dispatch_queue_drain + 864
13 libdispatch.dylib 0x0000000199d29274 _dispatch_queue_invoke + 464
14 libdispatch.dylib 0x0000000199d25770 _dispatch_client_callout + 16
15 libdispatch.dylib 0x0000000199d33bb0 _dispatch_root_queue_drain + 2140
16 libdispatch.dylib 0x0000000199d3334c _dispatch_worker_thread3 + 112
17 libsystem_pthread.dylib 0x0000000199f39478 _pthread_wqthread + 1092
Any pointers on how I can debug this crash? The same didn't crash in iOS 8. Could it be a iOS 9 crash and hopefully it will be fixed in the subsequent iOS versions?
Any help would be much appreciated.
Related
We have been facing a weird crash from core data from long time and haven't found anything what to do. Below is the crash stack to get more insight on it. It is a production issue and not replicate at our end.
Crashed: NSManagedObjectContext 0x2810fd450
0 CoreData 0x6f8d8 _PFObjectIDFastHash64 + 40
1 CoreFoundation 0xef54 __CFBasicHashRehash + 948
2 CoreFoundation 0xe76c CFBasicHashRemoveValue + 2412
3 CoreFoundation 0x45ce0 CFDictionaryRemoveValue + 336
4 CoreData 0x10781c -[NSManagedObjectContext(_NSInternalAdditions) _forgetObject:propagateToObjectStore:removeFromRegistry:] + 132
5 CoreData 0x29554 -[_PFManagedObjectReferenceQueue _processReferenceQueue:] + 916
6 CoreData 0xa284c __90-[NSManagedObjectContext(_NSInternalNotificationHandling) _registerAsyncReferenceCallback]_block_invoke + 80
7 CoreData 0x1f754 developerSubmittedBlockToNSManagedObjectContextPerform + 156
8 libdispatch.dylib 0x4660 _dispatch_client_callout + 20
9 libdispatch.dylib 0xbde4 _dispatch_lane_serial_drain + 672
10 libdispatch.dylib 0xc958 _dispatch_lane_invoke + 392
11 libdispatch.dylib 0x171a8 _dispatch_workloop_worker_thread + 656
12 libsystem_pthread.dylib 0x10f4 _pthread_wqthread + 288
13 libsystem_pthread.dylib 0xe94 start_wqthread + 8
Looks like the problem could be in NSManagedObjectContext performing some work. Maybe integrating some data-collection lib, as Crashlytics can help.
Regarding stack trace: could you please send the original error message (as shown on screenshot)?.
For now I can draw only bare suggestions that are not so relevant.
We are getting this crash on multiple devices but cannot figure out where it originates from. The main thread is crashing.
Stack trace:
Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x193dfd58c object_getMethodImplementation + 20
1 CoreFoundation 0x1940f6928 _NSIsNSSet + 40
2 CoreFoundation 0x193fc2c04 -[NSMutableSet unionSet:] + 112
3 CoreData 0x198abe014 -[_NSFaultingMutableSet willReadWithContents:] + 668
4 CoreData 0x198ae4280 -[_NSFaultingMutableSet count] + 32
5 CoreData 0x198be1bb4 __107-[NSManagedObjectContext(_NestedContextSupport) newValueForRelationship:forObjectWithID:withContext:error:]_block_invoke + 360
6 CoreData 0x198be2e70 internalBlockToNSManagedObjectContextPerform + 104
7 libdispatch.dylib 0x193d8b5ac _dispatch_client_callout + 20
8 libdispatch.dylib 0x193d9843c _dispatch_async_and_wait_invoke + 96
9 libdispatch.dylib 0x193d8b5ac _dispatch_client_callout + 20
10 libdispatch.dylib 0x193d977d4 _dispatch_main_queue_callback_4CF + 832
11 CoreFoundation 0x1940648d4 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
12 CoreFoundation 0x19405f58c __CFRunLoopRun + 1692
13 CoreFoundation 0x19405ebc8 CFRunLoopRunSpecific + 480
14 GraphicsServices 0x19e4475cc GSEventRunModal + 164
15 UIKitCore 0x198211744 UIApplicationMain + 1936
16 My App 0x100b37324 main + 16 (main.m:16)
17 libdyld.dylib 0x193edb384 start + 4
At the same time, a background thread operating in a PrivateQueue ManagedObjectContext is busy accessing a ManagedObject via awakeFromFetch, stack trace of this thread:
NSManagedObjectContext 0x28066c700
0 libsystem_kernel.dylib 0x1b09617e4 __ulock_wait + 8
1 libdispatch.dylib 0x1b081bf48 _dlock_wait + 56
2 libdispatch.dylib 0x1b081bcf4 _dispatch_thread_event_wait_slow + 56
3 libdispatch.dylib 0x1b0828618 __DISPATCH_WAIT_FOR_QUEUE__ + 336
4 libdispatch.dylib 0x1b0828204 _dispatch_sync_f_slow + 144
5 CoreData 0x1b56686cc _perform + 200
6 CoreData 0x1b558e2c4 -[NSManagedObjectContext(_NestedContextSupport) newValueForRelationship:forObjectWithID:withContext:error:] + 156
7 CoreData 0x1b555033c -[NSFaultHandler retainedFulfillAggregateFaultForObject:andRelationship:withContext:] + 428
8 CoreData 0x1b554df10 -[_NSFaultingMutableSet willReadWithContents:] + 408
9 CoreData 0x1b55ea5bc -[_NSFaultingMutableSet allObjects] + 32
10 My App 0x1044fdc3c PSUser.isAdmin.getter + 286 (PSUser.swift:286)
11 My App 0x1044fdb04 #objc PSUser.isAdmin.getter + 4309900036 (<compiler-generated>:4309900036)
12 My App 0x1044fc694 PSUser.initCurrentTeam() + 212 (PSUser.swift:212)
13 My App 0x1044fcbc0 #objc PSUser.initCurrentTeam() + 4309896128 (<compiler-generated>:4309896128)
14 My App 0x1044fc658 #objc PSUser.awakeFromFetch() + 4309894744 (<compiler-generated>:4309894744)
15 CoreData 0x1b56520e4 _PFFaultHandlerFulfillFault + 3168
16 CoreData 0x1b5650ab0 _PFFaultHandlerLookupRow + 908
17 CoreData 0x1b56527fc _PF_FulfillDeferredFault + 260
18 CoreData 0x1b5666a2c _pvfk_header + 120
19 CoreData 0x1b5663218 _sharedIMPL_pvfk_core + 32
20 My App 0x10438918c +[PSAppSettings isAutoPilotAllowed:] + 97 (PSAppSettings.m:97)
21 My App 0x1043fbb9c LocationTracker.updateTrackingState(user:) + 1120 (LocationTracker.swift:1120)
22 My App 0x104413b4c partial apply for closure #1 in LocationTracker.store(filteredLocations:) + 1275 (LocationTracker.swift:1275)
23 My App 0x1043bae3c thunk for #escaping #callee_guaranteed () -> () + 4308577852 (<compiler-generated>:4308577852)
24 CoreData 0x1b566b650 developerSubmittedBlockToNSManagedObjectContextPerform + 164
25 libdispatch.dylib 0x1b081b5ac _dispatch_client_callout + 20
26 libdispatch.dylib 0x1b0821a64 _dispatch_lane_serial_drain + 568
27 libdispatch.dylib 0x1b0822498 _dispatch_lane_invoke + 400
28 libdispatch.dylib 0x1b082ba5c _dispatch_workloop_worker_thread + 584
29 libsystem_pthread.dylib 0x1b0881718 _pthread_wqthread + 276
30 libsystem_pthread.dylib 0x1b08879c8 start_wqthread + 8
I am not certain if the two stacks are related, or if the background thread is dispatching anything to the main thread (why should it?), but the call newValueForRelationship:forObjectWithID:withContext:error does appear in both stack traces.
The method for awakeFromFetch is initializing a calculated object property currentTeam via the initCurrentTeam() method. This method accesses the teams relationship on that object. Here is the relevant code:
#objc extension PSUser {
override open func awakeFromFetch() {
super.awakeFromFetch()
initCurrentTeam()
}
/**
This method sets the currentTeam by picking
the appropriate team from the `teams` set.
*/
func initCurrentTeam() {
if (isAdmin || isManager), !isEmployee,
var teams = teams?.allObjects as? [PSTeam],
currentTeam == nil {
...
currentTeam = teams.first
}
}
...
}
Enabled com.apple.CoreData.ConcurrencyDebug in Xcode Scheme but Xcode console does not complain. I have not been able to reproduce this issue while debugging in Xcode. The issue is only reported via Crashlytics in production environment.
Any ideas what might be causing this?
I can see from the Crashlytics that some of my app users are getting the following crashes. I have never seen these myself and don't know how to reproduce them as they don't have my code in the stack trace. I have read about OpenGL that some crashes are possible when trying to update the surface while the app is in the background. Not sure if that is the case here because the crashes didn't occur before iOS 9.
I have several annotations on the map, custom MKAnnotationView derived views, some custom overlays and a MKTileOverlay derived tile source. The map handling code and overlays are Objective-C, but my app has also some Swift code.
Does anybody have any ideas what could be the reason for the crashes?
1)
Thread : Crashed: com.apple.maps.geogl.renderQueue
0 VectorKit 0x18c82a894 ___ZN3ggl10GLRenderer5frameEPNS_12RenderTargetEPNS_11RenderQueueE_block_invoke_2 + 876
1 VectorKit 0x18c82a47c ___ZN3ggl10GLRenderer5frameEPNS_12RenderTargetEPNS_11RenderQueueE_block_invoke + 212
2 libdispatch.dylib 0x182625630 _dispatch_call_block_and_release + 24
3 libdispatch.dylib 0x1826255f0 _dispatch_client_callout + 16
4 libdispatch.dylib 0x182631634 _dispatch_queue_drain + 864
2)
Thread : Crashed: com.apple.mapdisplay.stylesheetLoadQueue
0 libdispatch.dylib 0x183ec2a90 dispatch_async + 76
1 libdispatch.dylib 0x183ec2a88 dispatch_async + 68
2 VectorKit 0x18df501c4 std::__1::__function::__func<-[VKTileSetBackedTileSource setStyleManager:]::$_0, std::__1::allocator<-[VKTileSetBackedTileSource setStyleManager:]::$_0>, void (std::__1::shared_ptr<gss::StyleManager>, bool)>::operator()(std::__1::shared_ptr<gss::StyleManager>&&, bool&&) + 176
3 VectorKit 0x18e11533c std::__1::__function::__func<gss::StyleManager::addFinishedDecodingGlobalPropertiesCallback(std::__1::function<void (std::__1::shared_ptr<gss::StyleManager>, bool)>)::$_0, std::__1::allocator<gss::StyleManager::addFinishedDecodingGlobalPropertiesCallback(std::__1::function<void (std::__1::shared_ptr<gss::StyleManager>, bool)>)::$_0>, void (bool)>::operator()(bool&&) + 88
4 VectorKit 0x18e10c248 ___ZN3gss10StyleSheet43addFinishedDecodingGlobalPropertiesCallbackENSt3__18functionIFvbEEE_block_invoke + 56
5 libdispatch.dylib 0x183ec1630 _dispatch_call_block_and_release + 24
6 libdispatch.dylib 0x183ec15f0 _dispatch_client_callout + 16
7 libdispatch.dylib 0x183ecd634 _dispatch_queue_drain + 864
8 libdispatch.dylib 0x183ec50f4 _dispatch_queue_invoke + 464
9 libdispatch.dylib 0x183ecf504 _dispatch_root_queue_drain + 728
10 libdispatch.dylib 0x183ecf224 _dispatch_worker_thread3 + 112
11 libsystem_pthread.dylib 0x1840d5470 _pthread_wqthread + 1092
12 libsystem_pthread.dylib 0x1840d5020 start_wqthread + 4
3)
Thread : Fatal Exception: NSGenericException
0 CoreFoundation 0x23f6a2eb __exceptionPreprocess
1 libobjc.A.dylib 0x23736dff objc_exception_throw
2 CoreFoundation 0x23f69d6d -[NSException name]
3 VectorKit 0x2c923af9 -[VKRasterOverlayTileSource _queueDraw:]
4 VectorKit 0x2c5e74ad -[VKTileSource fetchTileForKey:]
5 VectorKit 0x2c7c512d -[VKTileProvider dirtyTilesFromTileSource:]
6 libdispatch.dylib 0x23b07dd7 _dispatch_call_block_and_release
7 libdispatch.dylib 0x23b07dc3 _dispatch_client_callout
8 libdispatch.dylib 0x23b0c671 _dispatch_main_queue_callback_4CF
9 CoreFoundation 0x23f2cfc5 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
10 CoreFoundation 0x23f2b4bf __CFRunLoopRun
11 CoreFoundation 0x23e7dbb9 CFRunLoopRunSpecific
12 CoreFoundation 0x23e7d9ad CFRunLoopRunInMode
13 GraphicsServices 0x250f7af9 GSEventRunModal
14 UIKit 0x28169fb5 UIApplicationMain
15 MyApp 0x252d44 main (main.swift:12)
16 libdispatch.dylib 0x23b30873 (Missing)
A similar crashlog from my app as the following. From the thread name "com.apple.maps.geogl.renderQueue", I guess that is related with usage of the MapKit framework.
I found the "gpus_ReturnNotPermittedKillClient" in the Technical QA:
"How to fix OpenGL ES application crashes when moving to the background"
https://developer.apple.com/library/archive/qa/qa1766/_index.html
Crashed: com.apple.maps.geogl.renderQueue
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000001
0 libGPUSupportMercury.dylib 0x190a45f08 gpus_ReturnNotPermittedKillClient
1 libGPUSupportMercury.dylib 0x190a46ec4 gpusSubmitDataBuffers
2 VectorKit 0x18c7d1a0c ___ZN3ggl10GLRenderer5frameEPNS_12RenderTargetEPNS_11RenderQueueE_block_invoke + 212
3 libdispatch.dylib 0x181ec94bc _dispatch_call_block_and_release + 24
4 libdispatch.dylib 0x181ec947c _dispatch_client_callout + 16
5 libdispatch.dylib 0x181ed54c0 _dispatch_queue_drain + 864
6 libdispatch.dylib 0x181eccf80 _dispatch_queue_invoke + 464
7 libdispatch.dylib 0x181ed7390 _dispatch_root_queue_drain + 728
8 libdispatch.dylib 0x181ed9934 _dispatch_worker_thread + 124
9 libsystem_pthread.dylib 0x1820e3b28 _pthread_body + 156
10 libsystem_pthread.dylib 0x1820e3a8c _pthread_body + 154
11 libsystem_pthread.dylib 0x1820e1028 thread_start + 4
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.
I'm getting many crash reports from my iOS today extension in Crashlytics which I can't make any sense of. The extension retrieves the user's current location and saves it inside the app. The crashes look like this:
Thread : Crashed: com.apple.CoreLocation.ConnectionClient.0x174132fc0.events
EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x00000000f2cdbeb8
0 libobjc.A.dylib 0x0000000194d7fbd0 objc_msgSend + 16
1 CoreFoundation 0x00000001834823f8 CFDictionaryApplyFunction + 236
2 CoreLocation 0x0000000183d1c09c (null) + 54344
3 CoreLocation 0x0000000183d1adf0 (null) + 49564
4 libxpc.dylib 0x00000001955c4ccc _xpc_connection_call_event_handler + 68
5 libxpc.dylib 0x00000001955c8a18 do_mach_notify_port_destroyed + 124
6 libxpc.dylib 0x00000001955c8970 _Xmach_notify_port_destroyed + 96
Here is another one:
Thread : Crashed: com.apple.CoreLocation.ConnectionClient.0x1743221c0.events
EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x0000000000000008
0 CoreFoundation 0x0000000186678640 CFBasicHashGetBucket + 28
1 CoreFoundation 0x00000001866785c4 CFBasicHashApply + 100
2 CoreFoundation 0x00000001866785c4 CFBasicHashApply + 100
3 CoreFoundation 0x00000001866823d8 CFDictionaryApplyFunction + 204
4 CoreLocation 0x0000000186f1c09c (null) + 54344
5 CoreLocation 0x0000000186f1adf0 (null) + 49564
6 libxpc.dylib 0x0000000198814ccc _xpc_connection_call_event_handler + 68
7 libxpc.dylib 0x0000000198818a18 do_mach_notify_port_destroyed + 124
8 libxpc.dylib 0x0000000198818970 _Xmach_notify_port_destroyed + 96
9 libxpc.dylib 0x00000001988188e4 notify_server + 100
10 libxpc.dylib 0x0000000198812a98 _xpc_connection_mach_event + 1848
11 libdispatch.dylib 0x000000019860da28 _dispatch_client_callout4 + 16
12 libdispatch.dylib 0x0000000198611140 _dispatch_mach_msg_invoke + 492
13 libdispatch.dylib 0x00000001986182d4 _dispatch_queue_drain + 2008
14 libdispatch.dylib 0x0000000198610668 _dispatch_mach_invoke + 136
15 libdispatch.dylib 0x00000001986182d4 _dispatch_queue_drain + 2008
16 libdispatch.dylib 0x0000000198610a5c _dispatch_queue_invoke + 132
17 libdispatch.dylib 0x00000001986182d4 _dispatch_queue_drain + 2008
18 libdispatch.dylib 0x0000000198610a5c _dispatch_queue_invoke + 132
19 libdispatch.dylib 0x000000019861a318 _dispatch_root_queue_drain + 720
20 libdispatch.dylib 0x000000019861bc4c _dispatch_worker_thread3 + 108
21 libsystem_pthread.dylib 0x00000001987ed22c _pthread_wqthread + 816
As you can see none of my own classes is visible in the stack trace.
How can I debug this? Do these crashes appear to the user?
Thanks for your help!