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

BadVersionException OR N5realm11SharedGroup10BadVersionE #6310

Closed
telvinqburst opened this issue Nov 22, 2018 · 7 comments
Closed

BadVersionException OR N5realm11SharedGroup10BadVersionE #6310

telvinqburst opened this issue Nov 22, 2018 · 7 comments

Comments

@telvinqburst
Copy link

telvinqburst commented Nov 22, 2018

Goal

I am trying to delete realm file programmatically and create new realm file each time a new user logs into the app. When I create a new realm file with same name as previously deleted file and try to use realm defatult instance to query in the new realm file, crash occurs.

Actual Results

E/REALM: uncaught exception in notifier thread: N5realm11SharedGroup10BadVersionE: std::exception
    
    --------- beginning of crash
11-22 11:39:07.678 6631-6728/com.abc.abc A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 6728 (hcare.foresight)
11-22 11:39:07.747 6927-6927/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    Build fingerprint: 'google/sdk_google_phone_x86/generic_x86:7.0/NYC/4409132:user/release-keys'
    Revision: '0'
    ABI: 'x86'
    pid: 6631, tid: 6728, name: abc.abc  >>> com.abc.abc <<<
    signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
        eax 00000000  ebx 000019e7  ecx 00001a48  edx 00000006
        esi 88c9b978  edi 88c9b920
        xcs 00000073  xds 0000007b  xes 0000007b  xfs 0000003b  xss 0000007b
        eip a7ba6424  ebp 88c9b778  esp 88c9b71c  flags 00000292
11-22 11:39:07.767 6927-6927/? A/DEBUG: backtrace:
        #00 pc ffffe424  [vdso:a7ba6000] (__kernel_vsyscall+16)
        #01 pc 0007a00c  /system/lib/libc.so (tgkill+28)
        #02 pc 00075855  /system/lib/libc.so (pthread_kill+85)
        #03 pc 0002782a  /system/lib/libc.so (raise+42)
        #04 pc 0001ee06  /system/lib/libc.so (abort+86)
        #05 pc 00271ba4  /data/app/com.abc.abc-1/lib/x86/librealm-jni.so (_ZN9__gnu_cxx27__verbose_terminate_handlerEv+452)
        #06 pc 0023f217  /data/app/com.abc.abc-1/lib/x86/librealm-jni.so (_ZN10__cxxabiv111__terminateEPFvvE+23)
        #07 pc 0023f2af  /data/app/com.abc.abc-1/lib/x86/librealm-jni.so (_ZSt9terminatev+31)
        #08 pc 002707ed  /data/app/com.abc.abc-1/lib/x86/librealm-jni.so
        #09 pc 00074fb2  /system/lib/libc.so (_ZL15__pthread_startPv+210)
11-22 11:39:07.768 6927-6927/? A/DEBUG:     #10 pc 0002026e  /system/lib/libc.so (__start_thread+30)
        #11 pc 0001e046  /system/lib/libc.so (__bionic_clone+70) -->

Steps & Code to Reproduce

Scenario:
1, First realm file is created - "USER1.realm"
2, Delete "USER1.realm" and create new realm file for user 2 - "USER2.realm"
3, Delete "USER2.realm" and create new realm file for user 1 - "USER1.realm"
4, Crash happens on using Realm.getDefaultInstance().

realmConfiguration = new RealmConfiguration.Builder()
.name(encryptKeyProvider + ".realm")
.initialData(new InitialData())
.schemaVersion(REALM_SCHEMA_VERSION)
.encryptionKey(key)
.deleteRealmIfMigrationNeeded()
.build();

Version of Realm and tooling

Realm version(s): 5.8.0

Realm Sync feature enabled: No

Android Studio version: 3.1.4

Android Build Tools version: 27

Gradle version: 3.2.1

Which Android version and device(s): For all device

@Zhuinden
Copy link
Contributor

I assume the Realm file is deleted but it hadn't been closed properly first on all threads and all instances.

@telvinqburst
Copy link
Author

@Zhuinden Can you share any reference or documentation on who to properly close Realm instances?

@Zhuinden
Copy link
Contributor

@cmelchior
Copy link
Contributor

@telvinqburst How exactly are you deleting the files?
If you use Realm.deleteRealm(config) it should warn you if it isn't safe to close the Realm. Trying to do it manually is undefined behavior, but I suspect the error you see could be because of it.

@cmelchior
Copy link
Contributor

Closing due to inactivity. Please re-open if this is still an issue.

@Yashshree
Copy link

i am also getting the same issue.
ext.realm_version = '0.85.1'
classpath 'io.realm:realm-gradle-plugin:5.0.0'
please help

@Zhuinden
Copy link
Contributor

Zhuinden commented Sep 5, 2019

So is it 0.85.0 or 5.0.0? Why do you have 2 different versions of Realm in your project??

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants