Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deadlock in RKManagedObjectContextChangeMergingObserver #2084

Open
pablobfs opened this issue Nov 11, 2014 · 0 comments
Open

Deadlock in RKManagedObjectContextChangeMergingObserver #2084

pablobfs opened this issue Nov 11, 2014 · 0 comments

Comments

@pablobfs
Copy link

Hi,

I'm experiencing a deadlock in [RKManagedObjectContextChangeMergingObserver handleManagedObjectContextDidSaveNotification]in RestKit 0.23.3, I'm making a managed object request with [RKObjectManager getObjectsAtPath:parameters:success:failure:].

The managed object context is setup by RKManagedObjectStore and it's only being used from the main thread.

I'm attaching the full stack trace below, please let me know if you need more information.

Thread 1Queue : com.apple.main-thread (serial)
#0  0x04bdca6a in semaphore_wait_trap ()
#1  0x0489e4bf in _dispatch_thread_semaphore_wait ()
#2  0x04897e4b in _dispatch_barrier_sync_f_slow ()
#3  0x04897c28 in dispatch_barrier_sync_f ()
#4  0x0104e830 in _perform ()
#5  0x0104f369 in -[NSManagedObjectContext(_NestedContextSupport) newValuesForObjectWithID:withContext:error:] ()
#6  0x010cb662 in -[NSManagedObjectContext _mergeRefreshObject:mergeChanges:withPersistentSnapshot:] ()
#7  0x010407af in -[NSManagedObjectContext _mergeChangesFromDidSaveDictionary:usingObjectIDs:] ()
#8  0x0103fd40 in -[NSManagedObjectContext mergeChangesFromContextDidSaveNotification:] ()
#9  0x00214171 in __93-[RKManagedObjectContextChangeMergingObserver handleManagedObjectContextDidSaveNotification:]_block_invoke at /Users/irodrigo/dev/agrisite/AgriScout-iOS/Pods/RestKit/Code/CoreData/RKManagedObjectStore.m:106
#10 0x0104e454 in developerSubmittedBlockToNSManagedObjectContextPerform ()
#11 0x048b3e2f in _dispatch_client_callout ()
#12 0x0489a90e in _dispatch_main_queue_callback_4CF ()
#13 0x03cf095e in __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ ()
#14 0x03caf760 in __CFRunLoopRun ()
#15 0x03caebcb in CFRunLoopRunSpecific ()
#16 0x03cae9fb in CFRunLoopRunInMode ()
#17 0x05f4524f in GSEventRunModal ()
#18 0x05f4508c in GSEventRun ()
#19 0x01a768b6 in UIApplicationMain ()
#20 0x0000824d in main at /Users/irodrigo/dev/agrisite/AgriScout-iOS/AgriScout/main.m:16
#21 0x048dfac9 in start ()
Enqueued from NSManagedObjectContext 0x7b7bb810 (Thread 86)Queue : NSManagedObjectContext 0x7b7bb810 (serial)
#0  0x048b5603 in _dispatch_introspection_queue_item_enqueue ()
#1  0x0489d67a in _dispatch_barrier_async_f_slow ()
#2  0x048969d7 in _dispatch_barrier_async_f ()
#3  0x04895085 in dispatch_async_f ()
#4  0x010cc1e6 in -[NSManagedObjectContext performBlock:] ()
#5  0x00213fa3 in -[RKManagedObjectContextChangeMergingObserver handleManagedObjectContextDidSaveNotification:] at /Users/irodrigo/dev/agrisite/AgriScout-iOS/Pods/RestKit/Code/CoreData/RKManagedObjectStore.m:105
#6  0x037e4c49 in __57-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke ()
#7  0x03d614a4 in __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ ()
#8  0x03c4f03b in _CFXNotificationPost ()
#9  0x037d4246 in -[NSNotificationCenter postNotificationName:object:userInfo:] ()
#10 0x0103eb19 in -[NSManagedObjectContext(_NSInternalAdditions) _didSaveChanges] ()
#11 0x0102e52f in -[NSManagedObjectContext save:] ()
#12 0x0020e17f in __70-[RKManagedObjectRequestOperation saveContextToPersistentStore:error:]_block_invoke at /Users/irodrigo/dev/agrisite/AgriScout-iOS/Pods/RestKit/Code/Network/RKManagedObjectRequestOperation.m:769
#13 0x0104e454 in developerSubmittedBlockToNSManagedObjectContextPerform ()
#14 0x048b3e2f in _dispatch_client_callout ()
#15 0x04898505 in _dispatch_barrier_sync_f_invoke ()
#16 0x04897c37 in dispatch_barrier_sync_f ()
#17 0x0104e32a in -[NSManagedObjectContext performBlockAndWait:] ()
#18 0x0020dd1d in -[RKManagedObjectRequestOperation saveContextToPersistentStore:error:] at /Users/irodrigo/dev/agrisite/AgriScout-iOS/Pods/RestKit/Code/Network/RKManagedObjectRequestOperation.m:767
#19 0x0020e581 in -[RKManagedObjectRequestOperation saveContext:error:] at /Users/irodrigo/dev/agrisite/AgriScout-iOS/Pods/RestKit/Code/Network/RKManagedObjectRequestOperation.m:797
#20 0x0020f259 in -[RKManagedObjectRequestOperation saveContext:] at /Users/irodrigo/dev/agrisite/AgriScout-iOS/Pods/RestKit/Code/Network/RKManagedObjectRequestOperation.m:832
#21 0x0020a513 in __79-[RKManagedObjectRequestOperation performMappingOnResponseWithCompletionBlock:]_block_invoke356 at /Users/irodrigo/dev/agrisite/AgriScout-iOS/Pods/RestKit/Code/Network/RKManagedObjectRequestOperation.m:632
#22 0x0026eea2 in -[RKResponseMapperOperation willFinish] at /Users/irodrigo/dev/agrisite/AgriScout-iOS/Pods/RestKit/Code/Network/RKResponseMapperOperation.m:283
#23 0x0026ff2f in -[RKResponseMapperOperation main] at /Users/irodrigo/dev/agrisite/AgriScout-iOS/Pods/RestKit/Code/Network/RKResponseMapperOperation.m:369
#24 0x037d9567 in -[__NSOperationInternal _start:] ()
#25 0x037d9299 in -[NSOperation start] ()
#26 0x037d90e3 in __NSOQSchedule_f ()
#27 0x048b3e2f in _dispatch_client_callout ()
#28 0x04899afc in _dispatch_queue_drain ()
#29 0x048993c3 in _dispatch_queue_invoke ()
#30 0x0489c067 in _dispatch_root_queue_drain ()
#31 0x0489d84a in _dispatch_worker_thread3 ()
#32 0x04c0f296 in _pthread_wqthread ()
#33 0x04c0ceea in start_wqthread ()
Enqueued from org.restkit.network.object-request-operation-queue (Thread 81)Queue : org.restkit.network.object-request-operation-queue (serial)
#0  0x048b5603 in _dispatch_introspection_queue_item_enqueue ()
#1  0x04896a05 in _dispatch_barrier_async_f ()
#2  0x04895085 in dispatch_async_f ()
#3  0x037d8f24 in __NSOQSchedule ()
#4  0x037d8615 in __addOperations ()
#5  0x037d7eac in -[NSOperationQueue addOperation:] ()
#6  0x002095fa in -[RKManagedObjectRequestOperation performMappingOnResponseWithCompletionBlock:] at /Users/irodrigo/dev/agrisite/AgriScout-iOS/Pods/RestKit/Code/Network/RKManagedObjectRequestOperation.m:647
#7  0x00251f7f in __35-[RKObjectRequestOperation execute]_block_invoke at /Users/irodrigo/dev/agrisite/AgriScout-iOS/Pods/RestKit/Code/Network/RKObjectRequestOperation.m:510
#8  0x001837c3 in __64-[AFHTTPRequestOperation setCompletionBlockWithSuccess:failure:]_block_invoke143 at /Users/irodrigo/dev/agrisite/AgriScout-iOS/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.m:283
#9  0x0489330a in _dispatch_call_block_and_release ()
#10 0x048b3e2f in _dispatch_client_callout ()
#11 0x04896d2b in _dispatch_async_redirect_invoke ()
#12 0x048b3e2f in _dispatch_client_callout ()
#13 0x0489c10f in _dispatch_root_queue_drain ()
#14 0x0489d84a in _dispatch_worker_thread3 ()
#15 0x04c0f296 in _pthread_wqthread ()
#16 0x04c0ceea in start_wqthread ()
Enqueued from com.apple.root.user-initiated-qos (Thread 79)Queue : com.apple.root.user-initiated-qos (concurrent)
#0  0x048b5603 in _dispatch_introspection_queue_item_enqueue ()
#1  0x0489b73b in _dispatch_async_f_redirect ()
#2  0x0489d1b9 in _dispatch_async_f2 ()
#3  0x048971f3 in dispatch_async ()
#4  0x001835ad in __64-[AFHTTPRequestOperation setCompletionBlockWithSuccess:failure:]_block_invoke at /Users/irodrigo/dev/agrisite/AgriScout-iOS/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.m:282
#5  0x0018da4c in __47-[AFURLConnectionOperation setCompletionBlock:]_block_invoke at /Users/irodrigo/dev/agrisite/AgriScout-iOS/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.m:321
#6  0x038d2c1b in __103+[__NSOperationInternal _observeValueForKeyPath:ofObject:changeKind:oldValue:newValue:indexes:context:]_block_invoke123 ()
#7  0x0489330a in _dispatch_call_block_and_release ()
#8  0x048b3e2f in _dispatch_client_callout ()
#9  0x0489c10f in _dispatch_root_queue_drain ()
#10 0x0489d84a in _dispatch_worker_thread3 ()
#11 0x04c0f296 in _pthread_wqthread ()
#12 0x04c0ceea in start_wqthread ()
Enqueued from com.apple.root.default-qos.overcommit (Thread 18)Queue : com.apple.root.default-qos.overcommit (serial)
#0  0x048b5603 in _dispatch_introspection_queue_item_enqueue ()
#1  0x0489d426 in _dispatch_async_f_slow ()
#2  0x048971d4 in dispatch_async ()
#3  0x037db2d7 in +[__NSOperationInternal _observeValueForKeyPath:ofObject:changeKind:oldValue:newValue:indexes:context:] ()
#4  0x037dac85 in NSKeyValueNotifyObserver ()
#5  0x037d9e30 in NSKeyValueDidChange ()
#6  0x037deb85 in -[NSObject(NSKeyValueObserverNotification) didChangeValueForKey:] ()
#7  0x0018e897 in -[AFURLConnectionOperation setState:] at /Users/irodrigo/dev/agrisite/AgriScout-iOS/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.m:419
#8  0x00190147 in -[AFURLConnectionOperation finish] at /Users/irodrigo/dev/agrisite/AgriScout-iOS/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.m:547
#9  0x00192ebc in -[AFURLConnectionOperation connectionDidFinishLoading:] at /Users/irodrigo/dev/agrisite/AgriScout-iOS/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.m:772
#10 0x00d74d29 in ___ZL32_NSURLConnectionDidFinishLoadingP16_CFURLConnectionPKv_block_invoke ()
#11 0x00d8c879 in __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke ()
#12 0x00d73dd9 in -[NSURLConnectionInternalConnection invokeForDelegate:] ()
#13 0x00d8c813 in -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] ()
#14 0x00d8c9c6 in -[NSURLConnectionInternal _withActiveConnectionAndDelegate:] ()
#15 0x00d733d0 in _NSURLConnectionDidFinishLoading(_CFURLConnection*, void const*) ()
#16 0x00c3de65 in ___ZN27URLConnectionClient_Classic26_delegate_didFinishLoadingEU13block_pointerFvvE_block_invoke ()
#17 0x00d1cc5d in ___ZN27URLConnectionClient_Classic18_withDelegateAsyncEPKcU13block_pointerFvP16_CFURLConnectionPK33CFURLConnectionClientCurrent_VMaxE_block_invoke_2 ()
#18 0x00c286bc in RunloopBlockContext::_invoke_block(void const*, void*) ()
#19 0x03c8b3d9 in CFArrayApplyFunction ()
#20 0x00c2857d in RunloopBlockContext::perform() ()
#21 0x00d7ddc6 in non-virtual thunk to RunloopBlockContext::multiplexerClientPerform() ()
#22 0x00c283c0 in MultiplexerSource::perform() ()
#23 0x00c281dc in MultiplexerSource::_perform(void*) ()
#24 0x03cba1df in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
#25 0x03cafced in __CFRunLoopDoSources0 ()
#26 0x03caf248 in __CFRunLoopRun ()
#27 0x03caebcb in CFRunLoopRunSpecific ()
#28 0x03cae9fb in CFRunLoopRunInMode ()
#29 0x0383dd98 in -[NSRunLoop(NSRunLoop) runMode:beforeDate:] ()
#30 0x038dd67b in -[NSRunLoop(NSRunLoop) run] ()
#31 0x0018bfdb in +[AFURLConnectionOperation networkRequestThreadEntryPoint:] at /Users/irodrigo/dev/agrisite/AgriScout-iOS/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.m:189
#32 0x0383bf07 in -[NSThread main] ()
#33 0x0383be60 in __NSThread__main__ ()
#34 0x04c0eecf in _pthread_body ()
#35 0x04c0ee45 in _pthread_start ()
#36 0x04c0cf0e in thread_start ()

Thanks,
Ignacio

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant