-
-
Notifications
You must be signed in to change notification settings - Fork 878
Deadlock when saving objects with circular references #916
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
The following change fixed this issue for me: OLD:
NEW:
|
Also: I tried to follow the instructions for contributing, but when I forked the repo the master branch won't even compile. I was hoping to write a unit test and create a pull request but I'm not sure how to make that happen. I'm sure the master branch actually does compile, but the contributor instructions need more details for project newcomers to get started. |
@czgarrett Did you do a submodule fetch? |
Awesome find! There's a ton of 'bad' code revolving around how we deal with locks in our SDK, thanks for fixing one of them. Though I would recommend doing an explicit copy of If you don't want to go through the trouble of creating a PR yourself, I can create a PR and credit you with the fix if you'd like. Otherwise, I'll assume you're working on a PR, and am looking forward to reviewing it shortly! Also, related discussion from the past: #11 |
Sure I'll do a PR. I'd like to figure out the process because I have other ideas for enhancements as well. Chris
|
Let me or @richardjrossiii know if you need help with it. |
Hi guys, thanks for your hard work Do you have an idea when this potential fix will be committed to the master branch? Thanks |
PR created. Let me know if I did it right - this is my first time doing a PR for a forked repo. |
Any updates on this? |
Hi, any update on this issue? I am using the latest version and i still experience this issue. |
I submitted a PR last July and it was never approved. Due to this and other issues, and a general lack of progress on this SDK, I finally gave up using the local data store and wrote my own sync engine using core data. While it was a pretty large effort, it did pay off because I have a lot more control over how sync works in my app. |
@czgarrett what PR was it? |
This one (actually turns out it was May, not July): #931 |
- As per discussion over there, @nlutsenko and @richardjrossiii were A1 on the resolution Thanks @czgarrett for the fix Closes #931
- As per discussion over there, @nlutsenko and @richardjrossiii were A1 on the resolution Thanks @czgarrett for the fix Closes #931
* wip * wip * Initial refactoring of Consistency Assertion to Consistency errors - Make Tried to get invalid local id a soft error - Make Tried to save an object with a new, unsaved child. a soft error - Make Tried to save an object with a pointer to a new, unsaved object. a soft error - Make Attempted to find non-existent uuid a soft error * Soft errors for User consistency checks `_checkSaveParametersWithCurrentUser` * Bumps to latest Swift * Proper failable methods for the LocalIdStore * Adds precondition for checking if user is not merging on itself * Swallow consistency error when decoding * Base error checking on return parameters as unsafe to check error / *error * Restore behaviour for nil tranformed objects without errors * proper ARC modifier for NSError** * Transform assertions to errors in children collection * Adds PFPrecondition instead of Exception when saving cycles * Properly bail on encoding errors, add tests * nits: TODOs * Improve handling of failures for localId resolutiosn * Report missing localId as soft errors * Refactor: Rename macros in PFPreconditon, more consistency on arguments * Better error propagation in resolving localIds * More tests for failures of localId resolutions * Bump version to 1.16.1-alpha.1 * Bump podspec to 1.17.0-alpha.1 * Fix issue #916 - As per discussion over there, @nlutsenko and @richardjrossiii were A1 on the resolution Thanks @czgarrett for the fix Closes #931 * Fixes #1184 - Prevent deadlock by copying estimatedData before traversal * Adds r/w accessors in swift for the PFACL fixes #1083 * Adds CHANGELOG.md * Bumps to 1.17.0-alpha.2 * Fixes flaky test * Provide more context when asserting OfflineStore objectId assignment issues * Bolts doesnt infer failed tasks with NSError as a return type, always return failed tasks if needed * Bump to 1.17.0-alpha.3 * Releases on travis * run pod trunk push with verbose to not stall travis * Review nits * Do no track dimensions if they are nil * Bump version to 1.17.0-alpha.4 * Adds precondition to prevent crash * Fixes errors * Bumps to 1.17.0-alpha.5
It seems this has been fixed, could it be closed? - @parse-community/ios-osx |
I have two PFObject subclasses A and B. A has an array of pointers to B, and B has a pointer to A.
Sometimes my app will fire off two save operations for A in rapid succession, and this will result in a deadlock. Here's where the deadlock occurs when saving an instance of A that references two B instances:
On thread 1:
Meanwhile, on thread 2:
BAM! Classic deadlock
One thread has lock in the order A,B, and the other has locked in the order B,A
Two possible ideas for fixes:
The text was updated successfully, but these errors were encountered: