-
-
Notifications
You must be signed in to change notification settings - Fork 878
Deadlock when checking isDataAvailable and performing Query #11
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
Comments
Hey @lkraider, thanks for the report. |
Can you also please check if you are running into the same issue on the latest SDK? 1.8.0. |
Just checking with 1.8.0, still getting deadlocks where two threads try to access |
Thanks. |
Adding a new trace (3 threads deadlock):
|
This issue has not been updated for 7 days. If you have additional information to help pinpoint this issue as an SDK bug, please comment on this issue. We will close this issue in 7 days if no additional information is provided. Thank you for your feedback. |
@lkraider, thanks for the stack trace. I am marking this as needs investigation, so it won't get automatically closed. |
I am testing with that branch, I am now getting a deadlock with 100% CPU usage from a call on the main thread ending in
I am not sure where the other lock is coming from. This is from an property access in a PFObject subclass, example calling code in AppDelegate: assertMainThread();
[[Crashlytics sharedInstance] setUserIdentifier:[UserManager sharedInstance].user.objectId];
[[Crashlytics sharedInstance] setUserName:[UserManager sharedInstance].user.name];
[[Crashlytics sharedInstance] setUserEmail:[UserManager sharedInstance].user.email]; // <-- deadlock here Deadlock happens in the last line. |
Deadlock usually involves more than a single thread, a chance you can attach stack trace for all of them? |
Created another situation, the full stack trace is here: Branch is |
This doesn't seem to be related at all to deadlocks, but rather as @richardjrossiii pointed out to #129 that was landed on master. |
The master version got rid of the atomic spinlock problem, here is a backtrace of the deadlock I am getting now which is again a 3 thread deadlock: This is using the local storage for queries also. |
@lkraider Thanks for the awesome stack-trace! If this happens again, can we also get the stack-trace emitted by doing |
Here is one with the I could find the same object on two threads. |
I updated the gist, it seems the lock orders are like this: And somehow this causes the deadlock of one cycle waiting for the other. |
Thanks for the super awesome backtrace. One more request, if you would oblige me. I have created a new branch richardross.synchronized.deadlock, which includes @nlutsenko's mutable container patch, which will add every time we use This should make it really easy to see which objects are being locked from where. |
It seems something broke in this branch, I am not getting any PFQuery results for Both NSArray and NSError are I am getting in the logs when calling
Any idea why PFQuery would be broken? |
I'm also running into the same problem, any updates on this issue? |
I want to bump the priority of this. We are also experiencing a deadlock in our app which is an absolutely showstopper for being able to ship. I'm not 100% sure if it's the same issue as this (I don't see isDataAvailable called in the stack trace), but I'm attaching it to this task, and am pasting the full backtrace below. I want to again emphasize what a massive problem this is. Deadlock is actually even worse than a crash in terms of user experience, and is absolutely breaking for our app. We will need to switch to another framework than Parse (despite the expensive switching cost) if this cannot be resolved. |
Here is the full backtrace: (lldb) bt all * thread #1: tid = 0xa07aae, 0x000000010f4df166 libsystem_kernel.dylib`__psynch_mutexwait + 10, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP * frame #0: 0x000000010f4df166 libsystem_kernel.dylib`__psynch_mutexwait + 10 frame #1: 0x000000010f50e78a libsystem_pthread.dylib`_pthread_mutex_lock + 480 frame #2: 0x000000010aaf0f98 Breakaway`-[PFObject objectForKey:](self=0x00007f8e5cd3da50, _cmd=, key=) + 57 at PFObject.m:2555 frame #3: 0x000000010aaf4736 Breakaway`__34+[PFObject resolveInstanceMethod:]_block_invoke1160(.block_descriptor=0x00007f8e5cd527c0, self=) + 39 at PFObject.m:2844 frame #4: 0x000000010a923818 Breakaway`Breakaway.MissionViewDescriptionCell.configureCellForMissionController (missionController=0x00007f8e5a5608d0, self=0x00007f8e5f76b230)(Breakaway.MissionViewController) -> Breakaway.MissionViewDescriptionCell + 200 at MissionViewDescriptionCell.swift:29 frame #5: 0x000000010a881bc8 Breakaway`Breakaway.MissionViewController.tableView (tableView=0x00007f8e5a8b8800, indexPath=0x00007f8e5a5f3130, self=0x00007f8e5a5608d0)(ObjectiveC.UITableView, cellForRowAtIndexPath : ObjectiveC.NSIndexPath) -> ObjectiveC.UITableViewCell + 376 at MissionViewController.swift:660 frame #6: 0x000000010a8822df Breakaway`@objc Breakaway.MissionViewController.tableView (Breakaway.MissionViewController)(ObjectiveC.UITableView, cellForRowAtIndexPath : ObjectiveC.NSIndexPath) -> ObjectiveC.UITableViewCell + 79 at MissionViewController.swift:0 frame #7: 0x000000010a8811bf Breakaway`Breakaway.MissionViewController.tableView (tableView=0x00007f8e5a8b8800, indexPath=0x00007f8e5a5f3130, self=0x00007f8e5a5608d0)(ObjectiveC.UITableView, heightForRowAtIndexPath : ObjectiveC.NSIndexPath) -> CoreGraphics.CGFloat + 223 at MissionViewController.swift:642 frame #8: 0x000000010a881a3f Breakaway`@objc Breakaway.MissionViewController.tableView (Breakaway.MissionViewController)(ObjectiveC.UITableView, heightForRowAtIndexPath : ObjectiveC.NSIndexPath) -> CoreGraphics.CGFloat + 79 at MissionViewController.swift:0 frame #9: 0x000000010d0c52ab UIKit`__66-[UISectionRowData refreshWithSection:tableView:tableViewRowData:]_block_invoke + 302 frame #10: 0x000000010d0c493e UIKit`-[UISectionRowData refreshWithSection:tableView:tableViewRowData:] + 4125 frame #11: 0x000000010d0c7299 UIKit`-[UITableViewRowData ensureAllSectionsAreValid] + 109 frame #12: 0x000000010cf14c86 UIKit`-[UITableView _endCellAnimationsWithContext:] + 505 frame #13: 0x000000010a887b14 Breakaway`Breakaway.MissionViewController.(self=0x00007f8e5a5608d0, index=0xc000000000000096) -> (Swift.Optional) -> ()).(closure #1) + 260 at MissionViewController.swift:473 frame #14: 0x000000010a7feb97 Breakaway`reabstraction thunk helper from @callee_owned () -> (@unowned ()) to @callee_unowned @objc_block () -> (@unowned ()) + 39 at PushNotification.swift:0 frame #15: 0x000000010a8a43c3 Breakaway`reabstraction thunk helper from @callee_unowned @objc_block () -> (@unowned ()) to @callee_owned () -> (@unowned ()) + 19 at UIViewExtensions.swift:0 frame #16: 0x000000010a8a3269 Breakaway`static ext.Breakaway.ObjectiveC.UIView.suspendAnimationsForBlock (block=, self=)(() -> ()) -> () + 105 at UIViewExtensions.swift:41 frame #17: 0x000000010a8a3333 Breakaway`@objc static ext.Breakaway.ObjectiveC.UIView.suspendAnimationsForBlock (ObjectiveC.UIView.Type)(() -> ()) -> () + 115 at UIViewExtensions.swift:0 frame #18: 0x000000010a875532 Breakaway`Breakaway.MissionViewController.stepInfoUpdated (stepInfo=Some, self=0x00007f8e5a5608d0)(Swift.Optional) -> () + 4786 at MissionViewController.swift:474 frame #19: 0x000000010a87e50e Breakaway`protocol witness for Breakaway.StepEventViewDelegate.stepInfoUpdated (Breakaway.StepEventViewDelegate.Self)(Swift.Optional) -> () in conformance Breakaway.MissionViewController : Breakaway.StepEventViewDelegate in Breakaway + 110 at MissionViewController.swift:460 frame #20: 0x000000010a91d3dd Breakaway`Breakaway.StepEventView.(tappedButton=0x00007f8e5f8f6310, otherButton=0x00007f8e5f8f3630, resultIndex=Worked, self=0x00007f8e5f76f660) (Breakaway.StepEventView)(ObjectiveC.UIButton, otherButton : ObjectiveC.UIButton, resultIndex : Breakaway.StepEventResult) -> () + 6589 at StepEventView.swift:203 frame #21: 0x000000010a919ccc Breakaway`Breakaway.StepEventView.workedButtonTapped (self=0x00007f8e5f76f660)() -> () + 364 at StepEventView.swift:108 frame #22: 0x000000010a919d02 Breakaway`@objc Breakaway.StepEventView.workedButtonTapped (Breakaway.StepEventView)() -> () + 34 at StepEventView.swift:0 frame #23: 0x000000010ce3bd62 UIKit`-[UIApplication sendAction:to:from:forEvent:] + 75 frame #24: 0x000000010cf4d50a UIKit`-[UIControl _sendActionsForEvents:withEvent:] + 467 frame #25: 0x000000010cf4c8d9 UIKit`-[UIControl touchesEnded:withEvent:] + 522 frame #26: 0x000000010ce88958 UIKit`-[UIWindow _sendTouchesForEvent:] + 735 frame #27: 0x000000010ce89282 UIKit`-[UIWindow sendEvent:] + 682 frame #28: 0x000000010ce4f541 UIKit`-[UIApplication sendEvent:] + 246 frame #29: 0x000000010ce5ccdc UIKit`_UIApplicationHandleEventFromQueueEvent + 18265 frame #30: 0x000000010ce3759c UIKit`_UIApplicationHandleEventQueue + 2066 frame #31: 0x000000010c4cf431 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 frame #32: 0x000000010c4c52fd CoreFoundation`__CFRunLoopDoSources0 + 269 frame #33: 0x000000010c4c4934 CoreFoundation`__CFRunLoopRun + 868 frame #34: 0x000000010c4c4366 CoreFoundation`CFRunLoopRunSpecific + 470 frame #35: 0x000000010ec35a3e GraphicsServices`GSEventRunModal + 161 frame #36: 0x000000010ce3a8c0 UIKit`UIApplicationMain + 1282 frame #37: 0x000000010a8a1917 Breakaway`main + 135 at AppDelegate.swift:15 frame #38: 0x000000010f1d7145 libdyld.dylib`start + 1 frame #39: 0x000000010f1d7145 libdyld.dylib`start + 1 thread #2: tid = 0xa07ad7, 0x000000010f4e0232 libsystem_kernel.dylib`kevent64 + 10, queue = 'com.apple.libdispatch-manager' frame #0: 0x000000010f4e0232 libsystem_kernel.dylib`kevent64 + 10 frame #1: 0x000000010f19276c libdispatch.dylib`_dispatch_mgr_invoke + 247 frame #2: 0x000000010f192511 libdispatch.dylib`_dispatch_mgr_thread + 54 thread #4: tid = 0xa07ad9, 0x000000010f4df166 libsystem_kernel.dylib`__psynch_mutexwait + 10, queue = 'com.apple.root.default-qos' frame #0: 0x000000010f4df166 libsystem_kernel.dylib`__psynch_mutexwait + 10 frame #1: 0x000000010f50e78a libsystem_pthread.dylib`_pthread_mutex_lock + 480 frame #2: 0x000000010aaed780 Breakaway`-[PFObject state](self=0x00007f8e5cd490f0, _cmd=) + 32 at PFObject.m:2047 frame #3: 0x000000010aaeda22 Breakaway`-[PFObject objectId](self=, _cmd=) + 24 at PFObject.m:2075 frame #4: 0x000000010ab2d673 Breakaway`-[PFPointerOrLocalIdObjectEncoder encodeParseObject:](self=, _cmd=, object=0x00007f8e5cd490f0) + 65 at PFEncoder.m:144 frame #5: 0x000000010ab2cdc4 Breakaway`-[PFEncoder encodeObject:](self=, _cmd=, object=) + 113 at PFEncoder.m:35 frame #6: 0x000000010ab2d29f Breakaway`-[PFEncoder encodeObject:](self=0x00007f8e5a671ca0, _cmd=, object=) + 1356 at PFEncoder.m:86 frame #7: 0x000000010ab2bdf2 Breakaway`-[PFJSONCacheItem initWithObject:](self=, _cmd=, object=) + 126 at PFInternalUtils.m:333 frame #8: 0x000000010ab2bf70 Breakaway`+[PFJSONCacheItem cacheFromObject:](self=, _cmd=, object=) + 69 at PFInternalUtils.m:345 frame #9: 0x000000010aae5148 Breakaway`-[PFObject(self=0x00007f8e5cd4ff00, _cmd=, object=, key=) checkForChangesToMutableContainer:forKey:] + 207 at PFObject.m:916 frame #10: 0x000000010aae5414 Breakaway`__55-[PFObject(.block_descriptor=0x000000011b9e67d8, key=, obj=, stop=) checkForChangesToMutableContainers]_block_invoke + 146 at PFObject.m:935 frame #11: 0x000000010c50fcd5 CoreFoundation`__65-[__NSDictionaryI enumerateKeysAndObjectsWithOptions:usingBlock:]_block_invoke + 85 frame #12: 0x000000010c50fbec CoreFoundation`-[__NSDictionaryI enumerateKeysAndObjectsWithOptions:usingBlock:] + 236 frame #13: 0x000000010aae531b Breakaway`-[PFObject(self=, _cmd=) checkForChangesToMutableContainers] + 236 at PFObject.m:933 frame #14: 0x000000010aae4b06 Breakaway`-[PFObject(self=0x00007f8e5cd4ff00, _cmd=, considerChildren=false) isDirty:] + 65 at PFObject.m:860 frame #15: 0x000000010aae0ecd Breakaway`+[PFObject(self=, _cmd=, node=, dirtyChildren=, dirtyFiles=, seen=, seenNew=0x00007f8e5a521b00) collectDirtyChildren:children:files:seen:seenNew:] + 1422 at PFObject.m:433 frame #16: 0x000000010aae0ab2 Breakaway`+[PFObject(self=, _cmd=, node=, dirtyChildren=, dirtyFiles=, seen=, seenNew=0x00007f8e5a521b00) collectDirtyChildren:children:files:seen:seenNew:] + 371 at PFObject.m:375 frame #17: 0x000000010aae0fac Breakaway`__70+[PFObject(.block_descriptor=, key=, obj=, stop=) collectDirtyChildren:children:files:seen:seenNew:]_block_invoke + 51 at PFObject.m:384 frame #18: 0x000000010c4db656 CoreFoundation`__65-[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:]_block_invoke + 102 frame #19: 0x000000010c4db55c CoreFoundation`-[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:] + 204 frame #20: 0x000000010aae0be7 Breakaway`+[PFObject(self=, _cmd=, node=, dirtyChildren=, dirtyFiles=, seen=, seenNew=0x00007f8e5a521b00) collectDirtyChildren:children:files:seen:seenNew:] + 680 at PFObject.m:383 frame #21: 0x000000010aae0ebb Breakaway`+[PFObject(self=, _cmd=, node=, dirtyChildren=, dirtyFiles=, seen=, seenNew=0x00007f8e5a521b00) collectDirtyChildren:children:files:seen:seenNew:] + 1404 at PFObject.m:427 frame #22: 0x000000010aae0fac Breakaway`__70+[PFObject(.block_descriptor=, key=, obj=, stop=) collectDirtyChildren:children:files:seen:seenNew:]_block_invoke + 51 at PFObject.m:384 frame #23: 0x000000010c4db656 CoreFoundation`__65-[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:]_block_invoke + 102 frame #24: 0x000000010c4db55c CoreFoundation`-[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:] + 204 frame #25: 0x000000010aae0be7 Breakaway`+[PFObject(self=, _cmd=, node=, dirtyChildren=, dirtyFiles=, seen=, seenNew=0x00007f8e5a521b00) collectDirtyChildren:children:files:seen:seenNew:] + 680 at PFObject.m:383 frame #26: 0x000000010aae0ebb Breakaway`+[PFObject(self=, _cmd=, node=, dirtyChildren=, dirtyFiles=, seen=, seenNew=0x00007f8e5a521b00) collectDirtyChildren:children:files:seen:seenNew:] + 1404 at PFObject.m:427 frame #27: 0x000000010aae0fac Breakaway`__70+[PFObject(.block_descriptor=, key=, obj=, stop=) collectDirtyChildren:children:files:seen:seenNew:]_block_invoke + 51 at PFObject.m:384 frame #28: 0x000000010c4db656 CoreFoundation`__65-[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:]_block_invoke + 102 frame #29: 0x000000010c4db55c CoreFoundation`-[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:] + 204 frame #30: 0x000000010aae0be7 Breakaway`+[PFObject(self=, _cmd=, node=, dirtyChildren=, dirtyFiles=, seen=, seenNew=0x00007f8e5a521b00) collectDirtyChildren:children:files:seen:seenNew:] + 680 at PFObject.m:383 frame #31: 0x000000010aae0ebb Breakaway`+[PFObject(self=, _cmd=, node=, dirtyChildren=, dirtyFiles=, seen=, seenNew=0x00007f8e5a521b00) collectDirtyChildren:children:files:seen:seenNew:] + 1404 at PFObject.m:427 frame #32: 0x000000010aae10e6 Breakaway`+[PFObject(self=, _cmd=, child=, dirtyChildren=, dirtyFiles=) collectDirtyChildren:children:files:] + 179 at PFObject.m:451 frame #33: 0x000000010aae4324 Breakaway`__72+[PFObject(.block_descriptor=0x00007f8e5fa0ac20) _enqueueSaveEventuallyChildrenOfObject:currentUser:]_block_invoke + 142 at PFObject.m:781 frame #34: 0x000000010a95de89 Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_2(.block_descriptor=0x000000011b9e7b48) + 86 at BFTask.m:334 frame #35: 0x000000010a95f03c Breakaway`__29+[BFExecutor defaultExecutor]_block_invoke_2(.block_descriptor=, block=) + 331 at BFExecutor.m:45 frame #36: 0x000000010a95f563 Breakaway`-[BFExecutor execute:](self=, _cmd=, block=) + 65 at BFExecutor.m:109 frame #37: 0x000000010a95de09 Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke(.block_descriptor=0x00007f8e5fa15b60) + 138 at BFTask.m:326 frame #38: 0x000000010a95dc7a Breakaway`-[BFTask continueWithExecutor:block:cancellationToken:](self=, _cmd=, executor=, block=, cancellationToken=) + 311 at BFTask.m:377 frame #39: 0x000000010a95db1d Breakaway`-[BFTask continueWithExecutor:withBlock:](self=, _cmd=, executor=, block=) + 53 at BFTask.m:316 frame #40: 0x000000010a95d169 Breakaway`+[BFTask taskFromExecutor:withBlock:](self=, _cmd=, executor=, block=) + 100 at BFTask.m:173 frame #41: 0x000000010aae4253 Breakaway`+[PFObject(self=, _cmd=, object=, currentUser=) _enqueueSaveEventuallyChildrenOfObject:currentUser:] + 183 at PFObject.m:778 frame #42: 0x000000010aae7ded Breakaway`__56-[PFObject(.block_descriptor=0x00007f8e5a475130, task=) _enqueueSaveEventuallyWithChildren:]_block_invoke_2 + 242 at PFObject.m:1360 frame #43: 0x000000010a95de89 Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_2(.block_descriptor=0x00007f8e5f92e610) + 86 at BFTask.m:334 frame #44: 0x000000010f184186 libdispatch.dylib`_dispatch_call_block_and_release + 12 frame #45: 0x000000010f1a3614 libdispatch.dylib`_dispatch_client_callout + 8 frame #46: 0x000000010f18d552 libdispatch.dylib`_dispatch_root_queue_drain + 1768 frame #47: 0x000000010f18eb17 libdispatch.dylib`_dispatch_worker_thread3 + 111 frame #48: 0x000000010f510637 libsystem_pthread.dylib`_pthread_wqthread + 729 frame #49: 0x000000010f50e40d libsystem_pthread.dylib`start_wqthread + 13 thread #8: tid = 0xa07ae3, 0x000000010f4df166 libsystem_kernel.dylib`__psynch_mutexwait + 10, queue = 'com.apple.root.default-qos' frame #0: 0x000000010f4df166 libsystem_kernel.dylib`__psynch_mutexwait + 10 frame #1: 0x000000010f50e78a libsystem_pthread.dylib`_pthread_mutex_lock + 480 frame #2: 0x000000010aaed780 Breakaway`-[PFObject state](self=0x00007f8e5cd4ff00, _cmd=) + 32 at PFObject.m:2047 frame #3: 0x000000010aaeda22 Breakaway`-[PFObject objectId](self=, _cmd=) + 24 at PFObject.m:2075 frame #4: 0x000000010ab2db5f Breakaway`-[PFOfflineObjectEncoder encodeParseObject:](self=0x00007f8e5f909aa0, _cmd=, object=) + 65 at PFEncoder.m:210 frame #5: 0x000000010ab2cdc4 Breakaway`-[PFEncoder encodeObject:](self=, _cmd=, object=) + 113 at PFEncoder.m:35 frame #6: 0x000000010aae6f0d Breakaway`__71-[PFObject(.block_descriptor=0x000000011c094b40, key=, obj=, stop=) RESTDictionaryWithObjectEncoder:operationSetUUIDs:]_block_invoke + 60 at PFObject.m:1174 frame #7: 0x000000010c4db656 CoreFoundation`__65-[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:]_block_invoke + 102 frame #8: 0x000000010c4db55c CoreFoundation`-[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:] + 204 frame #9: 0x000000010aae69e4 Breakaway`-[PFObject(self=0x00007f8e5cd490f0, _cmd=, objectEncoder=, operationSetUUIDs=0x000000011c094c38) RESTDictionaryWithObjectEncoder:operationSetUUIDs:] + 404 at PFObject.m:1173 frame #10: 0x000000010aad1a48 Breakaway`__54-[PFOfflineStore saveObjectLocallyAsync:key:database:]_block_invoke255(.block_descriptor=0x00007f8e5f909150, task=) + 140 at PFOfflineStore.m:384 frame #11: 0x000000010a95e58c Breakaway`__62-[BFTask continueWithExecutor:successBlock:cancellationToken:]_block_invoke(.block_descriptor=0x00007f8e5f909660, task=) + 83 at BFTask.m:408 frame #12: 0x000000010a95de89 Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_2(.block_descriptor=0x000000011c094d68) + 86 at BFTask.m:334 frame #13: 0x000000010a95f03c Breakaway`__29+[BFExecutor defaultExecutor]_block_invoke_2(.block_descriptor=, block=) + 331 at BFExecutor.m:45 frame #14: 0x000000010a95f563 Breakaway`-[BFExecutor execute:](self=, _cmd=, block=) + 65 at BFExecutor.m:109 frame #15: 0x000000010a95de09 Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke(.block_descriptor=0x00007f8e5a48c610) + 138 at BFTask.m:326 frame #16: 0x000000010a95dc7a Breakaway`-[BFTask continueWithExecutor:block:cancellationToken:](self=, _cmd=, executor=, block=, cancellationToken=) + 311 at BFTask.m:377 frame #17: 0x000000010a95e4f8 Breakaway`-[BFTask continueWithExecutor:successBlock:cancellationToken:](self=0x00007f8e5f9094a0, _cmd=, executor=, block=, cancellationToken=) + 201 at BFTask.m:404 frame #18: 0x000000010a95e63b Breakaway`-[BFTask continueWithSuccessBlock:](self=, _cmd=, block=) + 92 at BFTask.m:414 frame #19: 0x000000010aad16bc Breakaway`-[PFOfflineStore saveObjectLocallyAsync:key:database:](self=, _cmd=, object=, key=, database=) + 656 at PFOfflineStore.m:374 frame #20: 0x000000010aad12f0 Breakaway`__63-[PFOfflineStore saveObjectLocallyAsync:withChildren:database:]_block_invoke234(.block_descriptor=0x00007f8e5f9061d0, task=) + 292 at PFOfflineStore.m:357 frame #21: 0x000000010a95e58c Breakaway`__62-[BFTask continueWithExecutor:successBlock:cancellationToken:]_block_invoke(.block_descriptor=0x00007f8e5f9061a0, task=) + 83 at BFTask.m:408 frame #22: 0x000000010a95de89 Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_2(.block_descriptor=0x000000011c095308) + 86 at BFTask.m:334 frame #23: 0x000000010a95f03c Breakaway`__29+[BFExecutor defaultExecutor]_block_invoke_2(.block_descriptor=, block=) + 331 at BFExecutor.m:45 frame #24: 0x000000010a95f563 Breakaway`-[BFExecutor execute:](self=, _cmd=, block=) + 65 at BFExecutor.m:109 frame #25: 0x000000010a95de09 Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke(.block_descriptor=0x00007f8e5f905f10) + 138 at BFTask.m:326 frame #26: 0x000000010a95dc7a Breakaway`-[BFTask continueWithExecutor:block:cancellationToken:](self=, _cmd=, executor=, block=, cancellationToken=) + 311 at BFTask.m:377 frame #27: 0x000000010a95e4f8 Breakaway`-[BFTask continueWithExecutor:successBlock:cancellationToken:](self=0x00007f8e5f905a90, _cmd=, executor=, block=, cancellationToken=) + 201 at BFTask.m:404 frame #28: 0x000000010a95e63b Breakaway`-[BFTask continueWithSuccessBlock:](self=, _cmd=, block=) + 92 at BFTask.m:414 frame #29: 0x000000010aad0ebd Breakaway`-[PFOfflineStore saveObjectLocallyAsync:withChildren:database:](self=0x00007f8e5a57ab50, _cmd=, object=, children=, database=) + 1182 at PFOfflineStore.m:338 frame #30: 0x000000010aad0958 Breakaway`-[PFOfflineStore saveObjectLocallyAsync:includeChildren:database:](self=0x00007f8e5a57ab50, _cmd=, object=, includeChildren=, database=) + 236 at PFOfflineStore.m:315 frame #31: 0x000000010a95e58c Breakaway`__62-[BFTask continueWithExecutor:successBlock:cancellationToken:]_block_invoke(.block_descriptor=0x00007f8e5fb087b0, task=) + 83 at BFTask.m:408 frame #32: 0x000000010a95de89 Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_2(.block_descriptor=0x000000011c095858) + 86 at BFTask.m:334 frame #33: 0x000000010a95f03c Breakaway`__29+[BFExecutor defaultExecutor]_block_invoke_2(.block_descriptor=, block=) + 331 at BFExecutor.m:45 frame #34: 0x000000010a95f563 Breakaway`-[BFExecutor execute:](self=, _cmd=, block=) + 65 at BFExecutor.m:109 frame #35: 0x000000010a95de09 Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke(.block_descriptor=0x00007f8e5fb2cc80) + 138 at BFTask.m:326 frame #36: 0x000000010a95dc7a Breakaway`-[BFTask continueWithExecutor:block:cancellationToken:](self=, _cmd=, executor=, block=, cancellationToken=) + 311 at BFTask.m:377 frame #37: 0x000000010a95e4f8 Breakaway`-[BFTask continueWithExecutor:successBlock:cancellationToken:](self=0x00007f8e5a67fbf0, _cmd=, executor=, block=, cancellationToken=) + 201 at BFTask.m:404 frame #38: 0x000000010a95e63b Breakaway`-[BFTask continueWithSuccessBlock:](self=, _cmd=, block=) + 92 at BFTask.m:414 frame #39: 0x000000010aad7bd0 Breakaway`__60-[PFOfflineStore _performDatabaseTransactionAsyncWithBlock:]_block_invoke(.block_descriptor=0x00007f8e5a487f60, database=) + 158 at PFOfflineStore.m:1001 frame #40: 0x000000010a95de89 Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_2(.block_descriptor=0x000000011c095b88) + 86 at BFTask.m:334 frame #41: 0x000000010a95f03c Breakaway`__29+[BFExecutor defaultExecutor]_block_invoke_2(.block_descriptor=, block=) + 331 at BFExecutor.m:45 frame #42: 0x000000010a95f563 Breakaway`-[BFExecutor execute:](self=, _cmd=, block=) + 65 at BFExecutor.m:109 frame #43: 0x000000010a95de09 Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke(.block_descriptor=0x00007f8e5f9212f0) + 138 at BFTask.m:326 frame #44: 0x000000010a95da1c Breakaway`-[BFTask runContinuations](self=0x00007f8e5f933dc0, _cmd=) + 396 at BFTask.m:306 frame #45: 0x000000010a95d2d2 Breakaway`-[BFTask trySetResult:](self=, _cmd=, result=) + 151 at BFTask.m:198 frame #46: 0x000000010a95d20d Breakaway`-[BFTask setResult:](self=, _cmd=, result=) + 17 at BFTask.m:185 frame #47: 0x000000010a956c80 Breakaway`-[BFTaskCompletionSource setResult:](self=, _cmd=, result=) + 79 at BFTaskCompletionSource.m:52 frame #48: 0x000000010a95e12b Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_3(.block_descriptor=, task=) + 285 at BFTask.m:350 frame #49: 0x000000010a95df37 Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_2(.block_descriptor=) + 260 at BFTask.m:358 frame #50: 0x000000010f184186 libdispatch.dylib`_dispatch_call_block_and_release + 12 frame #51: 0x000000010f1a3614 libdispatch.dylib`_dispatch_client_callout + 8 frame #52: 0x000000010f18d552 libdispatch.dylib`_dispatch_root_queue_drain + 1768 frame #53: 0x000000010f18eb17 libdispatch.dylib`_dispatch_worker_thread3 + 111 frame #54: 0x000000010f510637 libsystem_pthread.dylib`_pthread_wqthread + 729 frame #55: 0x000000010f50e40d libsystem_pthread.dylib`start_wqthread + 13 thread #9: tid = 0xa07ae7, 0x000000010f4da4de libsystem_kernel.dylib`mach_msg_trap + 10, name = 'com.apple.NSURLConnectionLoader' frame #0: 0x000000010f4da4de libsystem_kernel.dylib`mach_msg_trap + 10 frame #1: 0x000000010f4d964f libsystem_kernel.dylib`mach_msg + 55 frame #2: 0x000000010c4c5624 CoreFoundation`__CFRunLoopServiceMachPort + 212 frame #3: 0x000000010c4c4ad7 CoreFoundation`__CFRunLoopRun + 1287 frame #4: 0x000000010c4c4366 CoreFoundation`CFRunLoopRunSpecific + 470 frame #5: 0x000000010b659e8d CFNetwork`+[NSURLConnection(Loader) _resourceLoadLoop:] + 434 frame #6: 0x000000010c9d809d Foundation`__NSThread__main__ + 1194 frame #7: 0x000000010f510268 libsystem_pthread.dylib`_pthread_body + 131 frame #8: 0x000000010f5101e5 libsystem_pthread.dylib`_pthread_start + 176 frame #9: 0x000000010f50e41d libsystem_pthread.dylib`thread_start + 13 thread #12: tid = 0xa07af2, 0x000000010f4df94a libsystem_kernel.dylib`__workq_kernreturn + 10 frame #0: 0x000000010f4df94a libsystem_kernel.dylib`__workq_kernreturn + 10 frame #1: 0x000000010f5106c3 libsystem_pthread.dylib`_pthread_wqthread + 869 frame #2: 0x000000010f50e40d libsystem_pthread.dylib`start_wqthread + 13 thread #13: tid = 0xa07af3, 0x000000010f4df94a libsystem_kernel.dylib`__workq_kernreturn + 10 frame #0: 0x000000010f4df94a libsystem_kernel.dylib`__workq_kernreturn + 10 frame #1: 0x000000010f5106c3 libsystem_pthread.dylib`_pthread_wqthread + 869 frame #2: 0x000000010f50e40d libsystem_pthread.dylib`start_wqthread + 13 thread #16: tid = 0xa07afd, 0x000000010f4df3fa libsystem_kernel.dylib`__select + 10, name = 'com.apple.CFSocket.private' frame #0: 0x000000010f4df3fa libsystem_kernel.dylib`__select + 10 frame #1: 0x000000010c50a9ba CoreFoundation`__CFSocketManager + 730 frame #2: 0x000000010f510268 libsystem_pthread.dylib`_pthread_body + 131 frame #3: 0x000000010f5101e5 libsystem_pthread.dylib`_pthread_start + 176 frame #4: 0x000000010f50e41d libsystem_pthread.dylib`thread_start + 13 (lldb) |
Thank you for the stack trace. It definitely helps us track this down. Our current line of thinking is that this deadlock is related to our mutable containers feature, which we're looking to remove in release 1.9.0. To see if this is actually the problem, would you mind testing with our beta branch with this feature disabled? You can update your podfile as such:
If this doesn't fix it, and this deadlock is easily reproduced, would you be open to (privately) giving me a copy of your project? We're really having a hard time figuring out exactly what causes this from just the stack traces, as this is asynchronous code which is super hard to debug. Concrete code examples would help greatly. |
Thanks, Richard. Yes, I have a project which reproduces it fairly consistently. What's the best way for me to comment privately in this format, or otherwise get it to you? For testing the above, I'm unfamiliar with Podfiles, is there another easy way for me to download from this branch in pure git? |
If you have it in a private github org, you could temporarily add me as a readonly member to the organization. Otherwise, you could email it to me at To do this with 'pure git' its fairly simple, you should be able to |
By no longer holding a lock while recursing, we allow other threads who may be waiting on the current object to progress before iterating to children of the object, solving some of the deadlocks that we've seen in issues #11, #61, and #299. This does not necessarily fix the above issues, as we probably still have similar deadlocks elsewhere in the codebase. cc @grantland
I am still seeing this deadlock issue after upgrading to Parse Release 1.9.0. In my app, I can reproduce it by deleting, reinstalling the app, then signing into an existing account. The app begins to download some PFFiles for images and videos, then gets into this exact same deadlock. This is blocking our release, can someone from Parse provide an update on this issue? |
Still seeing a lot of deadlocking as well - let me know if a trace posting will help |
I am seeing deadlock with PFUser when I try the below code for the "Push Notifications: Using Advanced Targeting" section from the Parse iOS Guide. // Associate the device with a user If another thread tries to access [PFUser currentUser] while this is occurring, I get deadlock. I was able to move this part of the code to make the issue minimal, but I thought I would point out when it happens. |
I think @lkraider was right about cycle relations (ParentObject->ChildObject, ChildObject->ParentObject) |
As I understood, problems occurs when you load 2 linked objects in background simultaneously. I have relation Child<->Parent. And try to load several children in background simultaneously.
On |
Hey, I think you should read this blog post, might give ideas ;D |
@lkraider You know, I should really have a talk with that person sometime, he seems really brilliant! :) |
I'm seeing this too. Probably old news, but it isn't an issue on 1.9.1. |
@christianpbrink Just to make sure, is it a problem on the latest one (1.11.0), but wasn't in 1.9.1? Or is ultimately fixed for you? |
It was not a problem on 1.9.1 but today I tried upgrading to 1.11.0 and did I'm looking at a simple workaround where I thread all PFFile.dataAvailable On Tue, Dec 22, 2015 at 7:59 PM, Nikita Lutsenko [email protected]
|
Ok, could you open another issue for this if you can get us a repro case? I will look into it right away. |
I doubt I am going to design a case – time crunch leading up to Christmas. On Tuesday, December 22, 2015, Nikita Lutsenko [email protected]
Sent from my iPhone |
This issue is present on 1.9.1, 1.11.0, and 1.12.0 for me as well. |
It seems this issue has since been fixed, the 2018 referenced is a mistake, so I think we can close this - @parse-community/ios-osx |
While trying to
findObjectsInBackgroundWithBlock
and checkingisDataAvailable
, the following can occur:The text was updated successfully, but these errors were encountered: