Realm Sync app freezes after period of inactivity when Atlas DB has changed since last active

I am faced with a strange issue whereby the UI of my react native app (which uses Realm Sync) freezes when coming back to it after some time of inactivity. I can scroll up and down the screen but the buttons are non-responsive. If I hard close the app and open it again, the problem persists which is the strangest thing about this issue! The only work around at the moment is to clear app data in the phone settings. This logs the user out and they have to log back in and can then use the app normally again.

Some possible pistes for investigation:

  • The issue seems to appear more when the data has been changed by other users in combination with the period of inactivity.
  • This didn’t seem to happen on simulators but occurs regularly on actual devices (only on Android phones it appears). Although it could be because I was making changes to the DB from the simulator device itself, with no other users making changes while the simulator was inactive for a long time.
  • I’ve only seen this issue on Android devices so far.

I’m not sure what’s causing the issue. The fact that closing and reopening the app does not solve the problem (but clearing the app data does) makes me wonder if the issue comes from Realm Sync itself? Maybe my user token changes after some inactivity and Sync is not able to resolve conflicts between local Realm and Atlas DB?

Any help would be hugely appreciated here, as it is very difficult to debug this on release mode (on real devices)!