parse-community / Parse-SDK-iOS-OSX

The Apple SDK for Parse Platform (iOS, macOS, watchOS, tvOS)
https://parseplatform.org
Other
2.81k stars 872 forks source link

Deadlock when checking isDataAvailable and performing Query #11

Closed lkraider closed 5 years ago

lkraider commented 9 years ago

While trying to findObjectsInBackgroundWithBlock and checking isDataAvailable, the following can occur:

Main Thread:
#0  0x00000001984530c0 in __psynch_mutexwait ()
#1  0x00000001984ed494 in _pthread_mutex_lock ()
#2  0x00000001002a8f78 in -[PFObject state] at /Users/nlutsenko/src/parse/ios-client/Parse/PFObject.m:2047
#3  0x00000001002aab20 in -[PFObject isDataAvailable] at /Users/nlutsenko/src/parse/ios-client/Parse/PFObject.m:2341
...

Internal Parse NSOperationQueue Serial Thread:
#0  0x00000001984530c0 in __psynch_mutexwait ()
#1  0x00000001984ed494 in _pthread_mutex_lock ()
#2  0x00000001002a523c in -[PFObject(Private) _mergeAfterFetchWithResult:decoder:completeData:] at /Users/nlutsenko/src/parse/ios-client/Parse/PFObject.m:1587
...
#22 0x00000001002a12ac in +[PFObject(Private) _objectFromDictionary:defaultClassName:selectedKeys:] at /Users/nlutsenko/src/parse/ios-client/Parse/PFObject.m:1041
#23 0x00000001002c9724 in __78-[PFQueryController findObjectsAsyncForQueryState:withCancellationToken:user:]_block_invoke26 at /Users/nlutsenko/src/parse/ios-client/Parse/Internal/Query/Controller/PFQueryController.m:84
...
#59 0x00000001002f9db8 in -[PFTaskHTTPRequestOperation _operationDidFinish] at /Users/nlutsenko/src/parse/ios-client/Parse/Internal/HTTPRequest/PFTaskHTTPRequestOperation.m:51
#60 0x000000010028d16c in -[PFCommandNetworkOperation _operationDidFinish] at /Users/nlutsenko/src/parse/ios-client/Parse/Internal/HTTPRequest/PFCommandNetworkOperation.m:78
...
----------
Enqueued from Background Thread:
...
#3  0x00000001002de250 in -[PFRESTCommandRunner _runCommandAsync:withCancellationToken:] at /Users/nlutsenko/src/parse/ios-client/Parse/Internal/Commands/PFRESTCommandRunner.m:168
...
#7  0x00000001002c9398 in __78-[PFQueryController findObjectsAsyncForQueryState:withCancellationToken:user:]_block_invoke at /Users/nlutsenko/src/parse/ios-client/Parse/Internal/Query/Controller/PFQueryController.m:64
...
----------
Enqueued from Main Thread:
#0  0x0000000100743d50 in _dispatch_async_f_slow ()
#1  0x000000010030cf88 in -[BFExecutor execute:] at /Users/chrisp/src/ios-sdk-3/Bolts-IOS/Bolts/Common/BFExecutor.m:109
...
#19 0x00000001002bfaf8 in -[PFQuery findObjectsInBackgroundWithBlock:] at /Users/nlutsenko/src/parse/ios-client/Parse/PFQuery.m:806
nlutsenko commented 9 years ago

Hey @lkraider, thanks for the report. Stack trace is super helpful... I'll look into this one.

nlutsenko commented 9 years ago

Can you also please check if you are running into the same issue on the latest SDK? 1.8.0. There is quite a bit of things that changed since 1.7.5, specifically around these methods and how queries work.

lkraider commented 9 years ago

Just checking with 1.8.0, still getting deadlocks where two threads try to access [PFObject objectId] (in this case, one thread access local datastorage (parse.sqlite.db.queue serial thread), another loading from network (NSOperationQueue serial thread)).

nlutsenko commented 9 years ago

Thanks. Any chance you have a repro project or a code snippet for this? I've looked into the issue in the meantime and while stack trace is helpful (would be awesome to get one from 1.8.0 as well), specifically in this case it's somewhat hard to track it down, as I think it depends on the schema of your object (child objects if any, as well as fields on the object).

lkraider commented 9 years ago

Adding a new trace (3 threads deadlock):

Thread 1 Queue : com.apple.main-thread (serial)
#0  0x00000001984530c0 in __psynch_mutexwait ()
#1  0x00000001984ed494 in _pthread_mutex_lock ()
#2  0x00000001002a6198 in -[PFObject _state] ()
#3  0x00000001002a7b90 in -[PFObject isDataAvailable] ()
...

Thread 11 Queue : NSOperationQueue :: NSOperation (serial)
#0  0x00000001984530c0 in __psynch_mutexwait ()
#1  0x00000001984ed494 in _pthread_mutex_lock ()
#2  0x00000001002a6198 in -[PFObject _state] ()
#3  0x00000001002a63f8 in -[PFObject objectId] ()
#4  0x00000001002e99c8 in -[PFPointerOrLocalIdObjectEncoder encodeParseObject:] ()
...
#8  0x00000001002e7804 in +[PFJSONCacheItem cacheFromObject:] ()
...
#35 0x00000001002f4660 in __80-[PFCloudCodeController callCloudCodeFunctionAsync:withParameters:sessionToken:]_block_invoke_2 ()
...

Thread 37 Queue : com.parse.sqlite.db.queue (serial)
#0  0x00000001984530c0 in __psynch_mutexwait ()
#1  0x00000001984ed494 in _pthread_mutex_lock ()
#2  0x00000001002a6198 in -[PFObject _state] ()
#3  0x00000001002a63f8 in -[PFObject objectId] ()
#4  0x00000001002e9f30 in -[PFOfflineObjectEncoder encodeParseObject:] ()
...
#7  0x0000000100296aec in __59-[PFObjectState dictionaryRepresentationWithObjectEncoder:]_block_invoke ()
...
#10 0x0000000100296a50 in -[PFObjectState dictionaryRepresentationWithObjectEncoder:] ()
#11 0x000000010029fe90 in -[PFObject(Private) RESTDictionaryWithObjectEncoder:operationSetUUIDs:state:operationSetQueue:] ()
#12 0x000000010029fdb8 in -[PFObject(Private) RESTDictionaryWithObjectEncoder:operationSetUUIDs:] ()
#13 0x0000000100308e94 in __54-[PFOfflineStore saveObjectLocallyAsync:key:database:]_block_invoke261 ()
...
----------
Enqueued from com.parse.sqlite.db.queue (Thread 37) (serial)
...
#6  0x000000010031061c in -[PFSQLiteDatabase executeSQLAsync:withArgumentsInArray:] ()
#7  0x000000010030db50 in -[PFOfflineStore getOrCreateUUIDAsyncForObject:database:] ()
...
----------
Enqueued from com.parse.sqlite.db.queue (Thread 37) (serial)
...
#6  0x000000010031048c in -[PFSQLiteDatabase executeQueryAsync:withArgumentsInArray:] ()
#7  0x000000010030699c in -[PFOfflineStore fetchObjectLocallyAsync:database:] ()
#8  0x00000001003081ec in -[PFOfflineStore saveObjectLocallyAsync:withChildren:database:] ()
#9  0x0000000100307f84 in -[PFOfflineStore saveObjectLocallyAsync:includeChildren:database:] ()
...
----------
Enqueued from com.parse.sqlite.db.queue (Thread 37) (serial)
...
#6  0x000000010031061c in -[PFSQLiteDatabase executeSQLAsync:withArgumentsInArray:] ()
#7  0x000000010030ed64 in __60-[PFOfflineStore _performDatabaseTransactionAsyncWithBlock:]_block_invoke ()
#8  0x000000010030f064 in __58-[PFOfflineStore _performDatabaseOperationAsyncWithBlock:]_block_invoke ()
...
#16 0x00000001002ac7f4 in __56-[PFSQLiteDatabaseController openDatabaseWithNameAsync:]_block_invoke_2 ()
...
----------
Enqueued from com.apple.root.default-qos (Thread 11) (serial)
...
#6  0x000000010030f900 in -[PFSQLiteDatabase openAsync] ()
#7  0x00000001002ac65c in __56-[PFSQLiteDatabaseController openDatabaseWithNameAsync:]_block_invoke ()
...
----------
Enqueued from com.parse.asynctaskqueue.sync (Thread 35) (serial)
...
#6  0x00000001002817b8 in __28-[PFAsyncTaskQueue enqueue:]_block_invoke ()
...
----------
Enqueued from com.parse.object.pin.cache (Thread 0) (serial)
...
#1  0x000000010028171c in -[PFAsyncTaskQueue enqueue:] ()
#2  0x00000001002ac558 in -[PFSQLiteDatabaseController openDatabaseWithNameAsync:] ()
#3  0x000000010030ef74 in -[PFOfflineStore _performDatabaseOperationAsyncWithBlock:] ()
#4  0x0000000100309758 in -[PFOfflineStore findAsyncForQueryState:user:pin:isCount:] ()
#5  0x0000000100309450 in -[PFOfflineStore findAsyncForQueryState:user:pin:] ()
#6  0x00000001002e3df8 in __46-[PFPinningObjectStore fetchPinAsyncWithName:]_block_invoke_2 ()
...
#13 0x00000001002e3c84 in __46-[PFPinningObjectStore fetchPinAsyncWithName:]_block_invoke ()
...
----------
Enqueued from com.apple.main-thread (Thread 1) (serial)
...
#6  0x00000001002e3b1c in -[PFPinningObjectStore fetchPinAsyncWithName:] ()
#7  0x00000001002e4a14 in -[PFPinningObjectStore unpinAllObjectsAsyncWithPinName:] ()
#8  0x00000001002ab83c in +[PFObject unpinAllObjectsInBackgroundWithName:] ()
#9  0x00000001002ab78c in +[PFObject unpinAllObjectsInBackgroundWithName:block:] ()
...
parse-github-bot commented 9 years ago

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.

nlutsenko commented 9 years ago

@lkraider, thanks for the stack trace. I am marking this as needs investigation, so it won't get automatically closed. From the stack trace - it looks like after #102 is merged in - the problem is going to be resolved. Feel free to check out the branch attached to it and let me know if it works for you in the meantime.

lkraider commented 9 years ago

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 PFPropertyInfo:

Thread 1 Queue : com.parse.object.subclassing.data.access (serial)
#0  in OSAtomicCompareAndSwap64Barrier ()
#1  in pthread_rwlock_unlock ()
#2  in property_copyAttributeValue ()
#3  in safeStringWithPropertyAttributeValue at Parse/Internal/PropertyInfo/PFPropertyInfo.m:19
#4  in -[PFPropertyInfo initWithClass:name:associationType:] at Parse/Internal/PropertyInfo/PFPropertyInfo.m:74
#5  in -[PFPropertyInfo initWithClass:name:] at Parse/Internal/PropertyInfo/PFPropertyInfo.m:47
#6  in +[PFPropertyInfo propertyInfoWithClass:name:] at Parse/Internal/PropertyInfo/PFPropertyInfo.m:123
#7  in -[PFObjectSubclassInfo _rawPropertyInfoForSelector:] at Parse/Internal/Object/Subclassing/PFObjectSubclassInfo.m:187
#8  in __61-[PFObjectSubclassInfo forwardingMethodSignatureForSelector:]_block_invoke at Parse/Internal/Object/Subclassing/PFObjectSubclassInfo.m:126
#9  in _dispatch_client_callout ()
#10 in _dispatch_barrier_sync_f_invoke ()
#11 in -[PFObjectSubclassInfo forwardingMethodSignatureForSelector:] at Parse/Internal/Object/Subclassing/PFObjectSubclassInfo.m:120
#12 in -[PFObjectSubclassingController forwardingMethodSignatureForSelector:ofClass:] at Parse/Internal/Object/Subclassing/PFObjectSubclassingController.m:175
#13 in +[PFObject resolveInstanceMethod:] at Parse/PFObject.m:2405
#14 in _class_resolveInstanceMethod(objc_class*, objc_selector*, objc_object*) ()
#15 in lookUpImpOrForward ()
#16 in _objc_msgSend_uncached_impcache ()

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.

nlutsenko commented 9 years ago

Deadlock usually involves more than a single thread, a chance you can attach stack trace for all of them?

richardjrossiii commented 9 years ago

@lkraider Can you try with the latest master? #129 has improved the performance significantly with PFPropertyInfo.

lkraider commented 9 years ago

Created another situation, the full stack trace is here: https://gist.github.com/lkraider/4accac93b273136f0c3b

Branch is nlutsenko.containers. I will be able to try the master branch next week.

nlutsenko commented 9 years ago

This doesn't seem to be related at all to deadlocks, but rather as @richardjrossiii pointed out to #129 that was landed on master. I've just rebased that branch on the master, so it contains both removed mutable containers and the fix from today.

lkraider commented 9 years ago

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: https://gist.github.com/lkraider/c82aeff713bf375ebf05

This is using the local storage for queries also.

richardjrossiii commented 9 years ago

@lkraider Thanks for the awesome stack-trace! If this happens again, can we also get the stack-trace emitted by doing thread backtrace all in lldb? It will provide us with information on the arguments that every stack frame was called with, which will help in determining which objects are deadlocking.

lkraider commented 9 years ago

Here is one with the thread backtrace all frames: https://gist.github.com/lkraider/dece1757ab6c4cb1651d

I could find the same object on two threads.

lkraider commented 9 years ago

I updated the gist, it seems the lock orders are like this: ParentObject->ChildObject ChildObject->ParentObject

And somehow this causes the deadlock of one cycle waiting for the other.

richardjrossiii commented 9 years ago

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 @synchronized into your stack trace as well as what object it's on (when using thread backtrace all).

This should make it really easy to see which objects are being locked from where.

lkraider commented 9 years ago

It seems something broke in this branch, I am not getting any PFQuery results for findObjectsInBackgroundWithBlock while countObjectsInBackgroundWithBlock seems to work (for the same query).

Both NSArray and NSError are nil in the result block.

I am getting in the logs when calling getObjectInBackgroundWithId:

[Error]: No results matched the query. (Code: 101, Version: 1.8.2)

Any idea why PFQuery would be broken?

rudywen commented 9 years ago

I'm also running into the same problem, any updates on this issue?

rdbayer commented 9 years ago

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.

rdbayer commented 9 years ago

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)
richardjrossiii commented 9 years ago

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:

pod 'Parse', :git => 'https://github.com/ParsePlatform/Parse-SDK-iOS-OSX.git', :branch => 'nlutsenko.containers'

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.

rdbayer commented 9 years ago

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?

richardjrossiii commented 9 years ago

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 richardross@fb.com.

To do this with 'pure git' its fairly simple, you should be able to git clone the repo, git checkout nlutsenko.containers branch, follow the build instructions in the README to generate the .framework files for you.

rdbayer commented 9 years ago

Great, just sent you an email.

richardjrossiii commented 9 years ago

Hey guys, just pushed out a new branch today, richardross.collectdirtychildren.deadlock, that should fix at least one of the deadlocks that we've seen in this thread. (Thanks for the repro project, @rdbayer).

If you would like to test with that branch and see if it helps with your deadlocks, please feel free, and post stack traces if you still have deadlocks. Let's get these bugs squashed!

rdbayer commented 9 years ago

Thanks Richard! Testing on this branch, the issue happens much less frequently, but I have managed to sometimes still get it into a deadlock with some more aggressive read/write frequency. (I emailed you more details on how to reproduce it in the sample project, but for completeness will add the stack trace here too in case anyone else wants to view it)

