realm / realm-swift

Realm is a mobile database: a replacement for Core Data & SQLite
https://realm.io
Apache License 2.0
16.31k stars 2.14k forks source link

Stuck in Bad changeset (DOWNLOAD) #7769

Closed Kalzem closed 2 years ago

Kalzem commented 2 years ago

How frequently does the bug occur?

All the time

Description

Hi,

I'm crossposting this on mongo forum as well https://www.mongodb.com/community/forums/t/stuck-in-bad-changeset-download-statuscode-112/159798.

I believe I have found an infinite loop of bad changeset (DOWNLOAD) Precise error is: related decl ‘e’ for RLMSyncError(_nsError: Error Domain=io.realm.sync Code=6 “Bad changeset (DOWNLOAD)” UserInfo={NSLocalizedDescription=Bad changeset (DOWNLOAD), statusCode=112})

I have updated Realm UI schema with a new collection. An issue happened (I received emails "A Sync process has failed and cannot be restarted") from RealmUI. And now my Realm user cannot login anymore on any other device beside my main device.

I have tried uninstalling the client, also tried deleting the schema from RealmUI and deleting the collection from Compass. My user, after login, gets the changeset error all the time.

My guess is that the iOS SDK is trying to process erroneous server instructions and it's just not possible.

Stacktrace & log output

No response

Can you reproduce the bug?

Not yet

Reproduction Steps

  1. Update schema on RealmUI (adding new collection)
  2. Activate dev mode on RealmUI
  3. Connect iOS client (let's say iPhone 11) to Realm sync (linking to the new schema - creating the collection in Atlas)
  4. Disable Dev mode => Hope for a problem - which appears to be "random" to me at least because no log details on the backend. (A Sync process has failed and cannot be restarted).
  5. Manually restart Realm sync
  6. Try to connect with the same account but on other devices => Bad changeset error after login.
  7. Delete collections completely from backend, uninstall/reinstall iOS client => Still bad changeset error after login. Account is in limbo.

Version

10.25.1

What SDK flavour are you using?

MongoDB Realm (i.e. Sync, auth, functions)

Are you using encryption?

Yes, using encryption

Platform OS and version(s)

iOS 15.3

Build environment

Xcode version: 13.3.1 Dependency manager and version: SPM

Kalzem commented 2 years ago

I contacted Mongo support. They gave me a way to get my user out of limbo: Disable dev mode if it's activated, Terminate Sync, Enable Sync. You will lose all the new data users will try to save during the sync termination though. Unfortunately, I still don't know what caused this bad changeset bug on the backend. It's a good thing that it only happened on the dev server and not prod (yet?).