realm / realm-dotnet

Realm is a mobile database: a replacement for SQLite & ORMs
https://realm.io
Apache License 2.0
1.25k stars 165 forks source link

[Bug]: WaitForDownloadAsync() and WaitForUploadAsync() never return #2973

Closed carbonete closed 2 years ago

carbonete commented 2 years ago

What happened?

MongDB Sync at server is down because have integration error between Realm and Atlas.

When execute WaitForDownloadAsync() and WaitForUploadAsync() they never return any error. Running endless.

Repro steps

1 - Error occurs in MongoDB between Atlas and Realm

Version

10.9.0

What SDK flavour are you using?

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

What type of application is this?

Xamarin

Client OS and version

Android 8.1

Code snippets

    public async Task WaitSync()
    {
       Session session = SyncDB.RealmInstance.SyncSession;
        if (session != null && Connectivity.NetworkAccess == NetworkAccess.Internet)
        {
            try
            {
                await Task.WhenAll(session.WaitForDownloadAsync(),
                                    session.WaitForUploadAsync());
            }
            catch (Exception ex)
            {
                var t = ex;
            }
            App.AppEnvironmentService.SyncDB.GetCurrentUserExtension();
        }
    }

Stacktrace of the exception/crash you're getting

Server error 

Error:

recoverable event subscription error encountered: error getting new mongo client while creating pbs app translator: error connecting to MongoDB service cluster: failed to ping: server selection error: server selection timeout, current topology: { Type: Unknown, Servers: [{ Addr: lexsemanticcluster0-shard-00-00.owqih.mesh.mongodb.net:30556, Type: Unknown, Last error: connection() error occurred during connection handshake: connection(lexsemanticcluster0-shard-00-00.owqih.mesh.mongodb.net:30556[-327526]) socket was unexpectedly closed: EOF }, { Addr: lexsemanticcluster0-shard-00-01.owqih.mesh.mongodb.net:30556, Type: Unknown, Last error: connection() error occurred during connection handshake: connection(lexsemanticcluster0-shard-00-01.owqih.mesh.mongodb.net:30556[-327532]) socket was unexpectedly closed: EOF }, { Addr: lexsemanticcluster0-shard-00-02.owqih.mesh.mongodb.net:30556, Type: Unknown, Last error: connection() error occurred during connection handshake: connection(lexsemanticcluster0-shard-00-02.owqih.mesh.mongodb.net:30556[-327523]) socket was unexpectedly closed: EOF }, ] }
Source:

Error syncing MongoDB write

Relevant log output

I'm not surre its a Mongodb Sdk message but reconnection time is high.

[0:] 2022-07-07 14:57:49.751 Detail: Connection[1]: Negotiated protocol version: 3
[0:] 2022-07-07 14:57:49.756 Debug: Connection[1]: Will emit a ping in 54586 milliseconds
[0:] 2022-07-07 14:57:49.760 Debug: Connection[1]: Session[1]: Sending: IDENT(client_file_ident=xxx, client_file_ident_salt=xxx, scan_server_version=263, scan_client_version=38, latest_server_version=263, latest_server_version_salt=xxxx)
[0:] 2022-07-07 14:57:49.764 Debug: Connection[1]: Session[1]: Sending: MARK(request_ident=2)
[0:] 2022-07-07 14:58:29.826 Detail: Connection[1]: Allowing reconnection in 2878716 milliseconds
carbonete commented 2 years ago

Windows 10 have same problem.

carbonete commented 2 years ago

One more think, Session State is Active. But at server i have message "Synchronization between Atlas and Device Sync has been stopped. "

LaPeste commented 2 years ago

Thank you for the report. We will look into it.

LaPeste commented 2 years ago

I know you're being followed by our support team. I'll close this issue. Feel free to reopen it if you need more support.

carbonete commented 2 years ago

@LaPeste i put this because SDK part not working well , MongoDB Support only help to try restart SYNC, and this cause a big mess, forcing to reinstall app to our user. Freeze in methods and incorrect status of Session i don't talk with support. I think this two problems is a SDK team problem.

Thanks for attention

sync-by-unito[bot] commented 2 years ago

➤ Andrea Catalini commented:

To my understanding the user is being followed by the relevant team.

nirinchev commented 2 years ago

This is likely caused by https://github.com/realm/realm-core/issues/5315. There are two issues at play - one is that sync was down and this is likely followed-up by the Cloud/Support teams. The other is that those async operations don't complete (either with error or successfully) when sync is down and they should. I'm going to reopen it and indicate that it depends on the Core behavior being fixed.

nirinchev commented 2 years ago

Just found out we have an issue for the async operations, so I'm closing this as a duplicate of https://github.com/realm/realm-dotnet/issues/2835.