Integrating changesets failed: error finding the previous history size for version 1302: client is disconnected (ProtocolErrorCode=101)

Hi, we get sync error once a week or so that impact our users. It looks like at some point Realm sync stops working and it might take some noticeable amount of time for it to start work again. I found closed topic with exact same error but there is no solution Integrating changesets failed: error finding the previous history size for version 80: client is disconnected (ProtocolErrorCode=101) - #4 by Mansoor_Omar

The errors we receive:
OtherClientError
Error:

integrating changesets failed: error finding the previous history size for version 1302: client is disconnected (ProtocolErrorCode=101)
Source:

Write originated from MongoDB
Partition:

P
Write Summary:
{
  "CompanyRealmModel": {
    "inserted": [
      "EA:NAS"
    ]
  },
  "PreviousDayPriceRealmModel": {
    "inserted": [
      "EA:NAS"
    ]
  }
}

OtherClientError
Error:

Ending session with error: integrating changesets failed: error finding the previous history size for version 1302: client is disconnected (ProtocolErrorCode=101)

Source:

Ending sync session to MongoDB

Logs:

[ "Session was active for: 157h57m48s" ]

Partition:

P

Session Metrics:

{ "uploads": 254 }

I don’t know what we can do at this point. Basically, while the sync is down any data update logic is non-functional and the service is unusable.

Hi Anton,

This error code (101) can cover a range of miscellaneous root causes.
You can find documentation for our Sync error codes linked here.

Ultimately it looks like the client is having connection issue but the reason for this can vary.

  • Have you recently terminated Sync? If so, the client need to undergo a reset. Try uninstalling client app and re-installing. Does the issue still happen?

  • Do you have Client Reset handling in your client code to account for Sync terminations? This would be beneficial to have so that the client can reset automatically when it needs to.

  • How many clients is this error appearing on? If it’s only one client it might be a network issue.

  • Have you upgraded your cluster tier recently? Going from a free tier to non-free tier will require a Sync termination.

  • Did you make any recent configuration changes in your Realm App? e.g. schema changes

  • Are you seeing a lot of “MongoEncoding” errors in Realm Logs? This would indicate that documents are not complying with the Realm Schema and as a result, those documents will be un-syncable. If you cross a certain threshold (~100k) of these un-syncable documents a Sync Terminate and restart will be required. The metadata for these documents will be stored in __realm_sync.unsynced_documents collections which you can view using Mongoshell or Compass.

If this is not a production app I would recommend the following steps in order:

  1. Reset the client which has the error
  2. Terminate sync and re-enable (client reset will be needed again).
  3. If the issue is still happening, try enabling Trace logs (iOS example) in your client which should give you more context for what is causing the error.

Regards
Manny

Hi @Mansoor_Omar and thanks for your reply. The described issue doesn’t happen between a client and a Mongo Realm. It happens between Mongo Realm and Mongo DB. It looks like sync between those two components stops working and it impacts all clients at once. Restart a client app doesn’t help and the issue itself gets fixed in several hours or so when sync restarts itself.
We can’t fix that on a client app and I don’t think it can be fixed with an additional Mongo Realm configuration of some sort but I’m open for suggestions.

hey @Anton_P I think its best to open a support ticket on this and have our sync team take a look when this occurs

Hi Anton,

Apologies, for some reason I thought the error was appearing in the client.
Please do raise a support ticket for this as Ian mentioned.

Thanks @Ian_Ward @Mansoor_Omar, will do