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
Error: Operation not permitted in io_realm_internal_SharedGroup.cpp #3140
Comments
Hi @snakeice The argument in Can you provide the path that |
Hello, the boolean passed to the method is to return the file name only .. It returns /mnt/sdcard/android/data/br.com.jbsoft.mobile/files/database/ |
Can you share the code for On newer devices you'd need the runtime permission to write to an external directory, but you must also consider that the SD card isn't mountable at the time. |
Yes, on Android 6 the permission policies are a bit more rigid. Maybe https://webrtchacks.com/android-m-app-permissions/ can help you. |
Does |
@Zhuinden the code is: public static boolean isExternalStorageWritable() {
String state = Environment.getExternalStorageState();
return Environment.MEDIA_MOUNTED.equals(state) && Environment.getExternalStorageDirectory()
.canWrite();
} @kneth I ask all permissions during application startup for Android 6.0. @zaki50 Yes, he's created, tested to manually create.. |
@snakeice I confirmed this issue and found the root cause. Realm creates named pipe file, but Android's security system(SELinux) prohibits to create it on external storage. To solve this issue, we need to fix Realm core. |
memo: To set SELinux to permissive mode, execute following commands to rooted device.
|
Got Similar bug while trying to create Realm on external storage directory. 09-04 21:01:15.121: D/REALM(32175): jni: ThrowingException 11, Operation not permitted in io_realm_internal_SharedGroup.cpp line 113, Any timelines for the fix ? For now rolling back to 1.0.0 :( |
@ankitbabbar89 considering you're trying to write the Realm on external storage directory which the SELinux of the Android Kernel will block, it's not really something that Realm can fix too quickly. |
I got a crash related to similar issue, the only difference is that I had not specified any directory explicitly, which means that it should have used internal storage to store the file. It has been working on all the devices, it's just one time that I have faced this issue. Is it because of something else? Also, would the behaviour differ based on the type of context being used (ApplicationContext or ActivityContext)? Stacktrace: Fatal Exception: io.realm.exceptions.RealmError: Unrecoverable error. Permission denied in io_realm_internal_SharedGroup.cpp line 113 |
@nishkarsh Your issue is something else. Can you reproduce it with any device you have? |
@beeender I couldn't produce the issue on any device without doing any changes. However, I tried using the app on a phone that had SD card and had to explicitly specify to use external storage to store realm and that threw exactly the same exception. Was using realm 1.1.1 if that helps. The crash occurred on Lenovo P1a42 with Android 5.1.1 |
@nishkarsh Thanks for the information. I am not quite what kind of tricks does the Lenovo phone made to the storage management. We will fix the external issue first then try if we can find a phone like that to test. |
More info from #3413 which should be the same issue. Thank you for making Realm bug free but there is still one issue.
The above log is from playstore this is from Crashlytics. http://crashes.to/s/305f76efbc2 I have been using Realm before 0.70.0 and this bug is there since the beginning. Almost 5 out of 400 daily users who download my app are experiencing it. Version of Realm and toolingRealm version(s): ? 1.2.1 Android Studio version: ? 2.1.1 Which Android version and device: ? |
Hi @zaki50 is this issue going to be addressed in the 2.0 milestone? Thanks for your support. |
@drjunior sorry for my late reply. I heard that core team had finished implementing required features. I'll take a look. |
@zaki50 thanks for the update. I will wait for your final answer. |
I have same problem after update from realm version 0.77.0
Version of Realm and tooling: |
@rimidalv is the Realm opened in internal storage, or external storage? |
Environment.getExternalStorageDirectory() - and it doesn't work. I tried versions 1.0.0 and upper. |
Huh. Can you try version 0.88.3? It works with the Gradle plugin solution, just like 1.2.0. I found that to be most stable (with minimum changes) before 1.0.0 (which already had this external write problem if I recall right, although you can try that too if you want) |
0.88.3 - works fine |
0.89.0 - doesn't work |
@rimidalv in that case, use 0.88.3 in the meantime, it's actually fairly stable in my experience :) Just keep in mind that you still need to reverse iterate the RealmResults, do not use foreach loop yet, and I'd recommend sticking to the synchronous query API. |
Hi @zaki50 and @Zhuinden, I've just updated to 2.0 and the crash continues occurring. Was the issue addressed in 2.0 ? Sorry for being asking again but this is quite important. |
I've confirmed that realm-core has the option parameter to avoid this. https://github.com/realm/realm-core/blob/v2.1.1/src/realm/group_shared_options.hpp#L40 TODO:
|
I made a PR #3591 and realm/realm-object-store#191. final File externalFilesDir = context.getExternalFilesDir(null);
final RealmConfiguration config = new RealmConfiguration.Builder()
.directory(externalFilesDir)
.name("ext.realm")
.build();
final Realm realm = Realm.getInstance(config);
realm.close(); |
Got similar exceptions here, and we are using the internal storage.
And it comes with another,
So these two exceptions are the same(on different device)? |
I have the exact same issue as the commenter above:
This is on Realm 2.1.1 |
Goal
Actual Results
io.realm.exceptions.RealmError: Unrecoverable error. Operation not permitted in io_realm_internal_SharedGroup.cpp line 113
at io.realm.internal.SharedGroup.createNativeWithImplicitTransactions(Native Method)
at io.realm.internal.SharedGroup.openSharedGroupOrFail(SharedGroup.java:95)
at io.realm.internal.SharedGroup.<init>(SharedGroup.java:74)
at io.realm.internal.SharedGroupManager.<init>(SharedGroupManager.java:49)
at io.realm.BaseRealm.<init>(BaseRealm.java:81)
at io.realm.Realm.<init>(Realm.java:140)
at io.realm.Realm.createAndValidate(Realm.java:240)
at io.realm.Realm.createInstance(Realm.java:220)
at io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:126)
at io.realm.Realm.getDefaultInstance(Realm.java:166)
at br.com.jbsoft.mobile.di.modules.ProviderModule.provideRealm(ProviderModule.java:28)
at br.com.jbsoft.mobile.di.modules.ProviderModule_ProvideRealmFactory.get(ProviderModule_ProvideRealmFactory.java:19)
at br.com.jbsoft.mobile.di.modules.ProviderModule_ProvideRealmFactory.get(ProviderModule_ProvideRealmFactory.java:8)
at br.com.jbsoft.mobile.models.ControleUsuario_MembersInjector.injectMembers(ControleUsuario_MembersInjector.java:33)
at br.com.jbsoft.mobile.models.ControleUsuario_MembersInjector.injectMembers(ControleUsuario_MembersInjector.java:9)
at br.com.jbsoft.mobile.di.components.DaggerProviderComponent.inject(DaggerProviderComponent.java:243)
at br.com.jbsoft.mobile.models.ControleUsuario.inject(ControleUsuario.java:31)
at br.com.jbsoft.mobile.models.ControleUsuario.getUsuario(ControleUsuario.java:35)
at br.com.jbsoft.mobile.views.Main.onCreate(Main.java:59)
at br.com.jbsoft.mobile.componentes.BaseActivity.onCreate(BaseActivity.java:86)
at android.app.Activity.performCreate(Activity.java:6500)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1120)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3072)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3218)
at android.app.ActivityThread.access$1000(ActivityThread.java:198)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1676)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6837)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
Steps & Code to Reproduce
Code Sample
My config
and getCaminhoDB:
getKeyDef():
Version of Realm and tooling
Realm version(s): 1.1.0
Android Studio version: 2.1.2
Which Android version and device: I test with Emulator (Android 6.0) and Xiaomi redmi 2 prime (Android 4.4)
The text was updated successfully, but these errors were encountered: