Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
vatsal-gadhiya-searce opened this issue Apr 19, 2024 · 9 comments
Labels
Encryption:Off O-Community Repro:No SDK-Use:Sync T-Bug Waiting-For-Reporter Waiting for more information from the reporter before we can proceed

Comments

@vatsal-gadhiya-searce
Copy link

vatsal-gadhiya-searce commented Apr 19, 2024

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

Copy link

sync-by-unito bot commented Apr 19, 2024

➤ PM Bot commented:

Jira ticket: RJS-2808

@kneth
Copy link
Contributor

kneth commented Apr 22, 2024

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.

@sync-by-unito sync-by-unito bot added the Waiting-For-Reporter Waiting for more information from the reporter before we can proceed label Apr 22, 2024
@vatsal-gadhiya-searce
Copy link
Author

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

@github-actions github-actions bot added Needs-Attention Reporter has responded. Review comment. and removed Waiting-For-Reporter Waiting for more information from the reporter before we can proceed labels Apr 23, 2024
@kneth
Copy link
Contributor

kneth commented May 3, 2024

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

@sync-by-unito sync-by-unito bot added Waiting-For-Reporter Waiting for more information from the reporter before we can proceed and removed Needs-Attention Reporter has responded. Review comment. labels May 3, 2024
@dhavalChangani
Copy link

@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

@Premshankar-Searce
Copy link

@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!

@kneth
Copy link
Contributor

kneth commented Aug 15, 2024

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?

@Premshankar-Searce
Copy link

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?

@kneth
Copy link
Contributor

kneth commented Aug 16, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Encryption:Off O-Community Repro:No SDK-Use:Sync T-Bug Waiting-For-Reporter Waiting for more information from the reporter before we can proceed
Projects
None yet
Development

No branches or pull requests

4 participants