Realm Sync: Multiple sync agents attempted to join the same session

I’m using realm SDK version 10.2.0 to build a solution through React Native for android and ios. I’m utilizing the synced realms, and am encountering a situation when my application is idle for some time and then resumed with some action (probably triggering sync), the app crashes with an error: Multiple sync agents attempted to join the same session. Following is the way I’m getting the realm instance in my application.

export async function getRealm(schemaArray, partitionValue) {
const app = new Realm.App(appConfig);
if (app.currentUser) {
    // A user had already logged in - open the Realm synchronously
    return new Realm(getConfig(app.currentUser, partitionValue, schemaArray));
}
// We don't have a user - login a user and open the realm async
const user = await app.logIn(Realm.Credentials.anonymous());
return await Realm.open(getConfig(user, partitionValue, schemaArray));
}

Following is the crash log.

A/libc: /Volumes/Android/buildbot/src/android/ndk-release-r21/external/libcxx/../../external/libcxxabi/src/abort_message.cpp:72: abort_message: assertion "terminating with uncaught exception of type realm:**:**MultipleSyncAgents: Multiple sync agents attempted to join the same session****

 Exception backtrace:
 <backtrace not supported on this platform>" failed
 E/ResolverController: No valid NAT64 prefix (100, <unspecified>/0)
 A/libc: Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 25250 (mqt_js), pid 24897 (ningexpress_dev)
 E/GnssHAL_GnssInterface: gnssSvStatusCb: a: input svInfo.flags is 8
 E/GnssHAL_GnssInterface: gnssSvStatusCb: b: input svInfo.flags is 8
 I/crash_dump32: obtaining output fd from tombstoned, type: kDebuggerdTombstone
 //system/bin/tombstoned: received crash request for pid 25250
 I/crash_dump32: performing dump of process 24897 (target tid = 25250)
 2021-02-12 18:25:52.586 14319-20737/system_process W/AppOps: Noting op not finished: uid 10102 pkg com.google.android.gms code 41 time=1613134547560 duration=0
 A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
 A/DEBUG: Build fingerprint: 'google/sdk_gphone_x86/generic_x86:10/QSR1.191030.002/5978551:userdebug/dev-keys'
 A/DEBUG: Revision: '0'
 A/DEBUG: ABI: 'x86'
 A/DEBUG: Timestamp: 2021-02-12 18:25:52+0530
 A/DEBUG: pid: 24897, tid: 25250, name: mqt_js  >>> application id <<<
 A/DEBUG: uid: 10142
 A/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
 A/DEBUG: Abort message: '/Volumes/Android/buildbot/src/android/ndk-release-r21/external/libcxx/../../external/libcxxabi/src/abort_message.cpp:72: abort_message: assertion "terminating with uncaught exception of type realm::MultipleSyncAgents: Multiple sync agents attempted to join the same session
 Exception backtrace:
 <backtrace not supported on this platform>" failed'
 eax 00000000  ebx 00006141  ecx 000062a2  edx 00000006
 edi e900433e  esi bf9b4920
 ebp ebe8fad0  esp bf9b48c8  eip ebe8fad9
 backtrace:
 #00 pc 00000ad9  [vdso] (__kernel_vsyscall+9)
 #01 pc 00092328  /apex/com.android.runtime/lib/bionic/libc.so (syscall+40) (BuildId: 76290498408016ad14f4b98c3ab6c65c)
 #02 pc 000ad651  /apex/com.android.runtime/lib/bionic/libc.so (abort+193) (BuildId: 76290498408016ad14f4b98c3ab6c65c)
 #03 pc 000adb88  /apex/com.android.runtime/lib/bionic/libc.so (__assert2+56) (BuildId: 76290498408016ad14f4b98c3ab6c65c)
 #04 pc 00c9ecd4  /data/app/package-name-PRMrj8IQe-5z3AuNakDn_A==/lib/x86/librealmreact.so (BuildId: 9873d3b7765d63f3711304dbfa4831f71d2ca436)
 #05 pc 00c9ee3e  /data/app/package-name-PRMrj8IQe-5z3AuNakDn_A==/lib/x86/librealmreact.so (BuildId: 9873d3b7765d63f3711304dbfa4831f71d2ca436)
 #06 pc 00c9b809  /data/app/package-name-PRMrj8IQe-5z3AuNakDn_A==/lib/x86/librealmreact.so (BuildId: 9873d3b7765d63f3711304dbfa4831f71d2ca436)
 #07 pc 00c9af05  /data/app/package-name-PRMrj8IQe-5z3AuNakDn_A==/lib/x86/librealmreact.so (__cxa_rethrow+229) (BuildId: 9873d3b7765d63f3711304dbfa4831f71d2ca436)
 #08 pc 006a9ae3  /data/app/package-name-PRMrj8IQe-5z3AuNakDn_A==/lib/x86/librealmreact.so (BuildId: 9873d3b7765d63f3711304dbfa4831f71d2ca436)
 #09 pc 006cab03  /data/app/package-name-PRMrj8IQe-5z3AuNakDn_A==/lib/x86/librealmreact.so (BuildId: 9873d3b7765d63f3711304dbfa4831f71d2ca436)
 #10 pc 006ca892  /data/app/package-name-PRMrj8IQe-5z3AuNakDn_A==/lib/x86/librealmreact.so (BuildId: 9873d3b7765d63f3711304dbfa4831f71d2ca436)
 #11 pc 006a171e  /data/app/package-name-PRMrj8IQe-5z3AuNakDn_A==/lib/x86/librealmreact.so (BuildId: 9873d3b7765d63f3711304dbfa4831f71d2ca436)
 #12 pc 0057c8a8  /data/app/package-name-PRMrj8IQe-5z3AuNakDn_A==/lib/x86/librealmreact.so (BuildId: 9873d3b7765d63f3711304dbfa4831f71d2ca436)
 #13 pc 0057c6e9  /data/app/package-name-PRMrj8IQe-5z3AuNakDn_A==/lib/x86/librealmreact.so (BuildId: 9873d3b7765d63f3711304dbfa4831f71d2ca436)
 #14 pc 0057c655  /data/app/package-name-PRMrj8IQe-5z3AuNakDn_A==/lib/x86/librealmreact.so (BuildId: 9873d3b7765d63f3711304dbfa4831f71d2ca436)
 #15 pc 0057c290  /data/app/package-name-PRMrj8IQe-5z3AuNakDn_A==/lib/x86/librealmreact.so (BuildId: 9873d3b7765d63f3711304dbfa4831f71d2ca436)
 #16 pc 0011a8e5  /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+53) (BuildId: 76290498408016ad14f4b98c3ab6c65c)
 #17 pc 000af6a7  /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+71) (BuildId: 76290498408016ad14f4b98c3ab6c65c)
 2021-02-12 18:25:53.504 1793-14581/? E/GnssHAL_GnssInterface: gnssSvStatusCb: a: input svInfo.flags is 8

Would really appreciate any help on this. Thanks.

Hi there!

I have the same issue, did somebody find a solution?

Thanks

I’m not sure if it can help, but I encountered the same issue with my iOS app. That crash occurred each time I would launch my app with the .realm file open in realm studio.

2 Likes