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

Getting Error “Sync session became inactive” unhandled error #6631

Open vatsal-gadhiya-searce opened 4 weeks ago

vatsal-gadhiya-searce commented 4 weeks ago

How frequently does the bug occur?

Sometimes

Description

We have a react native version 0.73.1 app We are using realm version 12.5.0

we are getting below error sometimes and some of the records aren't updated in realm. We have bugsnag added to the app so added all the logs we got from the bugsnag console.

{ “reason”: “Sync session became inactive”, “code”: 1027, “isOk”: false }

InvalidError Counter promise rejection tracking received a non-error. See “promise rejection tracking” tab for more detail.

Stacktrace & log output

InvalidError promise rejection tracking received a non-error. See "promise rejection tracking" tab for more detail. 
    /root/react-native/packages/react-native/ReactAndroid/hermes-engine/.cxx/MinSizeRel/652p4r5v/arm64-v8a/lib/InternalBytecode/InternalBytecode.js:494:30 onUnhandled
    (native) apply
    node_modules/react-native/Libraries/Core/Timers/JSTimers.js:213:22 anonymous
    node_modules/react-native/Libraries/Core/Timers/JSTimers.js:111:14 _callTimer
    node_modules/react-native/Libraries/Core/Timers/JSTimers.js:359:16 callTimers
    (native) apply
    node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:433:33 __callFunction
    node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:113:25 anonymous
    node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:368:10 __guard
    node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:112:16 callFunctionReturnFlushedQueue

Can you reproduce the bug?

Sometimes

Reproduction Steps

Steps:

  1. It is creating a document in the synced collection with status: Pending
  2. but when we try to update the same document status it is not updating.

Version

12.5.0

What services are you using?

Atlas Device Sync

Are you using encryption?

No

Platform OS and version(s)

Android - All versions

Build environment

All versions

Cocoapods version

No response

sync-by-unito[bot] commented 4 weeks ago

➤ PM Bot commented:

Jira ticket: RJS-2808

kneth commented 3 weeks ago

The error message Sync session became inactive indicates that the device is offline, and the sync client is waiting for the connection to be established before trying to sync data.

I suggest that you add a connection listener to monitor the connectivity.

vatsal-gadhiya-searce commented 3 weeks ago

Thanks @kneth

We have observed few more bugs here in bugsnag with below error:

SIGABRT: Abort program

0 libc.so +0x830f0 abort 1 libc++_shared.so +0xd1cbc 0x73966d8cc0 2 libc++_shared.so +0xd1e70 0x73966d8e74 3 libc++_shared.so +0xe6b70 0x73966edb74 4 libc++_shared.so +0xe6528 cxa_rethrow 5 librealm.so +0x5e7b24 0x72bad28b28 6 librealm.so +0x5f1d5c 0x72bad32d60 7 librealm.so +0x5e71dc 0x72bad281e0 8 librealm.so +0x5e82c0 0x72bad292c4 9 libc.so +0xe689c __pthread_start(void*) 10 libc.so +0x84b68 start_thread

error {"weakInternal":{}} SyncError: error

kneth commented 2 weeks ago

@vatsal-gadhiya-searce Do you know under which conditions, you observe the above crashes? Do you call reconnect() in your app?

dhavalChangani commented 2 weeks ago

@kneth The above scenario happens when the app is minimized via hardware backpress and when the user opens the app again it will crash after 2-3 seconds.

we are not calling reconnect() in our app

FYI: I work in @vatsal-gadhiya-searce's team