Atlas device sync stops notifing after a time

Hi experts

I was building a .net maui app with atlas device (flexible) synch implementation, but I noticed something weird about the sync session, like it sort of desynced itself after some time (for example, if I was to delete an object from client A that was deleted from client B, client A correctly crashed because the object was not there anymore - “Attempted to access detached row” - but no delete notification was received by client A at the moment of deletion from client B).

So I made a simple-as-possible test app to try replicate the issue (repo here):
At startup, the app initializes realm with initial subscriptions and subscribe collections for notifications, then pressing the “stress” button starts a simple brute force test, making some creation and deletion requests in series with delays, keeping trace of how many requests have been made and how many notifications have been received.

Starting the test on client A with the same app open also on client B, shows that received notifications count on client B does not equal the count of requests made by client A
In fact, even running the test only on client A without involving client B shows that notifications number stops incrementing at a roughly 20% - whereas on client B stopped climbing at 50% - of the requests, and restarting the test without closing the app didn’t increment the counter anymore, just like the sync session became asleep (however, write operations continue reaching the server, as log suggest).

Sync session state was always “active”, connection state was always “connected”, subscriptions were always correctly populated, no error logs in atlas device sync online dashboard, nothing apparently wrong but still sync notifications stops at certain point (not even sure if this could be related to a sync app service / cluster / .net sdk problem or a bad implementation in my app).

I also want to point out that the cluster to which the sync is linked is a shared M0 sandbox, and I would be perfectly fine with low network / cpu performances, but not at all ok with sync not notifying clients of some db changes…

realm.All<ItemEntry>().SubscribeForNotifications returns a token that you need to preserve. Otherwise, when it’s garbage collected, the notification callback will be unsubscribed.