(lldb) bt all
* thread #1: tid = 0xb97bf7, 0x000000010cb31166 libsystem_kernel.dylib`__psynch_mutexwait + 10, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x000000010cb31166 libsystem_kernel.dylib`__psynch_mutexwait + 10
    frame #1: 0x000000010caf6696 libsystem_pthread.dylib`_pthread_mutex_lock + 480
    frame #2: 0x000000010b3b090d libobjc.A.dylib`recursive_mutex_tt<false>::lock() + 9
    frame #3: 0x000000010b3b2e7b libobjc.A.dylib`objc_sync_enter + 25
    frame #4: 0x0000000107edc934 Breakaway`-[PFObject objectForKey:] + 60
    frame #5: 0x0000000107f302d1 Breakaway`-[PFObjectSubclassingController _forwardGetterInvocation:forProperty:withObject:] + 654
    frame #6: 0x0000000107f2ffa8 Breakaway`-[PFObjectSubclassingController forwardObjectInvocation:withObject:] + 200
    frame #7: 0x0000000107edea8e Breakaway`-[PFObject forwardInvocation:] + 92
    frame #8: 0x0000000109666d97 CoreFoundation`___forwarding___ + 487
    frame #9: 0x0000000109666b28 CoreFoundation`__forwarding_prep_0___ + 120
    frame #10: 0x0000000107e82758 Breakaway`Breakaway.PFUserStep.stepEventBanners.getter : Swift.Array<Swift.String>(self=0x00007fa9b8990750) + 24 at PFUserStep.swift:83
    frame #11: 0x0000000107e23989 Breakaway`Breakaway.PFUserMission.getFormattedBannerForStepEvent (stepEvent=0x00007fa9bd61cd10, userStep=0x00007fa9b8990750, self=0x00007fa9b897f600)(Breakaway.PFStepEvent, userStep : Breakaway.PFUserStep) -> Swift.String + 73 at PFUserMission.swift:86
    frame #12: 0x0000000107e678a2 Breakaway`Breakaway.StepEventView.intrinsicContentSize (self=0x00007fa9bdd319e0)() -> C.CGSize + 1730 at StepEventView.swift:76
    frame #13: 0x0000000107e8f3b0 Breakaway`Breakaway.MissionViewStepCell.heightForStep (stepInfo=Breakaway.SelectableStepInfo @ 0x00007fff57e7e4a8, indexPath=0xc000000000000216, controller=0x00007fa9bb842800, cellWidth=375, self=0x00007fa9ba9e0e00)(Breakaway.SelectableStepInfo, indexPath : ObjectiveC.NSIndexPath, controller : Breakaway.MissionViewController, cellWidth : CoreGraphics.CGFloat) -> CoreGraphics.CGFloat + 1584 at MissionViewStepCell.swift:61
    frame #14: 0x0000000107de58c9 Breakaway`Breakaway.MissionViewController.tableView (tableView=0x00007fa9b90aa400, indexPath=0xc000000000000216, self=0x00007fa9bb842800)(ObjectiveC.UITableView, heightForRowAtIndexPath : ObjectiveC.NSIndexPath) -> CoreGraphics.CGFloat + 953 at MissionViewController.swift:639
    frame #15: 0x0000000107de5d8f Breakaway`@objc Breakaway.MissionViewController.tableView (Breakaway.MissionViewController)(ObjectiveC.UITableView, heightForRowAtIndexPath : ObjectiveC.NSIndexPath) -> CoreGraphics.CGFloat + 79 at MissionViewController.swift:0
    frame #16: 0x000000010a26a993 UIKit`__66-[UISectionRowData refreshWithSection:tableView:tableViewRowData:]_block_invoke + 240
    frame #17: 0x000000010a26a023 UIKit`-[UISectionRowData refreshWithSection:tableView:tableViewRowData:] + 4876
    frame #18: 0x000000010a26cc5c UIKit`-[UITableViewRowData ensureAllSectionsAreValid] + 109
    frame #19: 0x000000010a04c47b UIKit`-[UITableView _endCellAnimationsWithContext:] + 598
    frame #20: 0x0000000107dd94e8 Breakaway`Breakaway.MissionViewController.stepInfoUpdated (stepInfo=Some, self=0x00007fa9bb842800)(Swift.Optional<Breakaway.SelectableStepInfo>) -> () + 4856 at MissionViewController.swift:470
    frame #21: 0x0000000107de2ac1 Breakaway`protocol witness for Breakaway.StepEventViewDelegate.stepInfoUpdated <A where A: Breakaway.StepEventViewDelegate> (A)(Swift.Optional<Breakaway.SelectableStepInfo>) -> () in conformance Breakaway.MissionViewController : Breakaway.StepEventViewDelegate in Breakaway + 161 at MissionViewController.swift:454
    frame #22: 0x0000000107e6c242 Breakaway`Breakaway.StepEventView.(tappedButton=0x00007fa9bd9f4fa0, otherButton=0x00007fa9bd9f24a0, resultIndex=Worked, self=0x00007fa9bd9deff0) (Breakaway.StepEventView)(ObjectiveC.UIButton, otherButton : ObjectiveC.UIButton, resultIndex : Breakaway.StepEventResult) -> () + 6210 at StepEventView.swift:203
    frame #23: 0x0000000107e68fc1 Breakaway`Breakaway.StepEventView.workedButtonTapped (self=0x00007fa9bd9deff0)() -> () + 273 at StepEventView.swift:108
    frame #24: 0x0000000107e68ff2 Breakaway`@objc Breakaway.StepEventView.workedButtonTapped (Breakaway.StepEventView)() -> () + 34 at StepEventView.swift:0
    frame #25: 0x0000000109f2f1fa UIKit`-[UIApplication sendAction:to:from:forEvent:] + 92
    frame #26: 0x000000010a093504 UIKit`-[UIControl sendAction:to:forEvent:] + 67
    frame #27: 0x000000010a0937d0 UIKit`-[UIControl _sendActionsForEvents:withEvent:] + 311
    frame #28: 0x000000010a092906 UIKit`-[UIControl touchesEnded:withEvent:] + 601
    frame #29: 0x000000010a3dfca5 UIKit`_UIGestureRecognizerUpdate + 10289
    frame #30: 0x0000000109f99592 UIKit`-[UIWindow _sendGesturesForEvent:] + 1137
    frame #31: 0x0000000109f9a681 UIKit`-[UIWindow sendEvent:] + 849
    frame #32: 0x0000000109f4c752 UIKit`-[UIApplication sendEvent:] + 263
    frame #33: 0x0000000109f27fcc UIKit`_UIApplicationHandleEventQueue + 6693
    frame #34: 0x000000010963d0a1 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    frame #35: 0x0000000109632fcc CoreFoundation`__CFRunLoopDoSources0 + 556
    frame #36: 0x0000000109632483 CoreFoundation`__CFRunLoopRun + 867
    frame #37: 0x0000000109631e98 CoreFoundation`CFRunLoopRunSpecific + 488
    frame #38: 0x000000010c25dad2 GraphicsServices`GSEventRunModal + 161
    frame #39: 0x0000000109f2d676 UIKit`UIApplicationMain + 171
    frame #40: 0x0000000107dfe8bd Breakaway`main + 109 at AppDelegate.swift:13
    frame #41: 0x000000010c7e592d libdyld.dylib`start + 1

  thread #2: tid = 0xb97c17, 0x000000010cb32232 libsystem_kernel.dylib`kevent64 + 10, queue = 'com.apple.libdispatch-manager'
    frame #0: 0x000000010cb32232 libsystem_kernel.dylib`kevent64 + 10
    frame #1: 0x000000010c79f4c8 libdispatch.dylib`_dispatch_mgr_invoke + 260
    frame #2: 0x000000010c79f262 libdispatch.dylib`_dispatch_mgr_thread + 54

  thread #6: tid = 0xb97c1f, 0x000000010cb31136 libsystem_kernel.dylib`__psynch_cvwait + 10, queue = 'com.parse.PFPinningEventuallyQueue.processing'
    frame #0: 0x000000010cb31136 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x000000010caf9560 libsystem_pthread.dylib`_pthread_cond_wait + 693
    frame #2: 0x0000000109af5ee1 Foundation`-[NSCondition wait] + 240
    frame #3: 0x0000000107ea769a Breakaway`-[BFTask waitUntilFinished] + 251
    frame #4: 0x0000000107f1b466 Breakaway`-[BFTask(Private) waitForResult:withMainThreadWarning:] + 41
    frame #5: 0x0000000107f10a40 Breakaway`-[PFEventuallyQueue _runCommandsWithRetriesCount:] + 2456
    frame #6: 0x000000010c7b049b libdispatch.dylib`_dispatch_client_callout + 8
    frame #7: 0x000000010c7a38a5 libdispatch.dylib`_dispatch_source_latch_and_call + 1750
    frame #8: 0x000000010c79e830 libdispatch.dylib`_dispatch_source_invoke + 1057
    frame #9: 0x000000010c7967fb libdispatch.dylib`_dispatch_queue_drain + 1818
    frame #10: 0x000000010c795ea9 libdispatch.dylib`_dispatch_queue_invoke + 601
    frame #11: 0x000000010c798af2 libdispatch.dylib`_dispatch_root_queue_drain + 1420
    frame #12: 0x000000010c798561 libdispatch.dylib`_dispatch_worker_thread3 + 111
    frame #13: 0x000000010caf8a9d libsystem_pthread.dylib`_pthread_wqthread + 729
    frame #14: 0x000000010caf63dd libsystem_pthread.dylib`start_wqthread + 13

  thread #7: tid = 0xb97c20, 0x000000010cb31166 libsystem_kernel.dylib`__psynch_mutexwait + 10, queue = 'com.parse.sqlite.db.queue'
    frame #0: 0x000000010cb31166 libsystem_kernel.dylib`__psynch_mutexwait + 10
    frame #1: 0x000000010caf6696 libsystem_pthread.dylib`_pthread_mutex_lock + 480
    frame #2: 0x000000010b3b090d libobjc.A.dylib`recursive_mutex_tt<false>::lock() + 9
    frame #3: 0x000000010b3b2e7b libobjc.A.dylib`objc_sync_enter + 25
    frame #4: 0x0000000107ed9abd Breakaway`-[PFObject _state] + 32
    frame #5: 0x0000000107ed9cde Breakaway`-[PFObject objectId] + 24
    frame #6: 0x0000000107f1c4e2 Breakaway`-[PFOfflineObjectEncoder encodeParseObject:] + 65
    frame #7: 0x0000000107f1b722 Breakaway`-[PFEncoder encodeObject:] + 113
    frame #8: 0x0000000107ecb849 Breakaway`__59-[PFObjectState dictionaryRepresentationWithObjectEncoder:]_block_invoke + 60
    frame #9: 0x0000000109649466 CoreFoundation`__65-[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:]_block_invoke + 102
    frame #10: 0x000000010964935a CoreFoundation`-[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:] + 202
    frame #11: 0x0000000107ecb7c4 Breakaway`-[PFObjectState dictionaryRepresentationWithObjectEncoder:] + 677
    frame #12: 0x0000000107ed3c8b Breakaway`-[PFObject(Private) RESTDictionaryWithObjectEncoder:operationSetUUIDs:state:operationSetQueue:] + 136
    frame #13: 0x0000000107ed3bb1 Breakaway`-[PFObject(Private) RESTDictionaryWithObjectEncoder:operationSetUUIDs:] + 124
    frame #14: 0x0000000107f39ebd Breakaway`__54-[PFOfflineStore saveObjectLocallyAsync:key:database:]_block_invoke261 + 139
    frame #15: 0x0000000107ea7415 Breakaway`__62-[BFTask continueWithExecutor:successBlock:cancellationToken:]_block_invoke + 83
    frame #16: 0x0000000107ea6cf5 Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_2 + 82
    frame #17: 0x0000000107ea7ea9 Breakaway`__29+[BFExecutor defaultExecutor]_block_invoke_2 + 328
    frame #18: 0x0000000107ea8391 Breakaway`-[BFExecutor execute:] + 65
    frame #19: 0x0000000107ea6c79 Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke + 138
    frame #20: 0x0000000107ea6879 Breakaway`-[BFTask runContinuations] + 396
    frame #21: 0x0000000107ea612f Breakaway`-[BFTask trySetResult:] + 151
    frame #22: 0x0000000107ea606a Breakaway`-[BFTask setResult:] + 17
    frame #23: 0x0000000107e9fc16 Breakaway`-[BFTaskCompletionSource setResult:] + 79
    frame #24: 0x0000000107ea6fae Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_3 + 306
    frame #25: 0x0000000107ea6cf5 Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_2 + 82
    frame #26: 0x0000000107ea7ea9 Breakaway`__29+[BFExecutor defaultExecutor]_block_invoke_2 + 328
    frame #27: 0x0000000107ea8391 Breakaway`-[BFExecutor execute:] + 65
    frame #28: 0x0000000107ea6c79 Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke + 138
    frame #29: 0x0000000107ea6879 Breakaway`-[BFTask runContinuations] + 396
    frame #30: 0x0000000107ea612f Breakaway`-[BFTask trySetResult:] + 151
    frame #31: 0x0000000107ea606a Breakaway`-[BFTask setResult:] + 17
    frame #32: 0x0000000107e9fc16 Breakaway`-[BFTaskCompletionSource setResult:] + 79
    frame #33: 0x0000000107f3eda0 Breakaway`__57-[PFOfflineStore getOrCreateUUIDAsyncForObject:database:]_block_invoke480 + 33
    frame #34: 0x0000000107ea7415 Breakaway`__62-[BFTask continueWithExecutor:successBlock:cancellationToken:]_block_invoke + 83
    frame #35: 0x0000000107ea6cf5 Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_2 + 82
    frame #36: 0x0000000107ea7ea9 Breakaway`__29+[BFExecutor defaultExecutor]_block_invoke_2 + 328
    frame #37: 0x0000000107ea8391 Breakaway`-[BFExecutor execute:] + 65
    frame #38: 0x0000000107ea6c79 Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke + 138
    frame #39: 0x0000000107ea6879 Breakaway`-[BFTask runContinuations] + 396
    frame #40: 0x0000000107ea612f Breakaway`-[BFTask trySetResult:] + 151
    frame #41: 0x0000000107ea606a Breakaway`-[BFTask setResult:] + 17
    frame #42: 0x0000000107e9fc16 Breakaway`-[BFTaskCompletionSource setResult:] + 79
    frame #43: 0x0000000107ea6fae Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_3 + 306
    frame #44: 0x0000000107ea6daf Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_2 + 268
    frame #45: 0x000000010c78fef9 libdispatch.dylib`_dispatch_call_block_and_release + 12
    frame #46: 0x000000010c7b049b libdispatch.dylib`_dispatch_client_callout + 8
    frame #47: 0x000000010c796988 libdispatch.dylib`_dispatch_queue_drain + 2215
    frame #48: 0x000000010c795ea9 libdispatch.dylib`_dispatch_queue_invoke + 601
    frame #49: 0x000000010c798af2 libdispatch.dylib`_dispatch_root_queue_drain + 1420
    frame #50: 0x000000010c798561 libdispatch.dylib`_dispatch_worker_thread3 + 111
    frame #51: 0x000000010caf8a9d libsystem_pthread.dylib`_pthread_wqthread + 729
    frame #52: 0x000000010caf63dd libsystem_pthread.dylib`start_wqthread + 13

  thread #8: tid = 0xb97c21, 0x000000010cb31166 libsystem_kernel.dylib`__psynch_mutexwait + 10, queue = 'com.apple.root.default-qos'
    frame #0: 0x000000010cb31166 libsystem_kernel.dylib`__psynch_mutexwait + 10
    frame #1: 0x000000010caf6696 libsystem_pthread.dylib`_pthread_mutex_lock + 480
    frame #2: 0x000000010b3b090d libobjc.A.dylib`recursive_mutex_tt<false>::lock() + 9
    frame #3: 0x000000010b3b2e7b libobjc.A.dylib`objc_sync_enter + 25
    frame #4: 0x0000000107ecf557 Breakaway`+[PFObject(Private) collectDirtyChildren:children:files:seen:seenNew:currentUser:] + 1018
    frame #5: 0x0000000107ecf2f1 Breakaway`+[PFObject(Private) collectDirtyChildren:children:files:seen:seenNew:currentUser:] + 404
    frame #6: 0x0000000107ecf873 Breakaway`__82+[PFObject(Private) collectDirtyChildren:children:files:seen:seenNew:currentUser:]_block_invoke + 57
    frame #7: 0x000000010967ddb5 CoreFoundation`__65-[__NSDictionaryI enumerateKeysAndObjectsWithOptions:usingBlock:]_block_invoke + 85
    frame #8: 0x000000010967dcbd CoreFoundation`-[__NSDictionaryI enumerateKeysAndObjectsWithOptions:usingBlock:] + 237
    frame #9: 0x0000000107ecf445 Breakaway`+[PFObject(Private) collectDirtyChildren:children:files:seen:seenNew:currentUser:] + 744
    frame #10: 0x0000000107ecf7df Breakaway`+[PFObject(Private) collectDirtyChildren:children:files:seen:seenNew:currentUser:] + 1666
    frame #11: 0x0000000107ecf873 Breakaway`__82+[PFObject(Private) collectDirtyChildren:children:files:seen:seenNew:currentUser:]_block_invoke + 57
    frame #12: 0x000000010967ddb5 CoreFoundation`__65-[__NSDictionaryI enumerateKeysAndObjectsWithOptions:usingBlock:]_block_invoke + 85
    frame #13: 0x000000010967dcbd CoreFoundation`-[__NSDictionaryI enumerateKeysAndObjectsWithOptions:usingBlock:] + 237
    frame #14: 0x0000000107ecf445 Breakaway`+[PFObject(Private) collectDirtyChildren:children:files:seen:seenNew:currentUser:] + 744
    frame #15: 0x0000000107ecf7df Breakaway`+[PFObject(Private) collectDirtyChildren:children:files:seen:seenNew:currentUser:] + 1666
    frame #16: 0x0000000107ecf9b3 Breakaway`+[PFObject(Private) collectDirtyChildren:children:files:currentUser:] + 198
    frame #17: 0x0000000107ed1ef3 Breakaway`__72+[PFObject(Private) _enqueueSaveEventuallyChildrenOfObject:currentUser:]_block_invoke + 142
    frame #18: 0x0000000107ea6cf5 Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_2 + 82
    frame #19: 0x0000000107ea7ea9 Breakaway`__29+[BFExecutor defaultExecutor]_block_invoke_2 + 328
    frame #20: 0x0000000107ea8391 Breakaway`-[BFExecutor execute:] + 65
    frame #21: 0x0000000107ea6c79 Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke + 138
    frame #22: 0x0000000107ea6adf Breakaway`-[BFTask continueWithExecutor:block:cancellationToken:] + 319
    frame #23: 0x0000000107ea697a Breakaway`-[BFTask continueWithExecutor:withBlock:] + 53
    frame #24: 0x0000000107ea5fc6 Breakaway`+[BFTask taskFromExecutor:withBlock:] + 100
    frame #25: 0x0000000107ed1e21 Breakaway`+[PFObject(Private) _enqueueSaveEventuallyChildrenOfObject:currentUser:] + 196
    frame #26: 0x0000000107ed4ec1 Breakaway`__56-[PFObject(Private) _enqueueSaveEventuallyWithChildren:]_block_invoke429 + 270
    frame #27: 0x0000000107ea7415 Breakaway`__62-[BFTask continueWithExecutor:successBlock:cancellationToken:]_block_invoke + 83
    frame #28: 0x0000000107ea6cf5 Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_2 + 82
    frame #29: 0x0000000107ea7ea9 Breakaway`__29+[BFExecutor defaultExecutor]_block_invoke_2 + 328
    frame #30: 0x0000000107ea8391 Breakaway`-[BFExecutor execute:] + 65
    frame #31: 0x0000000107ea6c79 Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke + 138
    frame #32: 0x0000000107ea6879 Breakaway`-[BFTask runContinuations] + 396
    frame #33: 0x0000000107ea612f Breakaway`-[BFTask trySetResult:] + 151
    frame #34: 0x0000000107ea606a Breakaway`-[BFTask setResult:] + 17
    frame #35: 0x0000000107e9fc16 Breakaway`-[BFTaskCompletionSource setResult:] + 79
    frame #36: 0x0000000107ea6fae Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_3 + 306
    frame #37: 0x0000000107ea6daf Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_2 + 268
    frame #38: 0x000000010c78fef9 libdispatch.dylib`_dispatch_call_block_and_release + 12
    frame #39: 0x000000010c7b049b libdispatch.dylib`_dispatch_client_callout + 8
    frame #40: 0x000000010c798c8b libdispatch.dylib`_dispatch_root_queue_drain + 1829
    frame #41: 0x000000010c798561 libdispatch.dylib`_dispatch_worker_thread3 + 111
    frame #42: 0x000000010caf8a9d libsystem_pthread.dylib`_pthread_wqthread + 729
    frame #43: 0x000000010caf63dd libsystem_pthread.dylib`start_wqthread + 13

  thread #11: tid = 0xb97c28, 0x000000010cb31166 libsystem_kernel.dylib`__psynch_mutexwait + 10, queue = 'com.apple.root.default-qos'
    frame #0: 0x000000010cb31166 libsystem_kernel.dylib`__psynch_mutexwait + 10
    frame #1: 0x000000010caf6696 libsystem_pthread.dylib`_pthread_mutex_lock + 480
    frame #2: 0x000000010b3b090d libobjc.A.dylib`recursive_mutex_tt<false>::lock() + 9
    frame #3: 0x000000010b3b2e7b libobjc.A.dylib`objc_sync_enter + 25
    frame #4: 0x0000000107ed9abd Breakaway`-[PFObject _state] + 32
    frame #5: 0x0000000107ed9cde Breakaway`-[PFObject objectId] + 24
    frame #6: 0x0000000107f1c004 Breakaway`-[PFPointerOrLocalIdObjectEncoder encodeParseObject:] + 65
    frame #7: 0x0000000107f1b722 Breakaway`-[PFEncoder encodeObject:] + 113
    frame #8: 0x0000000107f1bc41 Breakaway`-[PFEncoder encodeObject:] + 1424
    frame #9: 0x0000000107ebf893 Breakaway`-[PFSetOperation encodeWithObjectEncoder:] + 82
    frame #10: 0x0000000107f1b97f Breakaway`-[PFEncoder encodeObject:] + 718
    frame #11: 0x0000000107f1be1b Breakaway`__26-[PFEncoder encodeObject:]_block_invoke + 60
    frame #12: 0x0000000109649466 CoreFoundation`__65-[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:]_block_invoke + 102
    frame #13: 0x000000010964935a CoreFoundation`-[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:] + 202
    frame #14: 0x0000000107f1bd9a Breakaway`-[PFEncoder encodeObject:] + 1769
    frame #15: 0x0000000107ed58d7 Breakaway`-[PFObject(Private) _convertToDictionaryForSaving:withObjectEncoder:] + 204
    frame #16: 0x0000000107ed81ce Breakaway`-[PFObject(Private) _constructSaveCommandForChanges:sessionToken:objectEncoder:] + 117
    frame #17: 0x0000000107ed5094 Breakaway`__56-[PFObject(Private) _enqueueSaveEventuallyWithChildren:]_block_invoke_2432 + 225
    frame #18: 0x0000000107ea7415 Breakaway`__62-[BFTask continueWithExecutor:successBlock:cancellationToken:]_block_invoke + 83
    frame #19: 0x0000000107ea6cf5 Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_2 + 82
    frame #20: 0x0000000107ea7ea9 Breakaway`__29+[BFExecutor defaultExecutor]_block_invoke_2 + 328
    frame #21: 0x0000000107ea8391 Breakaway`-[BFExecutor execute:] + 65
    frame #22: 0x0000000107ea6c79 Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke + 138
    frame #23: 0x0000000107ea6879 Breakaway`-[BFTask runContinuations] + 396
    frame #24: 0x0000000107ea612f Breakaway`-[BFTask trySetResult:] + 151
    frame #25: 0x0000000107ea606a Breakaway`-[BFTask setResult:] + 17
    frame #26: 0x0000000107e9fc16 Breakaway`-[BFTaskCompletionSource setResult:] + 79
    frame #27: 0x0000000107ea6fae Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_3 + 306
    frame #28: 0x0000000107ea6cf5 Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_2 + 82
    frame #29: 0x0000000107ea7ea9 Breakaway`__29+[BFExecutor defaultExecutor]_block_invoke_2 + 328
    frame #30: 0x0000000107ea8391 Breakaway`-[BFExecutor execute:] + 65
    frame #31: 0x0000000107ea6c79 Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke + 138
    frame #32: 0x0000000107ea6879 Breakaway`-[BFTask runContinuations] + 396
    frame #33: 0x0000000107ea612f Breakaway`-[BFTask trySetResult:] + 151
    frame #34: 0x0000000107ea606a Breakaway`-[BFTask setResult:] + 17
    frame #35: 0x0000000107e9fc16 Breakaway`-[BFTaskCompletionSource setResult:] + 79
    frame #36: 0x0000000107ea5a93 Breakaway`__38+[BFTask taskForCompletionOfAllTasks:]_block_invoke + 992
    frame #37: 0x0000000107ea6cf5 Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_2 + 82
    frame #38: 0x0000000107ea7ea9 Breakaway`__29+[BFExecutor defaultExecutor]_block_invoke_2 + 328
    frame #39: 0x0000000107ea8391 Breakaway`-[BFExecutor execute:] + 65
    frame #40: 0x0000000107ea6c79 Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke + 138
    frame #41: 0x0000000107ea6879 Breakaway`-[BFTask runContinuations] + 396
    frame #42: 0x0000000107ea612f Breakaway`-[BFTask trySetResult:] + 151
    frame #43: 0x0000000107ea606a Breakaway`-[BFTask setResult:] + 17
    frame #44: 0x0000000107e9fc16 Breakaway`-[BFTaskCompletionSource setResult:] + 79
    frame #45: 0x0000000107ea6fae Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_3 + 306
    frame #46: 0x0000000107ea6daf Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_2 + 268
    frame #47: 0x0000000107ea7ea9 Breakaway`__29+[BFExecutor defaultExecutor]_block_invoke_2 + 328
    frame #48: 0x0000000107ea8391 Breakaway`-[BFExecutor execute:] + 65
    frame #49: 0x0000000107ea6c79 Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke + 138
    frame #50: 0x0000000107ea6879 Breakaway`-[BFTask runContinuations] + 396
    frame #51: 0x0000000107ea612f Breakaway`-[BFTask trySetResult:] + 151
    frame #52: 0x0000000107ea606a Breakaway`-[BFTask setResult:] + 17
    frame #53: 0x0000000107e9fc16 Breakaway`-[BFTaskCompletionSource setResult:] + 79
    frame #54: 0x0000000107ea6fae Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_3 + 306
    frame #55: 0x0000000107ea6daf Breakaway`__55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_2 + 268
    frame #56: 0x000000010c78fef9 libdispatch.dylib`_dispatch_call_block_and_release + 12
    frame #57: 0x000000010c7b049b libdispatch.dylib`_dispatch_client_callout + 8
    frame #58: 0x000000010c798c8b libdispatch.dylib`_dispatch_root_queue_drain + 1829
    frame #59: 0x000000010c798561 libdispatch.dylib`_dispatch_worker_thread3 + 111
    frame #60: 0x000000010caf8a9d libsystem_pthread.dylib`_pthread_wqthread + 729
    frame #61: 0x000000010caf63dd libsystem_pthread.dylib`start_wqthread + 13

  thread #9: tid = 0xb97c2a, 0x000000010cb2c4de libsystem_kernel.dylib`mach_msg_trap + 10, name = 'com.apple.NSURLConnectionLoader'
    frame #0: 0x000000010cb2c4de libsystem_kernel.dylib`mach_msg_trap + 10
    frame #1: 0x000000010cb2b64f libsystem_kernel.dylib`mach_msg + 55
    frame #2: 0x00000001096331d4 CoreFoundation`__CFRunLoopServiceMachPort + 212
    frame #3: 0x000000010963262f CoreFoundation`__CFRunLoopRun + 1295
    frame #4: 0x0000000109631e98 CoreFoundation`CFRunLoopRunSpecific + 488
    frame #5: 0x0000000108823084 CFNetwork`+[NSURLConnection(Loader) _resourceLoadLoop:] + 412
    frame #6: 0x0000000109b9736b Foundation`__NSThread__start__ + 1198
    frame #7: 0x000000010caf905a libsystem_pthread.dylib`_pthread_body + 131
    frame #8: 0x000000010caf8fd7 libsystem_pthread.dylib`_pthread_start + 176
    frame #9: 0x000000010caf63ed libsystem_pthread.dylib`thread_start + 13

  thread #10: tid = 0xb97c39, 0x000000010cb313fa libsystem_kernel.dylib`__select + 10, name = 'com.apple.CFSocket.private'
    frame #0: 0x000000010cb313fa libsystem_kernel.dylib`__select + 10
    frame #1: 0x00000001096788da CoreFoundation`__CFSocketManager + 746
    frame #2: 0x000000010caf905a libsystem_pthread.dylib`_pthread_body + 131
    frame #3: 0x000000010caf8fd7 libsystem_pthread.dylib`_pthread_start + 176
    frame #4: 0x000000010caf63ed libsystem_pthread.dylib`thread_start + 13

  thread #16: tid = 0xb9d72d, 0x000000010cb3194a libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #0: 0x000000010cb3194a libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x000000010caf8b29 libsystem_pthread.dylib`_pthread_wqthread + 869
    frame #2: 0x000000010caf63dd libsystem_pthread.dylib`start_wqthread + 13

  thread #17: tid = 0xb9d72e, 0x000000010cb3194a libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #0: 0x000000010cb3194a libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x000000010caf8b29 libsystem_pthread.dylib`_pthread_wqthread + 869
    frame #2: 0x000000010caf63dd libsystem_pthread.dylib`start_wqthread + 13

  thread #18: tid = 0xb9d72f, 0x000000010cb3194a libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #0: 0x000000010cb3194a libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x000000010caf8b29 libsystem_pthread.dylib`_pthread_wqthread + 869
    frame #2: 0x000000010caf63dd libsystem_pthread.dylib`start_wqthread + 13

  thread #19: tid = 0xb9d730, 0x000000010cb3194a libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #0: 0x000000010cb3194a libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x000000010caf8b29 libsystem_pthread.dylib`_pthread_wqthread + 869
    frame #2: 0x000000010caf63dd libsystem_pthread.dylib`start_wqthread + 13

  thread #20: tid = 0xb9d731, 0x000000010cb3194a libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #0: 0x000000010cb3194a libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x000000010caf8b29 libsystem_pthread.dylib`_pthread_wqthread + 869
    frame #2: 0x000000010caf63dd libsystem_pthread.dylib`start_wqthread + 13

  thread #21: tid = 0xb9d732, 0x000000010cb3194a libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #0: 0x000000010cb3194a libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x000000010caf8b29 libsystem_pthread.dylib`_pthread_wqthread + 869
    frame #2: 0x000000010caf63dd libsystem_pthread.dylib`start_wqthread + 13
rudywen commented 9 years ago

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?

kevflynn commented 9 years ago

Still seeing a lot of deadlocking as well - let me know if a trace posting will help

dtaitz commented 9 years ago

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 PFInstallation *installation = [PFInstallation currentInstallation]; installation[@"user"] = [PFUser currentUser]; [installation saveInBackground];

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.

al-zonke commented 9 years ago

I think @lkraider was right about cycle relations (ParentObject->ChildObject, ChildObject->ParentObject) I have deadlock time to time, but before I added cycle relation, I had no problems.

al-zonke commented 9 years ago

As I understood, problems occurs when you load 2 linked objects in background simultaneously. After loading they try to traverse through hierarchy and will block themselves.

I have relation Child<->Parent. And try to load several children in background simultaneously. Here is my call stack (same for several threads)

#0  __psynch_mutexwait
#1  _pthread_mutex_lock_wait
#2  _pthread_mutex_lock_slow
#3  recursive_mutex_tt<false>::lock()
#4  objc_sync_enter
#5  -[PFObject allKeys]
#6  +[PFInternalUtils traverseObject:usingBlock:seenObjects:]
#7  +[PFInternalUtils traverseObject:usingBlock:seenObjects:]_block_invoke
#8  -[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke ()
#9  -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] ()
#10 +[PFInternalUtils traverseObject:usingBlock:seenObjects:]
#11 +[PFInternalUtils traverseObject:usingBlock:seenObjects:]
#12 +[PFInternalUtils traverseObject:usingBlock:seenObjects:]_block_invoke161
#13 -[__NSDictionaryI enumerateKeysAndObjectsWithOptions:usingBlock:]_block_invoke ()
#14 -[__NSDictionaryI enumerateKeysAndObjectsWithOptions:usingBlock:] ()
#15 +[PFInternalUtils traverseObject:usingBlock:seenObjects:]
#16 +[PFInternalUtils traverseObject:usingBlock:]
#17 -[PFObject(Private) _collectFetchedObjects]
#18 -[PFObjectController processFetchResultAsync:forObject:]_block_invoke
#19 +[BFTask taskFromExecutor:withBlock:]_block_invoke
#20 -[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_2
#21 _dispatch_call_block_and_release
#22 _dispatch_root_queue_drain
#23 _dispatch_worker_thread3
#24 _pthread_wqthread
#25 start_wqthread

