-
Notifications
You must be signed in to change notification settings - Fork 165
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
RealmSwift.List order not in sync on different clients #6191
Comments
➤ Jonathan Reams commented: Sorry for the late response, between the holidays and a bunch of work coming back from the holidays I only got to this recently. I tried to reproduce this in a C integration test in realm core and came up with the below test case, which I think does all the reproduction steps. This test case actually reproduced the issue until I added
|
Refreshing the realm unfortunately doesn't help. No restart of the app either - only when the app is deleted and reinstalled, is the data correct again. I am sending you the Xcode logs containing the realm log messages from a session where a user just goes offline and moves the list items (while another user does the same online), and goes online again - the order of the lists is different for both users and will remain so. If one of the users then changes the list order, on the others users device it changes the element in the same place (but it is and remains the wrong element) |
➤ Jonathan Reams commented: I think I may have reproduced this, but I'm still trying to figure out exactly what's going on in this repro case. I'll update here when I know more. |
I don't think Sync or Core has ever guaranteed the unsorted list order to be consistent across different devices. In order for list order to be consistent you must apply the same sort method - are you sorting the same way across both devices? |
Lists do guarantee that they are in the order you set them in. |
Is there any update regarding this problem? |
@divan84 I took over from Jonathan and I am investigating it. |
About the logfile: it reflects the state when the client that was offline went back online again (couldn't log the whole session in Xcode because it aborts as soon as you go offline) - see comment above. It seems that the error is always there when you implement the simple data scheme from above. We can invite you to our test repo that reliably reproduces the issue if it helps. Do I understand correctly that @jbreams was already able to reproduce the issue? |
@divan84 Yes, we can reproduce it so no need for a new logfile. We'll keep you posted once we found the issue. |
@divan84 We identified the issue and have a fix for it. |
I tested the behavior of the realm list again with the current Realm Swift version, but the problem persists. You can still reproduce the error with the originally described test scenario |
@divan84 I think we correctly identified the original issue, but to confirm whether it's the same or a new one, do you have new logs (ideally at debug level)? |
Here are the log files from a device that was always online and from one that was online and offline at the same time: |
@danieltabacaru - Could the log files help to identify the problem? |
@divan84 I didn't get the chance to have a look, will do it this week and let you know what we find. |
@divan84 I am still investigating the logs, it takes longer than expected. |
@danieltabacaru - Any news regarding the problem? |
@divan84 Sorry for the delay, we are working on a repro case. |
@danieltabacaru - Any updates? |
No luck so far. I have a test which replays the same set of instructions from both users, but the lists are the same at the end of the test. The conflict resolution algorithm yields different results in my test though, so that's what I'm investigating now. |
@danieltabacaru: We still face the problem with the wrong order of lists on the clients... |
@divan84 I am back from vacation and looking into it again. It's not clear what's causing the issue, but our theory is that it involves the conflict resolution algorithm. The log files you attached have a lot of user changes so it's hard to pinpoint which sequence of instructions is the culprit. It seems you can still repro it, so if you can do it with less user changes, please send the log files. |
➤ danieltabacaru commented: Moving to backlog for now. |
How frequently does the bug occur?
All the time
Description
We found the following problem with conflict resolution in
RealmSwift.List
: When changing the list order on several devices of which some are online and some are offline, the list order will stay different on the devices even after they were re-synced and are all back online.We would expect the list order to be the same on all devices after sync. Right now, only if the app is deleted and reinstalled the order is the same again.
Stacktrace & log output
No response
Can you reproduce the bug?
Yes, always
Reproduction Steps
Result
The list order on both devices is different and will stay so until the app is deleted and reinstalled.
Version
Realm 10.33.0, RealmDatabase 12.13.0
What SDK flavour are you using?
MongoDB Realm (i.e. Sync, auth, functions)
Are you using encryption?
No, not using encryption
Platform OS and version(s)
iOS 16.1, macOS 13.0
Build environment
Xcode version: 14.2
Dependency manager and version: SPM
The text was updated successfully, but these errors were encountered: