realm / realm-js

Realm is a mobile database: an alternative to SQLite & key-value stores
https://realm.io
Apache License 2.0
5.62k stars 558 forks source link

react native: flashing of screens while realm loads. Cant navigate back #6333

Closed Fuzzyma closed 1 month ago

Fuzzyma commented 5 months ago

How frequently does the bug occur?

Always

Description

I use the App, User and Realm Provider in an expo app (react native). As soon as I turn on sync, whatever I click, am led to the home screen and cant navigate anywhere. And its flashing like crazy whenever the realm loads (at least the loader of the realm is shown).

Its totally unusable. However, I need syncing. What goes on here?

Stacktrace & log output

No response

Can you reproduce the bug?

Always

Reproduction Steps

No response

Version

realm is version 12.3. @realm/react is 0.6.2

What services are you using?

Atlas Device Sync

Are you using encryption?

No

Platform OS and version(s)

Android Emulator Pixel 7

Build environment

I am using the expo dev client v49.0.15.

Cocoapods version

No response

kneth commented 4 months ago

@Fuzzyma Is it possible for you to provide code snippets of the providers? Moreover, it could be interesting to see the size of the change sets coming from Atlas (you need to enabling logging - and share the log) to see how your data is shaped.

Fuzzyma commented 4 months ago

Here is the layout component with all providers:

    <SafeAreaProvider>
      <View style={{ flex: 1 }} onLayout={onLayoutRootView}>
        <QueryClientProvider client={queryClient}>
          <RootSiblingParent>
            <TamaguiProvider config={config}>
              <OnlineProvider>
                <AppProvider id={appId} baseUrl={baseUrl}>
                  <UserProvider fallback={Login}>
                    <RealmProvider
                      schema={[Service, Subscription]}
                      deleteRealmIfMigrationNeeded
                      // sync={{
                      //   flexible: true,
                      //   onError: (_session, error) => {
                      //     console.error(error);
                      //   },
                      //   existingRealmFileBehavior: {
                      //     type: OpenRealmBehaviorType.DownloadBeforeOpen,
                      //     timeOut: 1000,
                      //     timeOutBehavior: OpenRealmTimeOutBehavior.OpenLocalRealm,
                      //   },
                      // }}
                    >
                      <ExpoStack
                        screenOptions={{
                          headerStyle: {
                            backgroundColor: '#fff',
                          },
                          headerTintColor: '#000',
                          headerShadowVisible: false,
                          headerTitleStyle: {
                            fontWeight: 'bold',
                          },
                          contentStyle: {
                            backgroundColor: '#fff',
                          },
                        }}
                      >
                      </ExpoStack>
                    </RealmProvider>
                  </UserProvider>
                </AppProvider>
              </OnlineProvider>
            </TamaguiProvider>
          </RootSiblingParent>
        </QueryClientProvider>
      </View>
    </SafeAreaProvider>

Have to look about the changesets later

Fuzzyma commented 4 months ago

I wrote up a better explanation in the forum which I will post here for reference as well:

I want to use react/realm in my expo project but I hit a roadblock that is a show stopper.

Whenever I turn on sync and I use “DownloadBeforeOpen” as sync config, my expo router stopps working. Whenever I go to another screen, it flashes and brings me back to the home screen. I printed the path segmets in the _layout.tsx and it shows that it changes the route forth and back (a lot of flashing involved).

So why on earth would that happen? Is realm resetting the whole react app and the router looses its state?

On another note, when I use “OpenImmediatiely”, it still flashes when I navigate to another screen but at least it shows the screen. However, when I want to write anything to the realm, I am greeted with the error message: “Error: Cannot write to class [ModelName] when no flexible sync subscription has been created.”

Here is the my Code for Reference:

                <AppProvider id={appId} baseUrl={baseUrl}>
                  <UserProvider fallback={Login}>
                    <RealmProvider
                      schema={[Model1, Model2
                      // deleteRealmIfMigrationNeeded
                      sync={{
                        newRealmFileBehavior: { type: OpenRealmBehaviorType.DownloadBeforeOpen },
                        flexible: true,
                        initialSubscriptions: {
                          update(subs, realm) {
                            subs.add(realm.objects(Model1));
                            // this is an embedded model and adding it here creates another error
                            // subs.add(realm.objects(Model2));
                          },
                        },
                        onError: (_session, error) => {
                          console.error(error);
                        },

                        existingRealmFileBehavior: {
                          type: OpenRealmBehaviorType.DownloadBeforeOpen,
                          // timeOut: 0,
                          // timeOutBehavior: OpenRealmTimeOutBehavior.OpenLocalRealm,
                        },
                      }}
                    >
                      <ExpoStack
                        screenOptions={{
                          headerStyle: {
                            backgroundColor: '#fff',
                          },
                          headerTintColor: '#000',
                          headerShadowVisible: false,
                          headerTitleStyle: {
                            fontWeight: 'bold',
                          },
                          contentStyle: {
                            backgroundColor: '#fff',
                          },
                        }}
                      ></ExpoStack>
                    </RealmProvider>
                  </UserProvider>
                </AppProvider>
Fuzzyma commented 4 months ago

Here are the logs with log level trace. It is the process of starting the app and then clicking on a button that should navigate to a sub page but instead flickers and navigates back to home:

Details

``` LOG [detail] DB: 5853 Thread 129547937643760: Open file: /data/data/com.xxx.app/files/mongodb-realm/xxx-native-app-lelgf/server-utility/metadata/sync_metadata.realm LOG [trace] DB: 5853 Thread 129547937643760: Start read 1401: 360 ref 7440 LOG [trace] DB: 5853 Thread 129547937643760: End transaction 1401 LOG [trace] DB: 5853 Thread 129547937643760: Start read 1401: 360 ref 7440 LOG [trace] DB: 5853 Thread 129547937643760: End transaction 1401 LOG [trace] DB: 5853 Thread 129547937643760: Start read 64487: 360 ref 7440 LOG [trace] DB: 5853 Thread 129547937643760: End transaction 64487 LOG [detail] DB: 5853 Thread 129547937643760: DB closed LOG [detail] DB: 5853 Thread 129547937643760: Open file: /data/data/com.xxx.app/files/mongodb-realm/xxx-native-app-lelgf/server-utility/metadata/sync_metadata.realm LOG [trace] DB: 5853 Thread 129547937643760: Start read 64487: 360 ref 7440 LOG [trace] DB: 5853 Thread 129547937643760: End transaction 64487 LOG [trace] DB: 5853 Thread 129547937643760: Start read 64487: 360 ref 7440 LOG [trace] DB: 5853 Thread 129547937643760: End transaction 64487 LOG [trace] DB: 5853 Thread 129547937643760: Start read 5351: 360 ref 7440 LOG [trace] DB: 5853 Thread 129547937643760: Tr 5351: Already on version: 360 LOG [trace] DB: 5853 Thread 129547937643760: Start read 3001: 360 ref 7440 LOG [trace] DB: 5853 Thread 129547937643760: End transaction 3001 LOG [trace] DB: 5853 Thread 129547937643760: Start read 6601: 360 ref 7440 LOG [trace] DB: 5853 Thread 129547937643760: Tr 6601: Already on version: 360 LOG [debug] DB: 5853 Thread 129547937643760: Query count: 'state != 2', limit = -1 LOG [debug] DB: 5853 Thread 129547937643760: Query matches: 2, Duration: 2231 us LOG [trace] DB: 5853 Thread 129547937643760: Tr 6601: Already on version: 360 LOG [debug] DB: 5853 Thread 129547937643760: Query find all: 'state != 2', limit = -1 LOG [debug] DB: 5853 Thread 129547937643760: Query found: 2, Duration: 24 us LOG [trace] DB: 5853 Thread 129547937643760: Tr 6601: Already on version: 360 LOG [trace] DB: 5853 Thread 129547937643760: Tr 6601: Already on version: 360 LOG [trace] DB: 5853 Thread 129547937643760: Tr 6601: Already on version: 360 LOG [trace] DB: 5853 Thread 129547937643760: Tr 6601: Already on version: 360 LOG [trace] DB: 5853 Thread 129547937643760: Tr 6601: Already on version: 360 LOG [trace] DB: 5853 Thread 129547937643760: Tr 6601: Already on version: 360 LOG [trace] DB: 5853 Thread 129547937643760: Tr 6601: Already on version: 360 LOG [trace] DB: 5853 Thread 129547937643760: Tr 6601: Already on version: 360 LOG [trace] DB: 5853 Thread 129547937643760: Tr 6601: Already on version: 360 LOG [trace] DB: 5853 Thread 129547937643760: Tr 6601: Already on version: 360 LOG [trace] DB: 5853 Thread 129547937643760: Tr 6601: Already on version: 360 LOG [trace] DB: 5853 Thread 129547937643760: Start read 2801: 360 ref 7440 LOG [trace] DB: 5853 Thread 129547937643760: End transaction 2801 LOG [trace] DB: 5853 Thread 129547937643760: Start read 6301: 360 ref 7440 LOG [trace] DB: 5853 Thread 129547937643760: Tr 6301: Already on version: 360 LOG [debug] DB: 5853 Thread 129547937643760: Query count: 'state == 2', limit = -1 LOG [debug] DB: 5853 Thread 129547937643760: Query matches: 0, Duration: 19 us LOG [trace] DB: 5853 Thread 129547937643760: Tr 6301: Already on version: 360 LOG [debug] DB: 5853 Thread 129547937643760: Query count: 'state == 2', limit = -1 LOG [debug] DB: 5853 Thread 129547937643760: Query matches: 0, Duration: 10 us LOG [trace] DB: 5853 Thread 129547937643760: End transaction 6301 LOG [trace] DB: 5853 Thread 129547937643760: End transaction 6601 LOG [trace] DB: 5853 Thread 129547937643760: End transaction 5351 LOG [detail] DB: 5853 Thread 129547937643760: DB closed LOG [detail] DB: 5853 Thread 129547937643760: Open file: /data/data/com.xxx.app/files/mongodb-realm/xxx-native-app-lelgf/server-utility/metadata/sync_metadata.realm LOG [trace] DB: 5853 Thread 129547937643760: Start read 5351: 360 ref 7440 LOG [trace] DB: 5853 Thread 129547937643760: End transaction 5351 LOG [trace] DB: 5853 Thread 129547937643760: Start read 5351: 360 ref 7440 LOG [trace] DB: 5853 Thread 129547937643760: End transaction 5351 LOG [trace] DB: 5853 Thread 129547937643760: Start read 1401: 360 ref 7440 LOG [trace] DB: 5853 Thread 129547937643760: End transaction 1401 LOG [detail] DB: 5853 Thread 129547937643760: DB closed LOG [debug] App: update_hostname: https://eu-central-1.aws.realm.mongodb.com | wss://ws.eu-central-1.aws.realm.mongodb.com LOG [detail] DB: 7398 Thread 129547937643760: Open file: /data/data/com.xxx.app/files/mongodb-realm/xxx-native-app-lelgf/server-utility/metadata/sync_metadata.realm LOG [trace] DB: 7398 Thread 129547937643760: Start read 1401: 360 ref 7440 LOG [trace] DB: 7398 Thread 129547937643760: End transaction 1401 LOG [trace] DB: 7398 Thread 129547937643760: Start read 1401: 360 ref 7440 LOG [trace] DB: 7398 Thread 129547937643760: End transaction 1401 LOG [trace] DB: 7398 Thread 129547937643760: Start read 6601: 360 ref 7440 LOG [trace] DB: 7398 Thread 129547937643760: End transaction 6601 LOG [detail] DB: 7398 Thread 129547937643760: DB closed LOG [detail] DB: 8222 Thread 129547937643760: Open file: /data/data/com.xxx.app/files/mongodb-realm/xxx-native-app-lelgf/server-utility/metadata/sync_metadata.realm LOG [trace] DB: 8222 Thread 129547937643760: Start read 6601: 360 ref 7440 LOG [trace] DB: 8222 Thread 129547937643760: End transaction 6601 LOG [trace] DB: 8222 Thread 129547937643760: Start read 6601: 360 ref 7440 LOG [trace] DB: 8222 Thread 129547937643760: End transaction 6601 LOG [trace] DB: 8222 Thread 129547937643760: Start read 6251: 360 ref 7440 LOG [trace] DB: 8222 Thread 129547937643760: End transaction 6251 LOG [detail] DB: 8222 Thread 129547937643760: DB closed LOG [detail] DB: 10179 Thread 129547937643760: Open file: /data/data/com.xxx.app/files/mongodb-realm/xxx-native-app-lelgf/server-utility/metadata/sync_metadata.realm LOG [trace] DB: 10179 Thread 129547937643760: Start read 2801: 360 ref 7440 LOG [trace] DB: 10179 Thread 129547937643760: End transaction 2801 LOG [trace] DB: 10179 Thread 129547937643760: Start read 2801: 360 ref 7440 LOG [trace] DB: 10179 Thread 129547937643760: End transaction 2801 LOG [trace] DB: 10179 Thread 129547937643760: Start read 3701: 360 ref 7440 LOG [debug] DB: 10179 Thread 129547937643760: Query find all: 'identity == "659d0d20b9ea2157dd6bb6c3"', limit = -1 LOG [debug] DB: 10179 Thread 129547937643760: Query found: 1, Duration: 176 us LOG [trace] DB: 10179 Thread 129547937643760: Tr 3701: Acquired write lock in 1593 us LOG [trace] DB: 10179 Thread 129547937643760: Tr 3701: Already on version: 360 LOG [trace] DB: 10179 Thread 129547937643760: Tr 3701: Promote to write: 360 -> 360 LOG [debug] DB: 10179 Thread 129547937643760: Initiate commit version: 361 LOG [debug] DB: 10179 Thread 129547937643760: Commit of size 328 done in 13582 us ref 7616 LOG [trace] DB: 10179 Thread 129547937643760: End transaction 3701 LOG [detail] DB: 10179 Thread 129547937643760: DB closed LOG [detail] DB: 10179 Thread 129547937643760: Open file: /data/data/com.xxx.app/files/mongodb-realm/xxx-native-app-lelgf/server-utility/metadata/sync_metadata.realm LOG [trace] DB: 10179 Thread 129547937643760: Start read 1101: 361 ref 7616 LOG [trace] DB: 10179 Thread 129547937643760: End transaction 1101 LOG [trace] DB: 10179 Thread 129547937643760: Start read 1101: 361 ref 7616 LOG [trace] DB: 10179 Thread 129547937643760: End transaction 1101 LOG [trace] DB: 10179 Thread 129547937643760: Start read 5001: 361 ref 7616 LOG [debug] DB: 10179 Thread 129547937643760: Query find all: 'identity == "659d0d20b9ea2157dd6bb6c3"', limit = -1 LOG [debug] DB: 10179 Thread 129547937643760: Query found: 1, Duration: 26 us LOG [trace] DB: 10179 Thread 129547937643760: Tr 5001: Acquired write lock in 393 us LOG [trace] DB: 10179 Thread 129547937643760: Tr 5001: Already on version: 361 LOG [trace] DB: 10179 Thread 129547937643760: Tr 5001: Promote to write: 361 -> 361 LOG [debug] DB: 10179 Thread 129547937643760: Initiate commit version: 362 LOG [debug] DB: 10179 Thread 129547937643760: Commit of size 328 done in 16814 us ref 7792 LOG [trace] DB: 10179 Thread 129547937643760: End transaction 5001 LOG [detail] DB: 10179 Thread 129547937643760: DB closed LOG [detail] DB: 11106 Thread 129547937643760: Open file: /data/data/com.xxx.app/files/mongodb-realm/xxx-native-app-lelgf/659d0d20b9ea2157dd6bb6c3/flx_sync_default.realm LOG [trace] Default event loop: start() LOG [info] Realm sync client ([realm-core-13.23.2]) LOG [debug] Supported protocol versions: 2-10 LOG [info] Platform: Android Linux 5.15.41-android13-8-00055-g4f5025129fe8-ab8949913 #1 SMP PREEMPT Mon Aug 15 18:33:14 UTC 2022 x86_64 LOG [debug] Build mode: Release LOG [debug] Config param: one_connection_per_session = false LOG [debug] Config param: connect_timeout = 120000 ms LOG [debug] Config param: connection_linger_time = 30000 ms LOG [debug] Config param: ping_keepalive_period = 60000 ms LOG [debug] Config param: pong_keepalive_timeout = 120000 ms LOG [debug] Config param: fast_reconnect_limit = 60000 ms LOG [debug] Config param: disable_upload_compaction = false LOG [debug] Config param: disable_sync_to_disk = false LOG [debug] Config param: reconnect backoff info: max_delay: 300000 ms, initial_delay: 1000 ms, multiplier: 2 LOG [trace] DB: 11106 Thread 129547937643760: Start read 1251: 16 ref 9776 LOG [trace] DB: 11106 Thread 129547937643760: End transaction 1251 LOG [trace] DB: 11106 Thread 129547937643760: Start read 1251: 16 ref 9776 LOG [trace] DB: 11106 Thread 129547937643760: End transaction 1251 LOG [trace] DB: 11106 Thread 129547937643760: Start read 4301: 16 ref 9776 LOG [debug] DB: 11106 Thread 129547937643760: Query find all: '(state == 3 or state == 6)', limit = -1 LOG [debug] DB: 11106 Thread 129547937643760: Query found: 1, Duration: 14 us LOG [debug] DB: 11106 Thread 129547937643760: Query find all: 'state == 6', limit = -1 LOG [debug] DB: 11106 Thread 129547937643760: Query found: 0, Duration: 27 us LOG [trace] DB: 11106 Thread 129547937643760: End transaction 4301 LOG [detail] DB: 15226 Thread 129547937643760: Open file: /data/data/com.xxx.app/files/mongodb-realm/xxx-native-app-lelgf/server-utility/metadata/sync_metadata.realm LOG [trace] DB: 15226 Thread 129547937643760: Start read 7051: 362 ref 7792 LOG [trace] DB: 15226 Thread 129547937643760: End transaction 7051 LOG [trace] DB: 15226 Thread 129547937643760: Start read 7051: 362 ref 7792 LOG [trace] DB: 15226 Thread 129547937643760: End transaction 7051 LOG [trace] DB: 15226 Thread 129547937643760: Start read 4601: 362 ref 7792 LOG [trace] DB: 15226 Thread 129547937643760: End transaction 4601 LOG [detail] DB: 15226 Thread 129547937643760: DB closed LOG [trace] DB: 10179 Thread 129547803495664: acquire writemutex LOG [trace] DB: 10179 Thread 129547803495664: writemutex acquired LOG [trace] DB: 10179 Thread 129547803495664: writemutex released LOG [trace] DB: 10179 Thread 129547803495664: acquire writemutex LOG [trace] DB: 10179 Thread 129547803495664: writemutex acquired LOG [trace] DB: 10179 Thread 129547803495664: writemutex released LOG [trace] Default event loop: thread running LOG [trace] Default event loop: service run LOG [trace] DB: 11106 Thread 129547803495664: Start read 4301: 16 ref 9776 LOG [trace] DB: 11106 Thread 129547803495664: End transaction 4301 LOG [info] Connection[1]: Session[1]: Binding '/data/data/com.xxx.app/files/mongodb-realm/xxx-native-app-lelgf/659d0d20b9ea2157dd6bb6c3/flx_sync_default.realm' to '' LOG [debug] Connection[1]: Session[1]: Activating LOG [info] Connection[1]: Session[1]: client_reset_config = false, Realm exists = true, client reset = false LOG [trace] DB: 11106 Thread 129547803495664: Start read 4301: 16 ref 9776 LOG [trace] DB: 11106 Thread 129547803495664: End transaction 4301 LOG [debug] Connection[1]: Session[1]: client_file_ident = 22, client_file_ident_salt = 4381981821757719212 LOG [debug] Connection[1]: Session[1]: last_version_available = 16 LOG [debug] Connection[1]: Session[1]: progress_download_server_version = 54 LOG [debug] Connection[1]: Session[1]: progress_download_client_version = 10 LOG [debug] Connection[1]: Session[1]: progress_upload_server_version = 52 LOG [debug] Connection[1]: Session[1]: progress_upload_client_version = 10 LOG [trace] DB: 11106 Thread 129547803495664: Start read 4301: 16 ref 9776 LOG [trace] DB: 11106 Thread 129547803495664: End transaction 4301 LOG [debug] Connection[1]: Session[1]: Progress handler called, downloaded = 0, downloadable(total) = 0, uploaded = 229, uploadable = 229, reliable_download_progress = false, snapshot version = 16 LOG [info] Connection[1]: Connecting to 'wss://ws.eu-central-1.aws.realm.mongodb.com:443/api/client/v2.0/app/xxx-native-app-lelgf/realm-sync' LOG [debug] WebSocket::Websocket() LOG [detail] Resolving 'ws.eu-central-1.aws.realm.mongodb.com:443' LOG [detail] Connecting to endpoint '35.157.33.91:443' (1/1) LOG [info] Connected to endpoint '35.157.33.91:443' (from '10.0.2.16:59912') LOG [local] get userId "3b6dcc67-859d-4c8c-873f-92666cd3dccf" LOG [detail] DB: 18213 Thread 129547937643760: Open file: /data/data/com.xxx.app/files/mongodb-realm/xxx-native-app-lelgf/server-utility/metadata/sync_metadata.realm LOG [trace] DB: 18213 Thread 129547937643760: Start read 1551: 362 ref 7792 LOG [trace] DB: 18213 Thread 129547937643760: End transaction 1551 LOG [trace] DB: 18213 Thread 129547937643760: Start read 1551: 362 ref 7792 LOG [trace] DB: 18213 Thread 129547937643760: End transaction 1551 LOG [trace] DB: 18213 Thread 129547937643760: Start read 64837: 362 ref 7792 LOG [trace] DB: 18213 Thread 129547937643760: End transaction 64837 LOG [detail] DB: 18213 Thread 129547937643760: DB closed LOG [debug] WebSocket::initiate_client_handshake() LOG [trace] HTTP request = GET /api/client/v2.0/app/xxx-native-app-lelgf/realm-sync?baas_at=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJiYWFzX2RldmljZV9pZCI6IjY1OWU5N2RmMWFiNTMyNGU1YzE4NDI1YyIsImJhYXNfZG9tYWluX2lkIjoiNjU4MzIzNDNmYjQ3ODdjM2IzOGMzZjdkIiwiZXhwIjoxNzA1MzMxNjY0LCJpYXQiOjE3MDUzMjk4NjQsImlzcyI6IjY1OWU5N2RmMWFiNTMyNGU1YzE4NDI1ZSIsInN0aXRjaF9kZXZJZCI6IjY1OWU5N2RmMWFiNTMyNGU1YzE4NDI1YyIsInN0aXRjaF9kb21haW5JZCI6IjY1ODMyMzQzZmI0Nzg3YzNiMzhjM2Y3ZCIsInN1YiI6IjY1OWQwZDIwYjllYTIxNTdkZDZiYjZjMyIsInR5cCI6ImFjY2VzcyJ9.deKFjM1sTV8Xq-7lj21jPSscz9NLXRLFEUulN2rYIzY HTTP/1.1 Host: ws.eu-central-1.aws.realm.mongodb.com Connection: Upgrade Sec-WebSocket-Key: lKDF+62gVXVOG6xRDav5RQ== Sec-WebSocket-Protocol: com.mongodb.realm-query-sync#10, com.mongodb.realm-query-sync#9, com.mongodb.realm-query-sync#8, com.mongodb.realm-query-sync#7, com.mongodb.realm-query-sync#6, com.mongodb.realm-query-sync#5, com.mongodb.realm-query-sync#4, com.mongodb.realm-query-sync#3, com.mongodb.realm-query-sync#2 Sec-WebSocket-Version: 13 Upgrade: websocket User-Agent: RealmSync/13.23.2 (Android Linux 5.15.41-android13-8-00055-g4f5025129fe8-ab8949913 #1 SMP PREEMPT Mon Aug 15 18:33:14 UTC 2022 x86_64) RealmJS/12.3.0 (v33) LOG [debug] WebSocket::handle_http_response_received() LOG [trace] HTTP response = HTTP/1.1 101 Switching Protocols cache-control: no-cache, no-store, must-revalidate connection: Upgrade date: Mon, 15 Jan 2024 14:50:44 GMT sec-websocket-accept: IL9kJOK5Y1bc5wDfYmxu+BbqW0I= sec-websocket-protocol: com.mongodb.realm-query-sync#10 server: mdbws strict-transport-security: max-age=31536000; includeSubdomains; upgrade: websocket vary: Origin x-appservices-request-id: 65a54644d5253d7c7d8ab38b x-frame-options: DENY x-xgen-up-proto: HTTP/1.1 LOG [detail] Connection[1]: Negotiated protocol version: 10 LOG [info] Connection[1]: Connected to app services with request id: "65a54644d5253d7c7d8ab38b" LOG [debug] Connection[1]: Will emit a ping in 31682 milliseconds LOG [debug] Connection[1]: Session[1]: Sending: BIND(session_ident=1, need_client_file_ident=false, is_subserver=false, json_data="{"sessionReason":0}") LOG [trace] DB: 11106 Thread 129547803495664: Start frozen 10801: 16 ref 9776 LOG [debug] DB: 11106 Thread 129547803495664: Query find all: '(state == 3 or state == 6)', limit = -1 LOG [debug] DB: 11106 Thread 129547803495664: Query found: 1, Duration: 14 us LOG [trace] DB: 11106 Thread 129547803495664: End transaction 10801 LOG [debug] Connection[1]: Session[1]: Sending: IDENT(client_file_ident=22, client_file_ident_salt=4381981821757719212, scan_server_version=54, scan_client_version=10, latest_server_version=54, latest_server_version_salt=0, query_version=1, query_size=29, query="{"Service":"(TRUEPREDICATE)"}") LOG [debug] Connection[1]: Session[1]: Sending: MARK(request_ident=2) LOG [debug] Connection[1]: Session[1]: Received: MARK(request_ident=2) LOG [trace] DB: 11106 Thread 129547803495664: Start read 9851: 16 ref 9776 LOG [debug] DB: 11106 Thread 129547803495664: Query find all: 'version > 1 and (state == 1 or state == 2) and snapshot_version > 9', limit = -1 LOG [debug] DB: 11106 Thread 129547803495664: Query found: 0, Duration: 82 us LOG [trace] DB: 11106 Thread 129547803495664: End transaction 9851 LOG [trace] DB: 11106 Thread 129547803495664: Start read 9851: 16 ref 9776 LOG [trace] DB: 11106 Thread 129547803495664: End transaction 9851 LOG [debug] Connection[1]: Session[1]: Sending: UPLOAD(progress_client_version=16, progress_server_version=54, locked_server_version=54, num_changesets=0) LOG [trace] DB: 11106 Thread 129547803495664: Start read 65287: 16 ref 9776 LOG [trace] DB: 11106 Thread 129547803495664: End transaction 65287 LOG [trace] DB: 11106 Thread 129547803495664: Start read 65287: 16 ref 9776 LOG [trace] DB: 11106 Thread 129547803495664: End transaction 65287 LOG [trace] DB: 11106 Thread 129547803495664: Start read 65287: 16 ref 9776 LOG [debug] DB: 11106 Thread 129547803495664: Query find all: 'version > 1 and (state == 1 or state == 2) and snapshot_version > 15', limit = -1 LOG [debug] DB: 11106 Thread 129547803495664: Query found: 0, Duration: 69 us LOG [trace] DB: 11106 Thread 129547803495664: End transaction 65287 LOG [detail] DB: 17492 Thread 129547937643760: Open file: /data/data/com.xxx.app/files/mongodb-realm/xxx-native-app-lelgf/server-utility/metadata/sync_metadata.realm LOG [trace] DB: 17492 Thread 129547937643760: Start read 1551: 362 ref 7792 LOG [trace] DB: 17492 Thread 129547937643760: End transaction 1551 LOG [trace] DB: 17492 Thread 129547937643760: Start read 1551: 362 ref 7792 LOG [trace] DB: 17492 Thread 129547937643760: End transaction 1551 LOG [trace] DB: 17492 Thread 129547937643760: Start read 9751: 362 ref 7792 LOG [debug] DB: 17492 Thread 129547937643760: Query find all: 'identity == "659d0d20b9ea2157dd6bb6c3"', limit = -1 LOG [debug] DB: 17492 Thread 129547937643760: Query found: 1, Duration: 20 us LOG [trace] DB: 17492 Thread 129547937643760: Tr 9751: Acquired write lock in 488 us LOG [trace] DB: 17492 Thread 129547937643760: Tr 9751: Already on version: 362 LOG [trace] DB: 17492 Thread 129547937643760: Tr 9751: Promote to write: 362 -> 362 LOG [debug] DB: 17492 Thread 129547937643760: Initiate commit version: 363 LOG [debug] DB: 17492 Thread 129547937643760: Commit of size 328 done in 27048 us ref 7968 LOG [trace] DB: 17492 Thread 129547937643760: End transaction 9751 LOG [detail] DB: 17492 Thread 129547937643760: DB closed LOG [trace] DB: 11106 Thread 129547937643760: Start read 64587: 16 ref 9776 LOG [trace] DB: 11106 Thread 129547937643760: Start frozen 11151: 16 ref 9776 LOG [trace] DB: 11106 Thread 129547937643760: End transaction 11151 LOG [trace] DB: 11106 Thread 129547937643760: Start read 8701: 16 ref 9776 LOG [debug] DB: 11106 Thread 129547937643760: Query find all: 'TRUEPREDICATE', limit = -1 LOG [debug] DB: 11106 Thread 129547937643760: Query found: 0, Duration: 60 us LOG [debug] DB: 11106 Thread 129547937643760: Query count (no condition): limit = -1 -> result: 0 LOG [debug] DB: 11106 Thread 129547937643760: Query count (no condition): limit = -1 -> result: 0 LOG [debug] DB: 11106 Thread 129547937643760: Query count (no condition): limit = -1 -> result: 0 LOG [trace] DB: 17492 Thread 129547605515504: acquire writemutex LOG [trace] DB: 17492 Thread 129547605515504: writemutex acquired LOG [trace] DB: 17492 Thread 129547605515504: writemutex released LOG [trace] DB: 11106 Thread 129547797019888: Start read 8601: 16 ref 9776 LOG [trace] DB: 11106 Thread 129547797019888: Start read 8501: 16 ref 9776 LOG [trace] DB: 11106 Thread 129547797019888: Tr 8601: Already on version: 16 LOG [trace] DB: 11106 Thread 129547797019888: End transaction 8701 LOG [debug] DB: 11106 Thread 129547797019888: Query find all: 'TRUEPREDICATE', limit = -1 LOG [debug] DB: 11106 Thread 129547797019888: Query found: 0, Duration: 10 us LOG [trace] DB: 11106 Thread 129547797019888: Start read 8701: 16 ref 9776 LOG [trace] DB: 11106 Thread 129547797019888: Start read 11651: 16 ref 9776 LOG [trace] DB: 11106 Thread 129547797019888: End transaction 8501 LOG [trace] DB: 11106 Thread 129547803495664: Start read 65287: 16 ref 9776 LOG [trace] DB: 11106 Thread 129547803495664: End transaction 65287 LOG [trace] DB: 11106 Thread 129547937643760: Start read 9351: 16 ref 9776 LOG [local] get userId "3b6dcc67-859d-4c8c-873f-92666cd3dccf" LOG [local] get userId "3b6dcc67-859d-4c8c-873f-92666cd3dccf" LOG [detail] DB: 30882 Thread 129547937643760: Open file: /data/data/com.xxx.app/files/mongodb-realm/xxx-native-app-lelgf/server-utility/metadata/sync_metadata.realm LOG [trace] DB: 30882 Thread 129547937643760: Start read 3901: 363 ref 7968 LOG [trace] DB: 30882 Thread 129547937643760: End transaction 3901 LOG [trace] DB: 30882 Thread 129547937643760: Start read 3901: 363 ref 7968 LOG [trace] DB: 30882 Thread 129547937643760: End transaction 3901 LOG [trace] DB: 30882 Thread 129547937643760: Start read 5301: 363 ref 7968 LOG [trace] DB: 30882 Thread 129547937643760: End transaction 5301 LOG [detail] DB: 30882 Thread 129547937643760: DB closed LOG [trace] DB: 11106 Thread 129547937643760: End transaction 64587 LOG [trace] DB: 11106 Thread 129547937643760: End transaction 8701 LOG [trace] DB: 11106 Thread 129547937643760: End transaction 9351 LOG [trace] DB: 11106 Thread 129547937643760: End transaction 11651 LOG [trace] DB: 11106 Thread 129547937643760: End transaction 8601 LOG [detail] DB: 11106 Thread 129547937643760: DB closed LOG [debug] Connection[1]: Session[1]: Initiating deactivation LOG [debug] Connection[1]: Session[1]: Sending: UNBIND LOG [detail] DB: 32633 Thread 129547937643760: Open file: /data/data/com.xxx.app/files/mongodb-realm/xxx-native-app-lelgf/server-utility/metadata/sync_metadata.realm LOG [trace] DB: 32633 Thread 129547937643760: Start read 11301: 363 ref 7968 LOG [trace] DB: 32633 Thread 129547937643760: End transaction 11301 LOG [trace] DB: 32633 Thread 129547937643760: Start read 11301: 363 ref 7968 LOG [trace] DB: 32633 Thread 129547937643760: End transaction 11301 LOG [trace] DB: 32633 Thread 129547937643760: Start read 14801: 363 ref 7968 LOG [debug] DB: 32633 Thread 129547937643760: Query find all: 'identity == "659d0d20b9ea2157dd6bb6c3"', limit = -1 LOG [debug] DB: 32633 Thread 129547937643760: Query found: 1, Duration: 17 us LOG [trace] DB: 32633 Thread 129547937643760: Tr 14801: Acquired write lock in 437 us LOG [trace] DB: 32633 Thread 129547937643760: Tr 14801: Already on version: 363 LOG [trace] DB: 32633 Thread 129547937643760: Tr 14801: Promote to write: 363 -> 363 LOG [debug] DB: 32633 Thread 129547937643760: Initiate commit version: 364 LOG [debug] DB: 32633 Thread 129547937643760: Commit of size 328 done in 10262 us ref 6912 LOG [trace] DB: 32633 Thread 129547937643760: End transaction 14801 LOG [detail] DB: 32633 Thread 129547937643760: DB closed LOG [detail] DB: 32633 Thread 129547937643760: Open file: /data/data/com.xxx.app/files/mongodb-realm/xxx-native-app-lelgf/server-utility/metadata/sync_metadata.realm LOG [trace] DB: 32633 Thread 129547937643760: Start read 16001: 364 ref 6912 LOG [trace] DB: 32633 Thread 129547937643760: End transaction 16001 LOG [trace] DB: 32633 Thread 129547937643760: Start read 16001: 364 ref 6912 LOG [trace] DB: 32633 Thread 129547937643760: End transaction 16001 LOG [trace] DB: 32633 Thread 129547937643760: Start read 5301: 364 ref 6912 LOG [debug] DB: 32633 Thread 129547937643760: Query find all: 'identity == "659d0d20b9ea2157dd6bb6c3"', limit = -1 LOG [debug] DB: 32633 Thread 129547937643760: Query found: 1, Duration: 41 us LOG [trace] DB: 32633 Thread 129547937643760: Tr 5301: Acquired write lock in 419 us LOG [trace] DB: 32633 Thread 129547937643760: Tr 5301: Already on version: 364 LOG [trace] DB: 32633 Thread 129547937643760: Tr 5301: Promote to write: 364 -> 364 LOG [debug] DB: 32633 Thread 129547937643760: Initiate commit version: 365 LOG [debug] DB: 32633 Thread 129547937643760: Commit of size 328 done in 7798 us ref 7088 LOG [trace] DB: 32633 Thread 129547937643760: End transaction 5301 LOG [detail] DB: 32633 Thread 129547937643760: DB closed LOG [detail] DB: 32633 Thread 129547937643760: Open file: /data/data/com.xxx.app/files/mongodb-realm/xxx-native-app-lelgf/659d0d20b9ea2157dd6bb6c3/flx_sync_default.realm LOG [trace] DB: 32633 Thread 129547937643760: Start read 12001: 16 ref 9776 LOG [trace] DB: 32633 Thread 129547937643760: End transaction 12001 LOG [trace] DB: 32633 Thread 129547937643760: Start read 12001: 16 ref 9776 LOG [trace] DB: 32633 Thread 129547937643760: End transaction 12001 LOG [trace] DB: 32633 Thread 129547937643760: Start read 14351: 16 ref 9776 LOG [debug] DB: 32633 Thread 129547937643760: Query find all: '(state == 3 or state == 6)', limit = -1 LOG [debug] DB: 32633 Thread 129547937643760: Query found: 1, Duration: 9 us LOG [debug] DB: 32633 Thread 129547937643760: Query find all: 'state == 6', limit = -1 LOG [debug] DB: 32633 Thread 129547937643760: Query found: 0, Duration: 9 us LOG [trace] DB: 32633 Thread 129547937643760: End transaction 14351 LOG [local] get userId "3b6dcc67-859d-4c8c-873f-92666cd3dccf" LOG [trace] DB: 32633 Thread 129547669368048: acquire writemutex LOG [trace] DB: 32633 Thread 129547669368048: writemutex acquired LOG [debug] Connection[1]: Session[1]: Received: UNBOUND LOG [debug] Connection[1]: Session[1]: Deactivation completed LOG [trace] DB: 32633 Thread 129547669368048: writemutex released LOG [trace] DB: 32633 Thread 129547669368048: acquire writemutex LOG [trace] DB: 32633 Thread 129547669368048: writemutex acquired LOG [trace] DB: 32633 Thread 129547669368048: writemutex released LOG [trace] DB: 32633 Thread 129547803495664: Start read 1251: 16 ref 9776 LOG [trace] DB: 32633 Thread 129547803495664: End transaction 1251 LOG [info] Connection[1]: Session[2]: Binding '/data/data/com.xxx.app/files/mongodb-realm/xxx-native-app-lelgf/659d0d20b9ea2157dd6bb6c3/flx_sync_default.realm' to '' LOG [debug] Connection[1]: Session[2]: Activating LOG [info] Connection[1]: Session[2]: client_reset_config = false, Realm exists = true, client reset = false LOG [trace] DB: 32633 Thread 129547803495664: Start read 1251: 16 ref 9776 LOG [trace] DB: 32633 Thread 129547803495664: End transaction 1251 LOG [debug] Connection[1]: Session[2]: client_file_ident = 22, client_file_ident_salt = 4381981821757719212 LOG [debug] Connection[1]: Session[2]: last_version_available = 16 LOG [debug] Connection[1]: Session[2]: progress_download_server_version = 54 LOG [debug] Connection[1]: Session[2]: progress_download_client_version = 10 LOG [debug] Connection[1]: Session[2]: progress_upload_server_version = 52 LOG [debug] Connection[1]: Session[2]: progress_upload_client_version = 10 LOG [debug] Connection[1]: Session[2]: Sending: BIND(session_ident=2, need_client_file_ident=false, is_subserver=false, json_data="{"sessionReason":0}") LOG [trace] DB: 32633 Thread 129547803495664: Start read 1251: 16 ref 9776 LOG [trace] DB: 32633 Thread 129547803495664: End transaction 1251 LOG [debug] Connection[1]: Session[2]: Progress handler called, downloaded = 0, downloadable(total) = 0, uploaded = 229, uploadable = 229, reliable_download_progress = false, snapshot version = 16 LOG [trace] DB: 32633 Thread 129547803495664: Start frozen 1251: 16 ref 9776 LOG [debug] DB: 32633 Thread 129547803495664: Query find all: '(state == 3 or state == 6)', limit = -1 LOG [debug] DB: 32633 Thread 129547803495664: Query found: 1, Duration: 163 us LOG [trace] DB: 32633 Thread 129547803495664: End transaction 1251 LOG [debug] Connection[1]: Session[2]: Sending: IDENT(client_file_ident=22, client_file_ident_salt=4381981821757719212, scan_server_version=54, scan_client_version=10, latest_server_version=54, latest_server_version_salt=0, query_version=1, query_size=29, query="{"Service":"(TRUEPREDICATE)"}") LOG [debug] Connection[1]: Session[2]: Sending: MARK(request_ident=2) LOG [debug] Connection[1]: Session[2]: Received: MARK(request_ident=2) LOG [trace] DB: 32633 Thread 129547803495664: Start read 1251: 16 ref 9776 LOG [debug] DB: 32633 Thread 129547803495664: Query find all: 'version > 1 and (state == 1 or state == 2) and snapshot_version > 9', limit = -1 LOG [debug] DB: 32633 Thread 129547803495664: Query found: 0, Duration: 18 us LOG [trace] DB: 32633 Thread 129547803495664: End transaction 1251 LOG [trace] DB: 32633 Thread 129547803495664: Start read 1251: 16 ref 9776 LOG [trace] DB: 32633 Thread 129547803495664: End transaction 1251 LOG [debug] Connection[1]: Session[2]: Sending: UPLOAD(progress_client_version=16, progress_server_version=54, locked_server_version=54, num_changesets=0) LOG [trace] DB: 32633 Thread 129547803495664: Start read 13551: 16 ref 9776 LOG [trace] DB: 32633 Thread 129547803495664: End transaction 13551 LOG [trace] DB: 32633 Thread 129547803495664: Start read 13551: 16 ref 9776 LOG [trace] DB: 32633 Thread 129547803495664: End transaction 13551 LOG [trace] DB: 32633 Thread 129547803495664: Start read 13551: 16 ref 9776 LOG [debug] DB: 32633 Thread 129547803495664: Query find all: 'version > 1 and (state == 1 or state == 2) and snapshot_version > 15', limit = -1 LOG [debug] DB: 32633 Thread 129547803495664: Query found: 0, Duration: 32 us LOG [trace] DB: 32633 Thread 129547803495664: End transaction 13551 LOG [detail] DB: 35414 Thread 129547937643760: Open file: /data/data/com.xxx.app/files/mongodb-realm/xxx-native-app-lelgf/server-utility/metadata/sync_metadata.realm LOG [trace] DB: 35414 Thread 129547937643760: Start read 5301: 365 ref 7088 LOG [trace] DB: 35414 Thread 129547937643760: End transaction 5301 LOG [trace] DB: 35414 Thread 129547937643760: Start read 5301: 365 ref 7088 LOG [trace] DB: 35414 Thread 129547937643760: End transaction 5301 LOG [trace] DB: 35414 Thread 129547937643760: Start read 15351: 365 ref 7088 LOG [debug] DB: 35414 Thread 129547937643760: Query find all: 'identity == "659d0d20b9ea2157dd6bb6c3"', limit = -1 LOG [debug] DB: 35414 Thread 129547937643760: Query found: 1, Duration: 30 us LOG [trace] DB: 35414 Thread 129547937643760: Tr 15351: Acquired write lock in 524 us LOG [trace] DB: 35414 Thread 129547937643760: Tr 15351: Already on version: 365 LOG [trace] DB: 35414 Thread 129547937643760: Tr 15351: Promote to write: 365 -> 365 LOG [debug] DB: 35414 Thread 129547937643760: Initiate commit version: 366 LOG [debug] DB: 35414 Thread 129547937643760: Commit of size 328 done in 8406 us ref 7264 LOG [trace] DB: 35414 Thread 129547937643760: End transaction 15351 LOG [detail] DB: 35414 Thread 129547937643760: DB closed LOG [trace] DB: 32633 Thread 129547937643760: Start read 11651: 16 ref 9776 LOG [trace] DB: 32633 Thread 129547937643760: Start frozen 9351: 16 ref 9776 LOG [trace] DB: 32633 Thread 129547937643760: End transaction 9351 LOG [trace] DB: 32633 Thread 129547937643760: Start read 64587: 16 ref 9776 LOG [debug] DB: 32633 Thread 129547937643760: Query find all: 'TRUEPREDICATE', limit = -1 LOG [debug] DB: 32633 Thread 129547937643760: Query found: 0, Duration: 21 us LOG [debug] DB: 32633 Thread 129547937643760: Query count (no condition): limit = -1 -> result: 0 LOG [debug] DB: 32633 Thread 129547937643760: Query count (no condition): limit = -1 -> result: 0 LOG [debug] DB: 32633 Thread 129547937643760: Query count (no condition): limit = -1 -> result: 0 LOG [trace] DB: 35414 Thread 129547602259184: acquire writemutex LOG [trace] DB: 35414 Thread 129547602259184: writemutex acquired LOG [trace] DB: 35414 Thread 129547602259184: writemutex released LOG [trace] DB: 32633 Thread 129547797019888: Start read 11551: 16 ref 9776 LOG [trace] DB: 32633 Thread 129547797019888: Start read 14351: 16 ref 9776 LOG [trace] DB: 32633 Thread 129547797019888: Tr 11551: Already on version: 16 LOG [trace] DB: 32633 Thread 129547797019888: End transaction 64587 LOG [debug] DB: 32633 Thread 129547797019888: Query find all: 'TRUEPREDICATE', limit = -1 LOG [debug] DB: 32633 Thread 129547797019888: Query found: 0, Duration: 11 us LOG [trace] DB: 32633 Thread 129547797019888: Start read 64587: 16 ref 9776 LOG [trace] DB: 32633 Thread 129547797019888: Start read 59073: 16 ref 9776 LOG [trace] DB: 32633 Thread 129547797019888: End transaction 14351 LOG [trace] DB: 32633 Thread 129547803495664: Start read 13551: 16 ref 9776 LOG [trace] DB: 32633 Thread 129547803495664: End transaction 13551 LOG [trace] DB: 32633 Thread 129547937643760: Start read 13101: 16 ref 9776 ---- clicking link LOG [detail] DB: 47774 Thread 129547937643760: Open file: /data/data/com.xxx.app/files/mongodb-realm/xxx-native-app-lelgf/server-utility/metadata/sync_metadata.realm LOG [trace] DB: 47774 Thread 129547937643760: Start read 20601: 366 ref 7264 LOG [trace] DB: 47774 Thread 129547937643760: End transaction 20601 LOG [trace] DB: 47774 Thread 129547937643760: Start read 20601: 366 ref 7264 LOG [trace] DB: 47774 Thread 129547937643760: End transaction 20601 LOG [trace] DB: 47774 Thread 129547937643760: Start read 19201: 366 ref 7264 LOG [trace] DB: 47774 Thread 129547937643760: End transaction 19201 LOG [detail] DB: 47774 Thread 129547937643760: DB closed LOG [trace] DB: 32633 Thread 129547937643760: End transaction 11651 LOG [trace] DB: 32633 Thread 129547937643760: End transaction 64587 LOG [trace] DB: 32633 Thread 129547937643760: End transaction 13101 LOG [trace] DB: 32633 Thread 129547937643760: End transaction 59073 LOG [trace] DB: 32633 Thread 129547937643760: End transaction 11551 LOG [debug] Connection[1]: Session[2]: Initiating deactivation LOG [debug] Connection[1]: Session[2]: Sending: UNBIND LOG [detail] DB: 32633 Thread 129547803495664: DB closed LOG [detail] DB: 57353 Thread 129547937643760: Open file: /data/data/com.xxx.app/files/mongodb-realm/xxx-native-app-lelgf/server-utility/metadata/sync_metadata.realm LOG [trace] DB: 57353 Thread 129547937643760: Start read 20601: 366 ref 7264 LOG [trace] DB: 57353 Thread 129547937643760: End transaction 20601 LOG [trace] DB: 57353 Thread 129547937643760: Start read 20601: 366 ref 7264 LOG [trace] DB: 57353 Thread 129547937643760: End transaction 20601 LOG [trace] DB: 57353 Thread 129547937643760: Start read 22601: 366 ref 7264 LOG [debug] DB: 57353 Thread 129547937643760: Query find all: 'identity == "659d0d20b9ea2157dd6bb6c3"', limit = -1 LOG [debug] DB: 57353 Thread 129547937643760: Query found: 1, Duration: 27 us LOG [trace] DB: 57353 Thread 129547937643760: Tr 22601: Acquired write lock in 1153 us LOG [trace] DB: 57353 Thread 129547937643760: Tr 22601: Already on version: 366 LOG [trace] DB: 57353 Thread 129547937643760: Tr 22601: Promote to write: 366 -> 366 LOG [debug] DB: 57353 Thread 129547937643760: Initiate commit version: 367 LOG [debug] DB: 57353 Thread 129547937643760: Commit of size 328 done in 8306 us ref 7440 LOG [trace] DB: 57353 Thread 129547937643760: End transaction 22601 LOG [detail] DB: 57353 Thread 129547937643760: DB closed LOG [detail] DB: 57353 Thread 129547937643760: Open file: /data/data/com.xxx.app/files/mongodb-realm/xxx-native-app-lelgf/server-utility/metadata/sync_metadata.realm LOG [trace] DB: 57353 Thread 129547937643760: Start read 17301: 367 ref 7440 LOG [trace] DB: 57353 Thread 129547937643760: End transaction 17301 LOG [trace] DB: 57353 Thread 129547937643760: Start read 17301: 367 ref 7440 LOG [trace] DB: 57353 Thread 129547937643760: End transaction 17301 LOG [trace] DB: 57353 Thread 129547937643760: Start read 16251: 367 ref 7440 LOG [debug] DB: 57353 Thread 129547937643760: Query find all: 'identity == "659d0d20b9ea2157dd6bb6c3"', limit = -1 LOG [debug] DB: 57353 Thread 129547937643760: Query found: 1, Duration: 9 us LOG [trace] DB: 57353 Thread 129547937643760: Tr 16251: Acquired write lock in 1074 us LOG [trace] DB: 57353 Thread 129547937643760: Tr 16251: Already on version: 367 LOG [trace] DB: 57353 Thread 129547937643760: Tr 16251: Promote to write: 367 -> 367 LOG [debug] DB: 57353 Thread 129547937643760: Initiate commit version: 368 LOG [debug] DB: 57353 Thread 129547937643760: Commit of size 328 done in 6405 us ref 7616 LOG [trace] DB: 57353 Thread 129547937643760: End transaction 16251 LOG [detail] DB: 57353 Thread 129547937643760: DB closed LOG [detail] DB: 57353 Thread 129547937643760: Open file: /data/data/com.xxx.app/files/mongodb-realm/xxx-native-app-lelgf/659d0d20b9ea2157dd6bb6c3/flx_sync_default.realm LOG [trace] DB: 57353 Thread 129547937643760: Start read 17701: 16 ref 9776 LOG [trace] DB: 57353 Thread 129547937643760: End transaction 17701 LOG [trace] DB: 57353 Thread 129547937643760: Start read 17701: 16 ref 9776 LOG [trace] DB: 57353 Thread 129547937643760: End transaction 17701 LOG [trace] DB: 57353 Thread 129547937643760: Start read 17201: 16 ref 9776 LOG [debug] DB: 57353 Thread 129547937643760: Query find all: '(state == 3 or state == 6)', limit = -1 LOG [debug] DB: 57353 Thread 129547937643760: Query found: 1, Duration: 12 us LOG [debug] DB: 57353 Thread 129547937643760: Query find all: 'state == 6', limit = -1 LOG [debug] DB: 57353 Thread 129547937643760: Query found: 0, Duration: 17 us LOG [trace] DB: 57353 Thread 129547937643760: End transaction 17201 LOG [local] get userId "3b6dcc67-859d-4c8c-873f-92666cd3dccf" LOG [debug] Connection[1]: Session[2]: Received: UNBOUND LOG [debug] Connection[1]: Session[2]: Deactivation completed LOG [trace] DB: 57353 Thread 129549809077488: acquire writemutex LOG [trace] DB: 57353 Thread 129549809077488: writemutex acquired LOG [trace] DB: 57353 Thread 129549809077488: writemutex released LOG [trace] DB: 57353 Thread 129549809077488: acquire writemutex LOG [trace] DB: 57353 Thread 129549809077488: writemutex acquired LOG [trace] DB: 57353 Thread 129549809077488: writemutex released LOG [trace] DB: 57353 Thread 129547803495664: Start read 12001: 16 ref 9776 LOG [trace] DB: 57353 Thread 129547803495664: End transaction 12001 LOG [info] Connection[1]: Session[3]: Binding '/data/data/com.xxx.app/files/mongodb-realm/xxx-native-app-lelgf/659d0d20b9ea2157dd6bb6c3/flx_sync_default.realm' to '' LOG [debug] Connection[1]: Session[3]: Activating LOG [info] Connection[1]: Session[3]: client_reset_config = false, Realm exists = true, client reset = false LOG [trace] DB: 57353 Thread 129547803495664: Start read 12001: 16 ref 9776 LOG [trace] DB: 57353 Thread 129547803495664: End transaction 12001 LOG [debug] Connection[1]: Session[3]: client_file_ident = 22, client_file_ident_salt = 4381981821757719212 LOG [debug] Connection[1]: Session[3]: last_version_available = 16 LOG [debug] Connection[1]: Session[3]: progress_download_server_version = 54 LOG [debug] Connection[1]: Session[3]: progress_download_client_version = 10 LOG [debug] Connection[1]: Session[3]: progress_upload_server_version = 52 LOG [debug] Connection[1]: Session[3]: progress_upload_client_version = 10 LOG [debug] Connection[1]: Session[3]: Sending: BIND(session_ident=3, need_client_file_ident=false, is_subserver=false, json_data="{"sessionReason":0}") LOG [trace] DB: 57353 Thread 129547803495664: Start read 12001: 16 ref 9776 LOG [trace] DB: 57353 Thread 129547803495664: End transaction 12001 LOG [debug] Connection[1]: Session[3]: Progress handler called, downloaded = 0, downloadable(total) = 0, uploaded = 229, uploadable = 229, reliable_download_progress = false, snapshot version = 16 LOG [trace] DB: 57353 Thread 129547803495664: Start frozen 12001: 16 ref 9776 LOG [debug] DB: 57353 Thread 129547803495664: Query find all: '(state == 3 or state == 6)', limit = -1 LOG [debug] DB: 57353 Thread 129547803495664: Query found: 1, Duration: 196 us LOG [trace] DB: 57353 Thread 129547803495664: End transaction 12001 LOG [debug] Connection[1]: Session[3]: Sending: IDENT(client_file_ident=22, client_file_ident_salt=4381981821757719212, scan_server_version=54, scan_client_version=10, latest_server_version=54, latest_server_version_salt=0, query_version=1, query_size=29, query="{"Service":"(TRUEPREDICATE)"}") LOG [debug] Connection[1]: Session[3]: Sending: MARK(request_ident=2) LOG [debug] Connection[1]: Session[3]: Received: MARK(request_ident=2) LOG [trace] DB: 57353 Thread 129547803495664: Start read 12001: 16 ref 9776 LOG [debug] DB: 57353 Thread 129547803495664: Query find all: 'version > 1 and (state == 1 or state == 2) and snapshot_version > 9', limit = -1 LOG [debug] DB: 57353 Thread 129547803495664: Query found: 0, Duration: 111 us LOG [trace] DB: 57353 Thread 129547803495664: End transaction 12001 LOG [trace] DB: 57353 Thread 129547803495664: Start read 12001: 16 ref 9776 LOG [trace] DB: 57353 Thread 129547803495664: End transaction 12001 LOG [debug] Connection[1]: Session[3]: Sending: UPLOAD(progress_client_version=16, progress_server_version=54, locked_server_version=54, num_changesets=0) LOG [trace] DB: 57353 Thread 129547803495664: Start read 13901: 16 ref 9776 LOG [trace] DB: 57353 Thread 129547803495664: End transaction 13901 LOG [trace] DB: 57353 Thread 129547803495664: Start read 13901: 16 ref 9776 LOG [trace] DB: 57353 Thread 129547803495664: End transaction 13901 LOG [trace] DB: 57353 Thread 129547803495664: Start read 13901: 16 ref 9776 LOG [debug] DB: 57353 Thread 129547803495664: Query find all: 'version > 1 and (state == 1 or state == 2) and snapshot_version > 15', limit = -1 LOG [debug] DB: 57353 Thread 129547803495664: Query found: 0, Duration: 224 us LOG [trace] DB: 57353 Thread 129547803495664: End transaction 13901 LOG [detail] DB: 56838 Thread 129547937643760: Open file: /data/data/com.xxx.app/files/mongodb-realm/xxx-native-app-lelgf/server-utility/metadata/sync_metadata.realm LOG [trace] DB: 56838 Thread 129547937643760: Start read 19301: 368 ref 7616 LOG [trace] DB: 56838 Thread 129547937643760: End transaction 19301 LOG [trace] DB: 56838 Thread 129547937643760: Start read 19301: 368 ref 7616 LOG [trace] DB: 56838 Thread 129547937643760: End transaction 19301 LOG [trace] DB: 56838 Thread 129547937643760: Start read 17151: 368 ref 7616 LOG [debug] DB: 56838 Thread 129547937643760: Query find all: 'identity == "659d0d20b9ea2157dd6bb6c3"', limit = -1 LOG [debug] DB: 56838 Thread 129547937643760: Query found: 1, Duration: 30 us LOG [trace] DB: 56838 Thread 129547937643760: Tr 17151: Acquired write lock in 550 us LOG [trace] DB: 56838 Thread 129547937643760: Tr 17151: Already on version: 368 LOG [trace] DB: 56838 Thread 129547937643760: Tr 17151: Promote to write: 368 -> 368 LOG [debug] DB: 56838 Thread 129547937643760: Initiate commit version: 369 LOG [debug] DB: 56838 Thread 129547937643760: Commit of size 328 done in 11537 us ref 7792 LOG [trace] DB: 56838 Thread 129547937643760: End transaction 17151 LOG [detail] DB: 56838 Thread 129547937643760: DB closed LOG [trace] DB: 57353 Thread 129547937643760: Start read 17651: 16 ref 9776 LOG [trace] DB: 57353 Thread 129547937643760: Start frozen 13101: 16 ref 9776 LOG [trace] DB: 57353 Thread 129547937643760: End transaction 13101 LOG [trace] DB: 57353 Thread 129547937643760: Start read 11651: 16 ref 9776 LOG [debug] DB: 57353 Thread 129547937643760: Query find all: 'TRUEPREDICATE', limit = -1 LOG [debug] DB: 57353 Thread 129547937643760: Query found: 0, Duration: 11 us LOG [debug] DB: 57353 Thread 129547937643760: Query count (no condition): limit = -1 -> result: 0 LOG [debug] DB: 57353 Thread 129547937643760: Query count (no condition): limit = -1 -> result: 0 LOG [debug] DB: 57353 Thread 129547937643760: Query count (no condition): limit = -1 -> result: 0 LOG [trace] DB: 56838 Thread 129548063640816: acquire writemutex LOG [trace] DB: 56838 Thread 129548063640816: writemutex acquired LOG [trace] DB: 56838 Thread 129548063640816: writemutex released LOG [trace] DB: 57353 Thread 129547797019888: Start read 20501: 16 ref 9776 LOG [trace] DB: 57353 Thread 129547797019888: Start read 18001: 16 ref 9776 LOG [trace] DB: 57353 Thread 129547797019888: Tr 20501: Already on version: 16 LOG [trace] DB: 57353 Thread 129547797019888: End transaction 11651 LOG [debug] DB: 57353 Thread 129547797019888: Query find all: 'TRUEPREDICATE', limit = -1 LOG [debug] DB: 57353 Thread 129547797019888: Query found: 0, Duration: 11 us LOG [trace] DB: 57353 Thread 129547797019888: Start read 11651: 16 ref 9776 LOG [trace] DB: 57353 Thread 129547797019888: Start read 20901: 16 ref 9776 LOG [trace] DB: 57353 Thread 129547797019888: End transaction 18001 LOG [trace] DB: 57353 Thread 129547803495664: Start read 15801: 16 ref 9776 LOG [trace] DB: 57353 Thread 129547803495664: End transaction 15801 LOG [trace] DB: 57353 Thread 129547937643760: Start read 18001: 16 ref 9776 LOG [detail] DB: 63842 Thread 129547937643760: Open file: /data/data/com.xxx.app/files/mongodb-realm/xxx-native-app-lelgf/server-utility/metadata/sync_metadata.realm LOG [trace] DB: 63842 Thread 129547937643760: Start read 20801: 369 ref 7792 LOG [trace] DB: 63842 Thread 129547937643760: End transaction 20801 LOG [trace] DB: 63842 Thread 129547937643760: Start read 20801: 369 ref 7792 LOG [trace] DB: 63842 Thread 129547937643760: End transaction 20801 LOG [trace] DB: 63842 Thread 129547937643760: Start read 4237: 369 ref 7792 LOG [trace] DB: 63842 Thread 129547937643760: End transaction 4237 LOG [detail] DB: 63842 Thread 129547937643760: DB closed LOG [trace] DB: 57353 Thread 129547937643760: End transaction 17651 LOG [trace] DB: 57353 Thread 129547937643760: End transaction 11651 LOG [trace] DB: 57353 Thread 129547937643760: End transaction 18001 LOG [trace] DB: 57353 Thread 129547937643760: End transaction 20901 LOG [trace] DB: 57353 Thread 129547937643760: End transaction 20501 LOG [detail] DB: 57353 Thread 129547937643760: DB closed LOG [debug] Connection[1]: Session[3]: Initiating deactivation LOG [debug] Connection[1]: Session[3]: Sending: UNBIND LOG [detail] DB: 63430 Thread 129547937643760: Open file: /data/data/com.xxx.app/files/mongodb-realm/xxx-native-app-lelgf/server-utility/metadata/sync_metadata.realm LOG [trace] DB: 63430 Thread 129547937643760: Start read 59073: 369 ref 7792 LOG [trace] DB: 63430 Thread 129547937643760: End transaction 59073 LOG [trace] DB: 63430 Thread 129547937643760: Start read 59073: 369 ref 7792 LOG [trace] DB: 63430 Thread 129547937643760: End transaction 59073 LOG [trace] DB: 63430 Thread 129547937643760: Start read 11551: 369 ref 7792 LOG [debug] DB: 63430 Thread 129547937643760: Query find all: 'identity == "659d0d20b9ea2157dd6bb6c3"', limit = -1 LOG [debug] DB: 63430 Thread 129547937643760: Query found: 1, Duration: 15 us LOG [trace] DB: 63430 Thread 129547937643760: Tr 11551: Acquired write lock in 413 us LOG [trace] DB: 63430 Thread 129547937643760: Tr 11551: Already on version: 369 LOG [trace] DB: 63430 Thread 129547937643760: Tr 11551: Promote to write: 369 -> 369 LOG [debug] DB: 63430 Thread 129547937643760: Initiate commit version: 370 LOG [debug] DB: 63430 Thread 129547937643760: Commit of size 328 done in 14786 us ref 7968 LOG [trace] DB: 63430 Thread 129547937643760: End transaction 11551 LOG [detail] DB: 63430 Thread 129547937643760: DB closed LOG [detail] DB: 63430 Thread 129547937643760: Open file: /data/data/com.xxx.app/files/mongodb-realm/xxx-native-app-lelgf/server-utility/metadata/sync_metadata.realm LOG [trace] DB: 63430 Thread 129547937643760: Start read 21251: 370 ref 7968 LOG [trace] DB: 63430 Thread 129547937643760: End transaction 21251 LOG [trace] DB: 63430 Thread 129547937643760: Start read 21251: 370 ref 7968 LOG [trace] DB: 63430 Thread 129547937643760: End transaction 21251 LOG [trace] DB: 63430 Thread 129547937643760: Start read 20951: 370 ref 7968 LOG [debug] DB: 63430 Thread 129547937643760: Query find all: 'identity == "659d0d20b9ea2157dd6bb6c3"', limit = -1 LOG [debug] DB: 63430 Thread 129547937643760: Query found: 1, Duration: 27 us LOG [trace] DB: 63430 Thread 129547937643760: Tr 20951: Acquired write lock in 897 us LOG [trace] DB: 63430 Thread 129547937643760: Tr 20951: Already on version: 370 LOG [trace] DB: 63430 Thread 129547937643760: Tr 20951: Promote to write: 370 -> 370 LOG [debug] DB: 63430 Thread 129547937643760: Initiate commit version: 371 LOG [debug] DB: 63430 Thread 129547937643760: Commit of size 328 done in 19284 us ref 6912 LOG [trace] DB: 63430 Thread 129547937643760: End transaction 20951 LOG [detail] DB: 63430 Thread 129547937643760: DB closed LOG [detail] DB: 63430 Thread 129547937643760: Open file: /data/data/com.xxx.app/files/mongodb-realm/xxx-native-app-lelgf/659d0d20b9ea2157dd6bb6c3/flx_sync_default.realm LOG [trace] DB: 63430 Thread 129547937643760: Start read 17651: 16 ref 9776 LOG [trace] DB: 63430 Thread 129547937643760: End transaction 17651 LOG [trace] DB: 63430 Thread 129547937643760: Start read 17651: 16 ref 9776 LOG [trace] DB: 63430 Thread 129547937643760: End transaction 17651 LOG [trace] DB: 63430 Thread 129547937643760: Start read 19951: 16 ref 9776 LOG [debug] DB: 63430 Thread 129547937643760: Query find all: '(state == 3 or state == 6)', limit = -1 LOG [debug] DB: 63430 Thread 129547937643760: Query found: 1, Duration: 11 us LOG [debug] DB: 63430 Thread 129547937643760: Query find all: 'state == 6', limit = -1 LOG [debug] DB: 63430 Thread 129547937643760: Query found: 0, Duration: 19 us LOG [trace] DB: 63430 Thread 129547937643760: End transaction 19951 LOG [local] get userId "3b6dcc67-859d-4c8c-873f-92666cd3dccf" LOG [debug] Connection[1]: Session[3]: Received: UNBOUND LOG [debug] Connection[1]: Session[3]: Deactivation completed LOG [trace] DB: 63430 Thread 129548063640816: acquire writemutex LOG [trace] DB: 63430 Thread 129548063640816: writemutex acquired LOG [trace] DB: 63430 Thread 129548063640816: writemutex released LOG [trace] DB: 63430 Thread 129548063640816: acquire writemutex LOG [trace] DB: 63430 Thread 129548063640816: writemutex acquired LOG [trace] DB: 63430 Thread 129548063640816: writemutex released LOG [trace] DB: 63430 Thread 129547803495664: Start read 17701: 16 ref 9776 LOG [trace] DB: 63430 Thread 129547803495664: End transaction 17701 LOG [info] Connection[1]: Session[4]: Binding '/data/data/com.xxx.app/files/mongodb-realm/xxx-native-app-lelgf/659d0d20b9ea2157dd6bb6c3/flx_sync_default.realm' to '' LOG [debug] Connection[1]: Session[4]: Activating LOG [info] Connection[1]: Session[4]: client_reset_config = false, Realm exists = true, client reset = false LOG [trace] DB: 63430 Thread 129547803495664: Start read 17701: 16 ref 9776 LOG [trace] DB: 63430 Thread 129547803495664: End transaction 17701 LOG [debug] Connection[1]: Session[4]: client_file_ident = 22, client_file_ident_salt = 4381981821757719212 LOG [debug] Connection[1]: Session[4]: last_version_available = 16 LOG [debug] Connection[1]: Session[4]: progress_download_server_version = 54 LOG [debug] Connection[1]: Session[4]: progress_download_client_version = 10 LOG [debug] Connection[1]: Session[4]: progress_upload_server_version = 52 LOG [debug] Connection[1]: Session[4]: progress_upload_client_version = 10 LOG [debug] Connection[1]: Session[4]: Sending: BIND(session_ident=4, need_client_file_ident=false, is_subserver=false, json_data="{"sessionReason":0}") LOG [trace] DB: 63430 Thread 129547803495664: Start read 17701: 16 ref 9776 LOG [trace] DB: 63430 Thread 129547803495664: End transaction 17701 LOG [debug] Connection[1]: Session[4]: Progress handler called, downloaded = 0, downloadable(total) = 0, uploaded = 229, uploadable = 229, reliable_download_progress = false, snapshot version = 16 LOG [trace] DB: 63430 Thread 129547803495664: Start frozen 17701: 16 ref 9776 LOG [debug] DB: 63430 Thread 129547803495664: Query find all: '(state == 3 or state == 6)', limit = -1 LOG [debug] DB: 63430 Thread 129547803495664: Query found: 1, Duration: 170 us LOG [trace] DB: 63430 Thread 129547803495664: End transaction 17701 LOG [debug] Connection[1]: Session[4]: Sending: IDENT(client_file_ident=22, client_file_ident_salt=4381981821757719212, scan_server_version=54, scan_client_version=10, latest_server_version=54, latest_server_version_salt=0, query_version=1, query_size=29, query="{"Service":"(TRUEPREDICATE)"}") LOG [debug] Connection[1]: Session[4]: Sending: MARK(request_ident=2) LOG [debug] Connection[1]: Session[4]: Received: MARK(request_ident=2) LOG [trace] DB: 63430 Thread 129547803495664: Start read 17701: 16 ref 9776 LOG [debug] DB: 63430 Thread 129547803495664: Query find all: 'version > 1 and (state == 1 or state == 2) and snapshot_version > 9', limit = -1 LOG [debug] DB: 63430 Thread 129547803495664: Query found: 0, Duration: 10 us LOG [trace] DB: 63430 Thread 129547803495664: End transaction 17701 LOG [trace] DB: 63430 Thread 129547803495664: Start read 17701: 16 ref 9776 LOG [trace] DB: 63430 Thread 129547803495664: End transaction 17701 LOG [debug] Connection[1]: Session[4]: Sending: UPLOAD(progress_client_version=16, progress_server_version=54, locked_server_version=54, num_changesets=0) LOG [trace] DB: 63430 Thread 129547803495664: Start read 16251: 16 ref 9776 LOG [trace] DB: 63430 Thread 129547803495664: End transaction 16251 LOG [trace] DB: 63430 Thread 129547803495664: Start read 16251: 16 ref 9776 LOG [trace] DB: 63430 Thread 129547803495664: End transaction 16251 LOG [trace] DB: 63430 Thread 129547803495664: Start read 16251: 16 ref 9776 LOG [debug] DB: 63430 Thread 129547803495664: Query find all: 'version > 1 and (state == 1 or state == 2) and snapshot_version > 15', limit = -1 LOG [debug] DB: 63430 Thread 129547803495664: Query found: 0, Duration: 38 us LOG [trace] DB: 63430 Thread 129547803495664: End transaction 16251 LOG [detail] DB: 56941 Thread 129547937643760: Open file: /data/data/com.xxx.app/files/mongodb-realm/xxx-native-app-lelgf/server-utility/metadata/sync_metadata.realm LOG [trace] DB: 56941 Thread 129547937643760: Start read 19601: 371 ref 6912 LOG [trace] DB: 56941 Thread 129547937643760: End transaction 19601 LOG [trace] DB: 56941 Thread 129547937643760: Start read 19601: 371 ref 6912 LOG [trace] DB: 56941 Thread 129547937643760: End transaction 19601 LOG [trace] DB: 56941 Thread 129547937643760: Start read 21251: 371 ref 6912 LOG [debug] DB: 56941 Thread 129547937643760: Query find all: 'identity == "659d0d20b9ea2157dd6bb6c3"', limit = -1 LOG [debug] DB: 56941 Thread 129547937643760: Query found: 1, Duration: 19 us LOG [trace] DB: 56941 Thread 129547937643760: Tr 21251: Acquired write lock in 694 us LOG [trace] DB: 56941 Thread 129547937643760: Tr 21251: Already on version: 371 LOG [trace] DB: 56941 Thread 129547937643760: Tr 21251: Promote to write: 371 -> 371 LOG [debug] DB: 56941 Thread 129547937643760: Initiate commit version: 372 LOG [debug] DB: 56941 Thread 129547937643760: Commit of size 328 done in 13966 us ref 7088 LOG [trace] DB: 56941 Thread 129547937643760: End transaction 21251 LOG [detail] DB: 56941 Thread 129547937643760: DB closed LOG [trace] DB: 63430 Thread 129547937643760: Start read 20951: 16 ref 9776 LOG [trace] DB: 63430 Thread 129547937643760: Start frozen 11551: 16 ref 9776 LOG [trace] DB: 63430 Thread 129547937643760: End transaction 11551 LOG [trace] DB: 63430 Thread 129547937643760: Start read 12601: 16 ref 9776 LOG [debug] DB: 63430 Thread 129547937643760: Query find all: 'TRUEPREDICATE', limit = -1 LOG [debug] DB: 63430 Thread 129547937643760: Query found: 0, Duration: 13 us LOG [debug] DB: 63430 Thread 129547937643760: Query count (no condition): limit = -1 -> result: 0 LOG [debug] DB: 63430 Thread 129547937643760: Query count (no condition): limit = -1 -> result: 0 LOG [debug] DB: 63430 Thread 129547937643760: Query count (no condition): limit = -1 -> result: 0 LOG [trace] DB: 56941 Thread 129548063640816: acquire writemutex LOG [trace] DB: 56941 Thread 129548063640816: writemutex acquired LOG [trace] DB: 56941 Thread 129548063640816: writemutex released LOG [trace] DB: 63430 Thread 129547797019888: Start read 59073: 16 ref 9776 LOG [trace] DB: 63430 Thread 129547797019888: Start read 18001: 16 ref 9776 LOG [trace] DB: 63430 Thread 129547797019888: Tr 59073: Already on version: 16 LOG [trace] DB: 63430 Thread 129547797019888: End transaction 12601 LOG [debug] DB: 63430 Thread 129547797019888: Query find all: 'TRUEPREDICATE', limit = -1 LOG [debug] DB: 63430 Thread 129547797019888: Query found: 0, Duration: 11 us LOG [trace] DB: 63430 Thread 129547797019888: Start read 12601: 16 ref 9776 LOG [trace] DB: 63430 Thread 129547797019888: Start read 11651: 16 ref 9776 LOG [trace] DB: 63430 Thread 129547797019888: End transaction 18001 LOG [trace] DB: 63430 Thread 129547803495664: Start read 16251: 16 ref 9776 LOG [trace] DB: 63430 Thread 129547803495664: End transaction 16251 LOG [trace] DB: 63430 Thread 129547937643760: Start read 21251: 16 ref 9776 ```

I am happy for any guidance on how to approach this issue. I am totally lost about whats going on here

HugoBounoua commented 3 months ago

Hi @Fuzzyma I am experiencing the exact same thing. The screen flickers at least 3 times on load. Then if a sync happens while navigating the app, I am redirected to the homepage. Sometimes the screen keeps flickering like crazy, and I must stop and restart the app. It's a complete blocker. Did you find a solution to this problem?

kneth commented 3 months ago

We haven't been able to pinpoint it yet but it sounds a bit like https://github.com/expo/router/issues/688

HugoBounoua commented 3 months ago

@kneth I don't use Expo and I have this issue, also if I disable the sync it's not flashing. I'll try to fix that today.

HugoBounoua commented 3 months ago

I tested everything in my app. The only thing that forces the whole app to rerender and flicker is the "RealmProvider": If I remove it the screen does not flicker. If I add it the screen does flicker. (Tested online and offline). That's a bug from Realm, unfortunately there is nothing we can do.

<RealmProvider sync={{ flexible: true, initialSubscriptions: { update(subs, realm) { subs.add(realm.objects(Project).filtered('tenantId == $0', connectedUser.tenantId), { name: 'projects' }) }, }, newRealmFileBehavior: { type: OpenRealmBehaviorType.OpenImmediately }, existingRealmFileBehavior: { type: OpenRealmBehaviorType.OpenImmediately }, }} path={${connectedUser.id}${connectedUser.tenantId}`}

`

luangarcia commented 3 months ago

I have the same issue described. The app gets stuck for minutes performing the sync, and I can't use or disable the functionality.

Does anyone know how to disable sync without freezing the screen? On flexible true?

Fuzzyma commented 3 months ago

@kneth the label "waiting for reporter" was added. Tell me what you need and I will happily provide!

kneth commented 3 months ago

@HugoBounoua Great to hear

@Fuzzyma Does the suggestion above also solve your problem?

Fuzzyma commented 3 months ago

I will need to test it out. Can take a few days tho since I am on vacation right now! Would be awesome if it would work out!

HugoBounoua commented 3 months ago

@kneth @Fuzzyma Experiencing the same problem as everyone else (my answer here was stabilizing the app but did not fix the problem, see below for a workaround)

Fuzzyma commented 3 months ago

That looks like an awful lot of code for something that should just work 😅

Fuzzyma commented 3 months ago

@HugoBounoua @kneth This does not work for me. If I dont add any subscriptions to begin with it flashes and I cant navigate. I also tried adding the subs in a useEffect but for that I need an intermediate component inside the provider. And it kept throwing:

const Subscriber = ({ children }: { children: ReactNode }) => {
  const realm = useRealm();
  useEffect(() => {
    realm.subscriptions.update((subs) => {
      subs.add(realm.objects(Service));
    });
  }, [realm]);
  return children;
};
[Error: Realm context not found.  Did you call useRealm() within a <RealmProvider/>?]

That by itself is weird. But I dont think it would have solved the flashing issue anyway since it flashes even if I dont subscribe to anything

kneth commented 3 months ago

@Fuzzyma How does your <RealmProvider/> look like?

Fuzzyma commented 3 months ago

@kneth i posted my code above. It's the standard realm provider that is provided by the realm react package. Nothing special there (I think?)

kitolog commented 2 months ago

Are there any updates here? I'm facing the same issue and it started when I migrated the realm from v11 to v12

<AppProvider id={APP_ID}>
    <UserProvider fallback={AuthContainer}>
        <RealmWrapper />
    </UserProvider>
</AppProvider>
function RealmWrapper() {
  const {RealmProvider} = RealmContext;
  const realmAccessBehavior: Realm.OpenRealmBehaviorConfiguration = {
    type: Realm.OpenRealmBehaviorType.OpenImmediately,
  };

  const user = useUser();

  if (!user?.id) {
    return null;
  }

  return (
    <RealmProvider
      schema={schema}
      sync={
        user?.profile?.email
          ? {
            user,
            flexible: true,
            initialSubscriptions: {
              update(subs, realm) {
                subs.add(realm.objects('MyModel1'));
                subs.add(realm.objects('MyModel2'));
                subs.add(realm.objects('MyModel3'));
                subs.add(realm.objects('MyModel4'));
                subs.add(realm.objects('MyModel5'));
              },
              rerunOnOpen: true,
            },
            newRealmFileBehavior: realmAccessBehavior,
            existingRealmFileBehavior: realmAccessBehavior,
            onError: console.error,
          }
          : undefined
      }>
      <App />
    </RealmProvider>
  );
}
greenafrican commented 2 months ago

We are experiencing this issue in a new dev build of our app using v12.6.2 and @realm/react v0.6.2; however, it only starts flashing (between the fallback and the RealProvider children) when the user goes "offline". The main reason we are using Realm is because of its "offline-first" approach, which seems to have changed.

I have also been able to replicate this using the react-native.todo.flex example project:

export const AppWrapper = () => {
  return (
    <AppProvider id={appId} baseUrl={baseUrl}>
      <UserProvider fallback={WelcomeView}>
        <RealmProvider
          schema={[Item]}
          sync={{
            flexible: true,
            onError: (_session, error) => {
              // Show sync errors in the console
              console.error(error);
            },
          }}
          fallback={LoadingIndicator}>
          <App />
        </RealmProvider>
      </UserProvider>
    </AppProvider>
  );
};

When you go offline you just see the LoadingIndicator and 3 errors:

 ERROR  [error] App: request location failed (CustomError -1): request to https://services.cloud.mongodb.com/api/client/v2.0/app/mytutorialapp-xxx/location failed, reason: Network request failed
 ERROR  [SyncError: Unable to reach the server: request to https://services.cloud.mongodb.com/api/client/v2.0/app/mytutorialapp-xxx/location failed, reason: Network request failed]
 ERROR  [Error: Unable to reach the server: request to https://services.cloud.mongodb.com/api/client/v2.0/app/mytutorialapp-xxx/location failed, reason: Network request failed]

If you add the realm opening behaviours to the config like:

newRealmFileBehavior: {
  type: OpenRealmBehaviorType.OpenImmediately,
  timeOut: 1000,
  timeOutBehavior: OpenRealmTimeOutBehavior.OpenLocalRealm,
},
existingRealmFileBehavior: {
  type: OpenRealmBehaviorType.OpenImmediately,
  timeOut: 1000,
  timeOutBehavior: OpenRealmTimeOutBehavior.OpenLocalRealm,
},

Then it starts flashing between the RealmProvider children and the fallback and the app becomes unusable: Simulator Screen Recording - iPhone 15 - 2024-03-06 at 11 19 18

HugoBounoua commented 2 months ago

@kneth We are all experiencing this. It makes the whole app completely unusable, it clearly hasn't been tested correctly and puts all of our projects at risk. It needs to be fixed asap. Please follow up on this.

For a workaround that works for me: It's a bit complicated since everything in the RealmProvider is destroyed at every renders, and everything loses state obviously, we need to find a way to extract ourselves as much as possible from the bugging RealmProvider.

The idea behind this architecture is to create 2 layers at the root of your app inside a Redux Provider: RealmLayer + RenderLayer:

Now, the RealmLayer can update and re-render as many times as needed (because it's super buggy); the idea is to keep the RealmProvider inside a useMemo, only dependent on the partition so it does not re-renders like crazy. Simply keep one component that handles all the subscriptions and update the ReduxSlice whenever an update on the objects are detected (pretty simply in a useEffect)

So keep your whole app OUTSIDE of the RealmProvider (I honestly don't understand why Realm does not architects the project this way but whatever..). Then, whenever the RealmProvider renders (through useMemo), update the Redux slice so your app gets the sync changes. It's a good level of abstraction because it would be easy to switch to another sync provider later (since Realm is completely unstable, I don't think we will rely on it for long...).

I'm sparing you some details on how to share the realm object, but basically create a context and wrap your app in the ContextProvider, set the variable "realm" in the context and you'll be able to use it across the app.

Conclusion I might share the code at some point but what's needed is an actual support from Realm for something that breaks the entire offline mode since more than 3 months now 😒

kneth commented 2 months ago

@greenafrican Thank you for provide the screencast which clearly demonstrate the issue.

@HugoBounoua To be honest, we haven't been able to find the root cause, and your description of a workaround might help us to get closer to finding it - thanks for sharing.

I'll put the issue on the team meeting early next week to get focus time allocated as I fear it is not a trivial issue to find the root cause of.

kneth commented 2 months ago

We are able to reproduce it, and we are currently working on isolating the root cause. When offline, it looks like @realm/react is frequently opening the Realm which could cause the rapid flickering.

elle-j commented 2 months ago

Update: This seems to be related to @realm/react v0.6.2. For the ones experiencing this issue at the moment, can you confirm if you're seeing the same issue using v0.6.1:

Note from the example package.json below that you should write 0.6.1 and not ^0.6.1.

{
  "dependencies": {
    "@realm/react": "0.6.1",
  }
}
HugoBounoua commented 2 months ago

@elle-j My config is "@realm/react": "^0.6.0" and I'm experiencing the issue.

elle-j commented 2 months ago

If you try "0.6.1" (no ^) and rerun npm i (and if you're using iOS, also run npx pod-install), you can let us know if you have the same issue.

kitolog commented 2 months ago

@elle-j initially I had version "@realm/react": "0.6.2", it was blinking With the version "@realm/react": "0.6.1" it works! Thanks!

elle-j commented 2 months ago

Thanks for confirming, we believe to have pinpointed the issue and aim to have a release out by the end of the week.

HugoBounoua commented 2 months ago

@elle-j I don't know what "kitolog" uses, but it does not change anything on my end. Yes it works online, but as soon as you turn the airplane mode on, it blinks, it flickers, goes back to homepage and everything is destroyed. I'm using "@realm/react": "0.6.1" and "realm": "12.6.2". I removed all node_modules, reinstalled everything multiple times. If anyone was able to make it work, feel free to share your implementation but on my end it's completely buggy just like described above. Try to release a fix if you want but I don't think what you will fix is related to the offline mode. The offline mode does not work at all.

kneth commented 2 months ago

The offline mode does not work at all.

Please elaborate.

ampopdev commented 2 months ago

@kneth One piece of info that might help with the investigation is that we have the flashing of screens as well, when using initialSubscriptions on latest version of realm and realm/react. If we don't use initialSubscriptions, but just use realm.subscriptions.update in useEffect it doesn't flash any more:

<RealmProvider
  sync={{
    flexible: true,
    // initialSubscriptions: {
    //   update: (mutableSubs, realm) => {
    //     mutableSubs.add(realm.objects(Collection1));
    //     mutableSubs.add(realm.objects(Collection2));
    //     mutableSubs.add(realm.objects(Collection3));
    //   },
    //   rerunOnOpen: true,
    // },
    clientReset: {
      mode: ClientResetMode.RecoverOrDiscardUnsyncedChanges,
    },
    newRealmFileBehavior: {
      type: OpenRealmBehaviorType.DownloadBeforeOpen,
    },
    existingRealmFileBehavior: {
      type: OpenRealmBehaviorType.OpenImmediately,
    },
  }}
  schema={allSchemas}
  closeOnUnmount={false}
>
  <App />
</RealmProvider>
  In App.js:
import { useRealm } from '@realm/react';
...
const realm = useRealm();
...
useEffect(() => {
  realm.subscriptions.update(mutableSubs => {
    mutableSubs.add(realm.objects(Collection1));
    mutableSubs.add(realm.objects(Collection2));
    mutableSubs.add(realm.objects(Collection3));
  });
}, [realm]);
greenafrican commented 2 months ago

@kneth I can confirm that the offline flashing persists in the react-native.todo.flex example when using "@realm/react": "^0.6.1" and without initialSubscriptions in the example RealmProvider:

<RealmProvider
    schema={[Item]}
    sync={{
      flexible: true,
      onError: (_session, error) => {
        // Show sync errors in the console
        console.error(error);
      },
      newRealmFileBehavior: {
        type: OpenRealmBehaviorType.DownloadBeforeOpen,
        timeOut: 15000,
        timeOutBehavior: OpenRealmTimeOutBehavior.ThrowException,
      },
      existingRealmFileBehavior: {
        type: OpenRealmBehaviorType.OpenImmediately,
        timeOut: 15000,
        timeOutBehavior: OpenRealmTimeOutBehavior.OpenLocalRealm,
      },
    }}
    fallback={LoadingIndicator}>
    <App />
  </RealmProvider>

There may be 2 different issues here that result in the flashing and perhaps need to be tracked separately.

elle-j commented 2 months ago

Flickering

There is an identified issue in @realm/react version 0.6.2 that causes a large amount of rerenders, in turn causing the realm to close and reopen continuously. This is what makes the RealmProvider flicker between its fallback and its children.

@HugoBounoua, thanks for getting back. It's surprising that you're seeing the flickering behavior even after deleting your node_modules and pinning @realm/react to 0.6.1. Can you please confirm that you do not have any references to 0.6.2 in your package-lock.json?

@greenafrican, since you're using ^0.6.1, the @realm/react version used when installing the package will be the latest minor and patch version, i.e. 0.6.2. To pin the version, type 0.6.1 without the ^.

@ampopdev, in your latest example, I think the reason you're not seeing the flickering is due to closeOnUnmount={false}.

DownloadBeforeOpen

There may be a separate issue regarding OpenRealmBehaviorType.DownloadBeforeOpen that we're also looking into.

greenafrican commented 2 months ago

@greenafrican, since you're using ^0.6.1, the @realm/react version used when installing the package will be the latest minor and patch version, i.e. 0.6.2. To pin the version, type 0.6.1 without the ^.

Yes, apologies. I can confirm react-native.todo.flex with 0.6.1 does not flicker when offline!

HugoBounoua commented 2 months ago

@elle-j thank you for following up on this. The Realm Provider does not flicker indefinitely online OR offline, however it does destroy everything when switching between online and offline. So if you're in the app and you loose connectivity, the entire app, contained in the RealmProvider, is disposed and restarts. This makes the RealmProvider unusable as is, since the sync process is not flawless when the connectivity state can change. The RealmProvider should not dispose its content but simply re-render it. Is it something that Realm is supposed to handle?

elle-j commented 2 months ago

@HugoBounoua, it's certainly something Realm handles and we're actively looking into that issue to have it fixed as soon as possible.

HugoBounoua commented 2 months ago

@elle-j Great, thank you. In the meantime, I will continue separating my app components from the RealmProvider, keep the RealmProvider in a useMemo, and pass the reference to the realm object via a context to the rest of the app while the subscriptions update the Redux slices used by all my components. Thank you for looking into this.

Fuzzyma commented 2 months ago

In the meantime if anyone has the time and nerves to create a minimal setup that works, that would be awesome. I am still on vacation and will try to do so once I am back but I think it will help others finding this issue