Getting Error “Sync session became inactive” unhandled error
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:
- It is creating a document in the synced collection with status: Pending
- 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
➤ PM Bot commented:
Jira ticket: RJS-2808
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.
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
@vatsal-gadhiya-searce Do you know under which conditions, you observe the above crashes? Do you call reconnect() in your app?
@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
@kneth Could you please clarify where the "promise rejection tracking" error is originating from? We are observing an unhandled error that seems unrelated to the sync configuration we have set:
sync={{
flexible: true,
onError: handleSyncError,
}}
The error isn't being captured by the onError handler in our sync setup, and we are trying to determine the source of this issue. Any guidance would be greatly appreciated!
A promise rejection tracking is RN's way to say that a rejected promise hasn't been handled. As you give a very short code snippet and no context, it is difficult to say where it comes from. It could be a timeout when opening the database (you are calling Realm.open() indirectly. Do you have a [fallback[(https://github.com/realm/realm-js/blob/main/packages/realm-react/src/RealmProvider.tsx#L49) for the RealmProvider? If so, can you get any useful information here?
Yes, we're using the fallback component, but we're still encountering the "Sync session became inactive" warning. This error consistently appears on the main devices whenever the app starts up. Is there a way to prevent this or handle it more effectively?
Sync session became inactive indicates that the device has been disconnected. It is only a warning, and the sync client will automatically try to establish the connection. You can check the connection if needed.