-
Notifications
You must be signed in to change notification settings - Fork 43
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
Certain relationships fail to resolve when initially downloading entire data set #250
Comments
@jamesmoschou hi there James!, Would you please verify if you've got the patches pushed in these issues?. There were a couple glitches in the index-batch-processing logic that caused buckets not being processed in batch, plus, the logic to hit the index finished processing was flawed, and the delegate chain was getting called before the right time.
Thanks! Update: After checking + rechecking the flows, the commits for 238 + 239 should minimize the occurrence rate of this bug. But i'm not quite sure if they would completely fix it, i'll be debugging this! |
@jleandroperez Hi Jorge, Yes, I've merged in those updates to our branch. It seemed to improve the situation, but not fix it completely. Let me know if you need anything else from us, cheers! |
@jamesmoschou hi there James! May i ask you if the object that's causing you issues has a bidirectional relationship? (or it just doesn't have the inverse set?). Thanks! |
@jleandroperez Hi Jorge It's a to-many relationship A -->> B where it's receiving B and trying to resolve the relationship back to A before receiving A. |
@jamesmoschou thanks James! I've sent, yesterday, this pull request If / whenever possible, would you please confirm if the problem is gone?. The PR isn't 100% ready yet: i'll be adding a stress test to trigger the NIL glitch, and some things will probably change. But the raw idea is to prevent any race conditions between Root / Child order of insertion (+ any weird threading issues). Thanks! |
Hi @jleandroperez, What's the status of this bug/pull request? I hit this bug pretty regularly and don't want to ship my app with this bug. Should I also test your pull request or do you have some changes in the works? Thanks! |
@CapoChino hey there!. No new progress on this bug, for now. We'll be addressing this one very shortly (for the time being, the only fix is the pull request mentioned above!). I'll make sure to keep you posted, thank you! |
Hi @jleandroperez, I've done some testing with the issues/250-null-relationships branch. It seemed to fix the immediate problem in this bug. My database in the cloud downloaded fully and correctly to a clean device. However, I'm having a couple problems, which might relate to changes in this branch. Problem 1) When downloading is happening, it's possible that the user creates some changes to the db. If an object is changed during syncing, it sometimes ends up with some of the relationships set to nil. The setting of the relationships to nil is registered as a change by the server, suggesting the faulty change is being generated by the client. Perhaps this is the SPRelationshipResolver getting confused by having both incoming (remote) and local changes? Problem 2) When I'm creating then removing objects, I get the following errors: 2014-07-19 18:05:34.157 RaceTrace[90486:8e2b] Simperium Received Error [The operation couldn’t be completed. (SPChangeProcessor error 2.)] for object with key [8505db5512cf410787f52bb307ff0c8e] then 2014-07-19 18:05:34.235 RaceTrace[90486:8a0b] Simperium warning: couldn't apply change due to version mismatch (duplicate? start 33, old 0): change { and finally: 2014-07-19 18:05:34.355 RaceTrace[90486:5b43] *** Terminating app due to uncaught exception 'NSObjectInaccessibleException', reason: 'CoreData could not fulfill a fault for '0xb6ee810 x-coredata://DDBE7885-F897-4F06-8239-77EB50FE3B2E/MyEntity/p547'' Perhaps the incoming deletion change (or another change after it) is trying to fault in the object that's already been locally removed? I found this "TODO" in SPChangeProcessor.m to be very suspicious:
|
Hello @CapoChino, Thanks for testing the branch!. Few questions/comments below.
Again, many thanks in advance!! |
Issue #250: Implements Bidirectional RelationshipResolver
@CapoChino hey there! Relationships Resolver branch was just merged into develop. If you're still seeing nil relationships after the initial dataset sync, please, feel free to reopen. As for the rest of the glitches you've mentioned, likewise, if after this merge you still see any of them, please, feel free to open a new issues, as required. We'd be more than happy to help you out! Thank you! |
I have managed to reproduce this with a data set and a known from/to object pair.
So far I have narrowed this down to a a condition in SPRelationshipResolver.m line 170, where
fromObject
is nil somehow. If I examine the logs up to this point it I can see the expected from object in question being inserted into the managed object context, before the missing relationship is resolved.I think it has to do with the fact that the relationships are resolved per batch, and each batch uses a different thread safe child context (?), and all the dispatch_async calls causing out-of-order behaviour. Maybe by the time the relationship tries to resolve the previous batch hasn't completed saving the newly inserted object into the persistent store coordinator??
I have various logs, but they're lengthy ...
The text was updated successfully, but these errors were encountered: