realm / realm-java

Realm is a mobile database: a replacement for SQLite & ORMs
http://realm.io
Apache License 2.0
11.45k stars 1.75k forks source link

[bug]io.realm.exceptions.RealmError: Unrecoverable error. Permission denied in /Users/cm/Realm/realm-java-release/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp line 101 #7614

Closed RealMoMo closed 2 years ago

RealMoMo commented 2 years ago

How frequently does the bug occur?

All the time

Description

init realm database crash.

   Realm.init(mContext)
        Realm.setDefaultConfiguration(
            RealmConfiguration.Builder()
                .deleteRealmIfMigrationNeeded()
                .build())

        mRealm = Realm.getDefaultInstance()

just this Android platform crash

Stacktrace & log output

2021-12-10 09:36:52.709 8102-8102/? W/ContextImpl: Calling a method in the system process without a qualified user: android.app.ContextImpl.startService:1531 android.content.ContextWrapper.startService:737 android.content.ContextWrapper.startService:737 com.dss.floatball.MainActivity.startFloatballService:28 com.dss.floatball.MainActivity.onCreate:22 
2021-12-10 09:36:52.749 8102-8102/? W/m.dss.floatball: type=1400 audit(0.0:2021): avc: denied { create } for name="access_control.new_commit.cv" scontext=u:r:system_app:s0 tcontext=u:object_r:system_app_data_file:s0 tclass=fifo_file permissive=0
2021-12-10 09:36:52.749 8102-8102/? W/m.dss.floatball: type=1400 audit(0.0:2022): avc: denied { create } for name="realm_3450613743.cv" scontext=u:r:system_app:s0 tcontext=u:object_r:system_app_data_file:s0 tclass=fifo_file permissive=0
2021-12-10 09:36:52.758 8102-8102/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.dss.floatball, PID: 8102
    io.realm.exceptions.RealmError: Unrecoverable error. Permission denied in /Users/cm/Realm/realm-java-release/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp line 101
        at io.realm.internal.OsSharedRealm.nativeGetSharedRealm(Native Method)
        at io.realm.internal.OsSharedRealm.<init>(OsSharedRealm.java:171)
        at io.realm.internal.OsSharedRealm.getInstance(OsSharedRealm.java:241)
        at io.realm.internal.OsSharedRealm.getInstance(OsSharedRealm.java:231)
        at io.realm.RealmCache.doCreateRealmOrGetFromCache(RealmCache.java:337)
        at io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:290)
        at io.realm.Realm.getDefaultInstance(Realm.java:407)
        at com.dss.floatball.data.function.RealmDatabaseRepository.<init>(RealmDatabaseRepository.kt:38)
        at com.dss.floatball.data.function.FunctionRepository.<init>(FunctionRepository.kt:45)
        at com.dss.floatball.data.function.FunctionRepository.<init>(Unknown Source:0)
        at com.dss.floatball.data.function.FunctionRepository$Companion.getInstance(FunctionRepository.kt:31)
        at com.dss.floatball.ui.floatball.FloatBallServiceDelegatePresenter.<init>(FloatBallServiceDelegatePresenter.kt:25)
        at com.dss.floatball.ui.floatball.service.FloatBallServiceViewDelegate.<init>(FloatBallServiceViewDelegate.kt:114)
        at com.dss.floatball.ui.floatball.service.FloatBallService.onCreate(FloatBallService.kt:41)
        at android.app.ActivityThread.handleCreateService(ActivityThread.java:3532)
        at android.app.ActivityThread.access$1300(ActivityThread.java:199)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1666)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:860)
2021-12-10 09:36:52.759 2658-2658/? D/MTK_KL: 36,5884,408560318,-;type=1400 audit(1639100212.749:2021): avc: denied { create } for pid=8102 comm="m.dss.floatball" name="access_control.new_commit.cv" scontext=u:r:system_app:s0 tcontext=u:object_r:system_app_data_file:s0 tclass=fifo_file permissive=0
2021-12-10 09:36:52.759 2658-2658/? D/MTK_KL: 36,5885,408560680,-;type=1400 audit(1639100212.749:2021): avc: denied { create } for pid=8102 comm="m.dss.floatball" name="access_control.new_commit.cv" scontext=u:r:system_app:s0 tcontext=u:object_r:system_app_data_file:s0 tclass=fifo_file permissive=0
2021-12-10 09:36:52.759 2658-2658/? D/MTK_KL: 36,5886,408560689,-;type=1400 audit(1639100212.749:2022): avc: denied { create } for pid=8102 comm="m.dss.floatball" name="realm_3450613743.cv" scontext=u:r:system_app:s0 tcontext=u:object_r:system_app_data_file:s0 tclass=fifo_file permissive=0
2021-12-10 09:36:52.762 3589-3601/? D/MonitorActivityController: processName: com.dss.floatball
2021-12-10 09:36:52.805 3123-4857/? I/ActivityManager: Process com.dss.floatball (pid 8102) has died: fore TOP 
2021-12-10 09:36:52.806 3123-4857/? W/ActivityManager: Scheduling restart of crashed service com.dss.floatball/.ui.floatball.service.FloatBallService in 1000ms
2021-12-10 09:36:52.811 2614-2730/? W/SurfaceFlinger: Attempting to set client state on removed layer: Splash Screen com.dss.floatball#0
2021-12-10 09:36:52.811 2614-2730/? W/SurfaceFlinger: Attempting to destroy on removed layer: Splash Screen com.dss.floatball#0
2021-12-10 09:36:52.813 3123-4015/? D/DssTPManager: [deleteLayer]binder:android.view.ViewRootImpl$W@32da496 type:3 pkg:com.dss.floatball Visibility:0 w:3840 h:2160 left:0 top:0 right:3840 bottom:2160
2021-12-10 09:36:52.813 3940-3980/? D/PenetratePresenter: [deleteBlockLayer]binder:android.view.ViewRootImpl$W@32da496 type:3 pkg:com.dss.floatball Visibility:0 w:3840 h:2160 left:0 top:0 right:3840 bottom:2160
2021-12-10 09:36:52.817 2614-2726/? W/SurfaceFlinger: Attempting to destroy on removed layer: AppWindowToken{23dbbe token=Token{5a2c279 ActivityRecord{5a47340 u0 com.dss.floatball/.MainActivity t66}}}#0
2021-12-10 09:36:52.820 3940-3980/? I/MAXHUB-PenetratePresenter: │ [Binder:3940_3] deleteBlockLayer (PenetratePresenter.java:149) - [Hook][deleteBlockLayer]binder:android.view.ViewRootImpl$W@32da496 type:3 pkg:com.dss.floatball Visibility:0 w:3840 h:2160 left:0 top:0 right:3840 bottom:2160
2021-12-10 09:36:52.863 7011-7065/com.dss.welcome D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
2021-12-10 09:36:52.869 2614-2730/? W/SurfaceFlinger: Attempting to set client state on removed layer: Surface(name=AppWindowToken{be01fb3 token=Token{b587922 ActivityRecord{323a6ed u0 com.dss.welcome/.display.DisplayActivity t63}}})/@0x3bf1c7 - animation-leash#0
2021-12-10 09:36:52.869 2614-2730/? W/SurfaceFlinger: Attempting to destroy on removed layer: Surface(name=AppWindowToken{be01fb3 token=Token{b587922 ActivityRecord{323a6ed u0 com.dss.welcome/.display.DisplayActivity t63}}})/@0x3bf1c7 - animation-leash#0
2021-12-10 09:36:52.858 3123-4015/? D/DssTPManager: [blockTransfer]binder:android.os.BinderProxy@c7944cc type:1 pkg:com.dss.welcome Visibility:0 w:3840 h:2160 left:0 top:0 right:3840 bottom:2160
2021-12-10 09:36:52.870 3940-3980/? D/PenetratePresenter: [updateBlockArea]binder:android.os.BinderProxy@c7944cc type:1 pkg:com.dss.welcome Visibility:0 w:3840 h:2160 left:0 top:0 right:3840 bottom:2160
2021-12-10 09:36:52.872 4192-4674/? V/SDKServiceBinder: .
    [com.dss.tpservice]
    [send] com.seewo.sdk.internal.command.touch.CmdAddOrUpdateNoTouchArea {"area":{"bottom":2160,"empty":false,"left":0,"right":3840,"top":0},"isCableTouchEnable":true,"widgetId":257931846}
2021-12-10 09:36:52.922 4192-4674/? V/SDKServiceBinder: .
    [com.dss.tpservice]
    [response] {"paramsJson":"{\"result\":33}","responseName":"RespIntegerResult","status":"SUCCESS"}
2021-12-10 09:36:52.923 3940-3980/? D/RemoteAction: [updateBlockArea] id : 257931846 binder:android.os.BinderProxy@c7944cc type:1 pkg:com.dss.welcome Visibility:0 w:3840 h:2160 left:0 top:0 right:3840 bottom:2160 rLeft : 0 rTop : 0 rRight : 3840 rBottom : 2160
2021-12-10 09:36:52.927 7011-7011/com.dss.welcome I/FridayReportSDK: SessionManager.java|onResume|76|Extend current session: 78F52CD536EDE5716C15E5D00A68A1C4
2021-12-10 09:36:52.928 7011-7011/com.dss.welcome D/CrashReport: >>> com.dss.welcome.display.DisplayActivity onResumed <<<
2021-12-10 09:36:53.829 3123-3172/? I/ActivityManager: Start proc 8129:com.dss.floatball/1000 for service com.dss.floatball/.ui.floatball.service.FloatBallService
2021-12-10 09:36:53.836 8129-8129/? E/m.dss.floatbal: Not starting debugger since process cannot load the jdwp agent.
2021-12-10 09:36:53.889 8129-8129/? W/m.dss.floatball: type=1400 audit(0.0:2023): avc: denied { create } for name="access_control.new_commit.cv" scontext=u:r:system_app:s0 tcontext=u:object_r:system_app_data_file:s0 tclass=fifo_file permissive=0
2021-12-10 09:36:53.889 8129-8129/? W/m.dss.floatball: type=1400 audit(0.0:2024): avc: denied { create } for name="realm_3450613743.cv" scontext=u:r:system_app:s0 tcontext=u:object_r:system_app_data_file:s0 tclass=fifo_file permissive=0
2021-12-10 09:36:53.897 8129-8129/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.dss.floatball, PID: 8129
    io.realm.exceptions.RealmError: Unrecoverable error. Permission denied in /Users/cm/Realm/realm-java-release/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp line 101
        at io.realm.internal.OsSharedRealm.nativeGetSharedRealm(Native Method)
        at io.realm.internal.OsSharedRealm.<init>(OsSharedRealm.java:171)
        at io.realm.internal.OsSharedRealm.getInstance(OsSharedRealm.java:241)
        at io.realm.internal.OsSharedRealm.getInstance(OsSharedRealm.java:231)
        at io.realm.RealmCache.doCreateRealmOrGetFromCache(RealmCache.java:337)
        at io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:290)
        at io.realm.Realm.getDefaultInstance(Realm.java:407)
        at com.dss.floatball.data.function.RealmDatabaseRepository.<init>(RealmDatabaseRepository.kt:38)
        at com.dss.floatball.data.function.FunctionRepository.<init>(FunctionRepository.kt:45)
        at com.dss.floatball.data.function.FunctionRepository.<init>(Unknown Source:0)
        at com.dss.floatball.data.function.FunctionRepository$Companion.getInstance(FunctionRepository.kt:31)
        at com.dss.floatball.ui.floatball.FloatBallServiceDelegatePresenter.<init>(FloatBallServiceDelegatePresenter.kt:25)
        at com.dss.floatball.ui.floatball.service.FloatBallServiceViewDelegate.<init>(FloatBallServiceViewDelegate.kt:114)
        at com.dss.floatball.ui.floatball.service.FloatBallService.onCreate(FloatBallService.kt:41)
        at android.app.ActivityThread.handleCreateService(ActivityThread.java:3532)
        at android.app.ActivityThread.access$1300(ActivityThread.java:199)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1666)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:860)

Can you reproduce the bug?

Yes, always

Reproduction Steps

No response

Version

"io.realm:realm-gradle-plugin:6.0.2"

What SDK flavour are you using?

Local Database only

Are you using encryption?

No, not using encryption

Platform OS and version(s)

Android9.0

Build environment

Android Studio version:Arctic fox compileSdkVersion 30 buildToolsVersion "30.0.3" Gradle version: com.android.tools.build:gradle:4.2.2

rorbech commented 2 years ago

Hi @RealMoMo

Can you share some details on the frequency of this and the devices where you are seeing this?

yushengnan1 commented 2 years ago

maybe you can delete " android:sharedUserId="android.uid.system" " in AndroidManifest.xml.

rt1shnik commented 2 years ago

I also discovered this crash on my Firebase Crashlytics. I am got about 400 the same crash reports from one user. Crash happens on app start, on Pixel 5 with Android 11, but I don't find any issue on Android 11 emulator. App has targetApi 29, realm-gradle-plugin:6.1.0

Fatal Exception: io.realm.exceptions.RealmError: Unrecoverable error. Permission denied in /Users/cm/Realm/realm-java-release/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp line 101
       at io.realm.internal.OsSharedRealm.nativeGetSharedRealm(OsSharedRealm.java)
       at io.realm.internal.OsSharedRealm.<init>(OsSharedRealm.java:171)
       at io.realm.internal.OsSharedRealm.getInstance(OsSharedRealm.java:241)
       at io.realm.internal.OsSharedRealm.getInstance(OsSharedRealm.java:231)
       at io.realm.RealmCache.doCreateRealmOrGetFromCache(RealmCache.java:337)
       at io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:290)
       at io.realm.Realm.getDefaultInstance(Realm.java:407)
cmelchior commented 2 years ago

@RealMoMo The version of Realm Java you are using is rather old. I will recommend upgrading to the latest version, and if you still see this issue after that, either reopen this or create a new issue. But ideally we need more information about where this is happening. Especially if it happens on multiple devices, and in that case, which ones.

This error is mostly caused by permissions being changed for the files we use, which is generally a bug in the operating system. So any details about which Android version would be highly valuable.