On #17 Child object (child1) locks himself and starts to traverse. On #5 it will rich other Child (child2) and try to lock it. If child2 makes same, we will have deadlock. And actually we have it :)

lkraider commented 8 years ago

Hey, I think you should read this blog post, might give ideas ;D http://blog.parse.com/learn/thread-safety-basics-on-iosos-x/

richardjrossiii commented 8 years ago

@lkraider You know, I should really have a talk with that person sometime, he seems really brilliant! :)

christianpbrink commented 8 years ago

I'm seeing this too. Probably old news, but it isn't an issue on 1.9.1.

nlutsenko commented 8 years ago

@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?

christianpbrink commented 8 years ago

It was not a problem on 1.9.1 but today I tried upgrading to 1.11.0 and did a double-take when our app kept freezing soon after startup. I downgraded to 1.10.0 and it's a problem there too.

I'm looking at a simple workaround where I thread all PFFile.dataAvailable calls through a serial queue and cache the results in a thread-safe object. Assuming this PFFile.dataAvailable thing is the only source of deadlocks, I think the work won't be too bad.

On Tue, Dec 22, 2015 at 7:59 PM, Nikita Lutsenko notifications@github.com wrote:

@christianpbrink https://github.com/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?

— Reply to this email directly or view it on GitHub https://github.com/ParsePlatform/Parse-SDK-iOS-OSX/issues/11#issuecomment-166770743 .

nlutsenko commented 8 years ago

Ok, could you open another issue for this if you can get us a repro case? I will look into it right away.

christianpbrink commented 8 years ago

I doubt I am going to design a case – time crunch leading up to Christmas. Sorry.

On Tuesday, December 22, 2015, Nikita Lutsenko notifications@github.com wrote:

Ok, could you open another issue for this if you can get us a repro case? I will look into it right away.

— Reply to this email directly or view it on GitHub https://github.com/ParsePlatform/Parse-SDK-iOS-OSX/issues/11#issuecomment-166771061 .

Sent from my iPhone

Lyricalpanda commented 8 years ago

This issue is present on 1.9.1, 1.11.0, and 1.12.0 for me as well.

TomWFox commented 5 years ago

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