-
Notifications
You must be signed in to change notification settings - Fork 165
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
Android 13 Backup Realm Database #6912
Comments
addition error information. i found an error in file.cpp... this error from my log /tmp/realm-java/realm/realm-library/src/main/cpp/realm-core/src/realm/util/file.cpp:1102: [realm-core-13.9.0] Assertion failed: r == 0 && "File::unlock()" with (r, (*__errno())) = [-1, 38] |
Hello, thanks for reporting this. That assertion is triggered because the system call that is invoked for unlocking the file has failed. Do you happen to have multiple threads or processes that are trying to access the same realm file? |
I actually watch an any class in our project. mostly many transaction do executeTransaction() without Thread condition and realm.close(). Only 1-2 function that i have encapsulation with Thread when i do executeTransactionAsync() or only 1 function that use realm.close(). what if any executeTransaction without realm.close() that have crash in one class especially that i have report this issue yesterday ? nb : sorry, i haven't good grammarly. but, i hope you have understand what i mean.. |
I think your problem is a more general one. |
This is a known limitation on newer versions of Android. Basically, you can no longer store Realms on external storage, unless you are backing up the file. You can see more here: #6028 (comment) |
so, how we can alternative to export realm data into .realm or more universal access such like .json ? |
i have to apologize. but, i can't do that because this project was close source |
@michaelsof47 it's not realm specific, it's the android security restrictions, you need to use Scoped Storage API's @nicola-cab @cmelchior it's been reported multiple times already #6664 #6028 #5581 #5107 #4810 #4783 #4777 #4754 Looks like pretty general pitfall at this point. Maybe we can handle it somehow better instead of crashing the app? Would it be possible to detect if flock is supported for the path and throw some exception with details? |
OK there you go, thanks @kiburtse. Maybe we can just throw an exception rather that having an assertion there? |
Since this keeps coming up. Having a specific exception message when Core is built for Android would probably be quite nice 👍 |
OK makes sense, let me add it. |
thank you very much for have produce our problem in realm version. i waiting for it |
So, ok, as discussed under linked #6926 we've probably misdiagnosed the issue before, and it may fix your problem. Most likely, locking was not needed for your usecase, but still let's keep this ticket to actually check what are constraints on external storage on real device with android 13 and api targeting Android >= 11. I've checked so far writeCopyTo with external sdcard with exFAT (it also seems we have some issues with such setup #6739), and it works fine from what i can tell, although on desktop OSes. Will check the real device with proper manifest. |
so, how to limit storage that we stored data in realm and how to make writeCopyTo work well in android 13 above or below ? |
SDK and version
SDK : Android SDK 33
Version: Android 13 (Samsung A32)
Observations
step by step :
Crash log / stacktrace
#1 pc 00000000009eb5ac /data/app/~~UExZR8o2wgDERmbmmDgl-Q==/dev.koffiesoft.com.koffiepos-V3aBg_J-gTdFrF2Fx-st-w==/lib/arm64/librealm-jni.so (BuildId: c6264775c67e2f6754b1267f9e52dbd092cfe418)
#2 pc 00000000009eb8a8 /data/app/~~UExZR8o2wgDERmbmmDgl-Q==/dev.koffiesoft.com.koffiepos-V3aBg_J-gTdFrF2Fx-st-w==/lib/arm64/librealm-jni.so (BuildId: c6264775c67e2f6754b1267f9e52dbd092cfe418)
#3 pc 00000000009eba34 /data/app/~~UExZR8o2wgDERmbmmDgl-Q==/dev.koffiesoft.com.koffiepos-V3aBg_J-gTdFrF2Fx-st-w==/lib/arm64/librealm-jni.so (BuildId: c6264775c67e2f6754b1267f9e52dbd092cfe418)
#4 pc 00000000009d9950 /data/app/~~UExZR8o2wgDERmbmmDgl-Q==/dev.koffiesoft.com.koffiepos-V3aBg_J-gTdFrF2Fx-st-w==/lib/arm64/librealm-jni.so (BuildId: c6264775c67e2f6754b1267f9e52dbd092cfe418)
#5 pc 00000000009d7160 /data/app/~~UExZR8o2wgDERmbmmDgl-Q==/dev.koffiesoft.com.koffiepos-V3aBg_J-gTdFrF2Fx-st-w==/lib/arm64/librealm-jni.so (BuildId: c6264775c67e2f6754b1267f9e52dbd092cfe418)
#6 pc 0000000000923ba4 /data/app/~~UExZR8o2wgDERmbmmDgl-Q==/dev.koffiesoft.com.koffiepos-V3aBg_J-gTdFrF2Fx-st-w==/lib/arm64/librealm-jni.so (BuildId: c6264775c67e2f6754b1267f9e52dbd092cfe418)
#7 pc 00000000006f114c /data/app/~~UExZR8o2wgDERmbmmDgl-Q==/dev.koffiesoft.com.koffiepos-V3aBg_J-gTdFrF2Fx-st-w==/lib/arm64/librealm-jni.so (BuildId: c6264775c67e2f6754b1267f9e52dbd092cfe418)
#8 pc 00000000006486c4 /data/app/~~UExZR8o2wgDERmbmmDgl-Q==/dev.koffiesoft.com.koffiepos-V3aBg_J-gTdFrF2Fx-st-w==/lib/arm64/librealm-jni.so (Java_io_realm_internal_OsSharedRealm_nativeWriteCopy+692) (BuildId: c6264775c67e2f6754b1267f9e52dbd092cfe418)
#11 pc 00000000004deb56 [anon:dalvik-classes.dex extracted in memory from /data/app/~~UExZR8o2wgDERmbmmDgl-Q==/dev.koffiesoft.com.koffiepos-V3aBg_J-gTdFrF2Fx-st-w==/base.apk] (io.realm.internal.OsSharedRealm.writeCopy+78)
#13 pc 00000000004b34fc [anon:dalvik-classes.dex extracted in memory from /data/app/~~UExZR8o2wgDERmbmmDgl-Q==/dev.koffiesoft.com.koffiepos-V3aBg_J-gTdFrF2Fx-st-w==/base.apk] (io.realm.BaseRealm.writeCopyTo+16)
#15 pc 00000000004d4574 [anon:dalvik-classes.dex extracted in memory from /data/app/~~UExZR8o2wgDERmbmmDgl-Q==/dev.koffiesoft.com.koffiepos-V3aBg_J-gTdFrF2Fx-st-w==/base.apk] (io.realm.Realm.writeCopyTo+0)
Steps & Code to Reproduce
The text was updated successfully, but these errors were encountered: