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

ThrowingException 7, Permission denied in /tmp/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp line 107 #7800

Closed LakshmiTeja17 closed 1 year ago

LakshmiTeja17 commented 1 year ago

How frequently does the bug occur?

Sometimes

Description

I am setting the default config of Realm DB as follows :

class RealmDB : Application() {
    override fun onCreate() {
        super.onCreate()
        try {
            Log.i(TAG, "Setting RealmDB Default config")
            Realm.init(this)
            val config = RealmConfiguration.Builder()
                .allowWritesOnUiThread(true)
                .allowQueriesOnUiThread(true)
                .deleteRealmIfMigrationNeeded()
                .build()
            Realm.setDefaultConfiguration(config)
        } catch (ex : IOException){
            Log.e(TAG, "Setting RealmConfiguration failed.")
        }
    }
}

Then I am trying to get the default instance in my app as follows: Realm.getDefaultInstance()

But a Permission denied exception is thrown sometimes. The strange thing is that, this exception is thrown randomly. Sometimes, the realm instance is created successfully, but sometimes it fails with the exception.

Stacktrace & log output

04-05 16:08:54.606  8888  9006 E REALM_JNI: jni: ThrowingException 7, Permission denied in /tmp/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp line 107, .
04-05 16:08:54.606  8888  9006 E REALM_JNI: Exception has been thrown: Permission denied in /tmp/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp line 107

Can you reproduce the bug?

Sometimes

Reproduction Steps

Reboot device and launch the app.

Version

classpath 'io.realm:realm-gradle-plugin:10.11.1' implementation 'io.realm.kotlin:library-base:1.7.0'

What Atlas App Services are you using?

Local Database only

Are you using encryption?

No

Platform OS and version(s)

Android Version 13

Build environment

Android Studio version: ... Android Build Tools version: ... Gradle version: ...

rorbech commented 1 year ago

This is an issue for Realm Java so transferring it.

rorbech commented 1 year ago

@LakshmiTeja17 Could you elaborate a bit more on the setup. Is this a system app and/or other observations that could help us identify the root. Maybe also the full stack trace?

github-actions[bot] commented 1 year ago

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

sdlyxcc commented 11 months ago

Caused by: java.lang.RuntimeException: Permission denied in /tmp/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp line 106 at io.realm.internal.OsSharedRealm.nativeGetSharedRealm(Native Method) at io.realm.internal.OsSharedRealm.(SourceFile:9) at io.realm.internal.OsSharedRealm.getInstance(SourceFile:5) at io.realm.a.(SourceFile:18) at io.realm.a.(SourceFile:1) at io.realm.n.(SourceFile:1) at io.realm.n.X(Unknown Source:2) at io.realm.RealmCache.d(SourceFile:5) at io.realm.RealmCache.g(SourceFile:93) at io.realm.RealmCache.e(SourceFile:12) at io.realm.n.l0(SourceFile:5) at org.matrix.android.sdk.internal.auth.db.RealmPendingSessionStore.getPendingSessionData(SourceFile:3) at org.matrix.android.sdk.internal.auth.DefaultAuthenticationService.(SourceFile:60) at org.matrix.android.sdk.internal.di.DaggerMatrixComponent.defaultAuthenticationService(Unknown Source:42) at org.matrix.android.sdk.internal.di.DaggerMatrixComponent.injectMatrix(SourceFile:8) at org.matrix.android.sdk.internal.di.DaggerMatrixComponent.inject(Unknown Source:0) at org.matrix.android.sdk.api.Matrix.(SourceFile:15) at org.matrix.android.sdk.api.Matrix.(Unknown Source:0) at org.matrix.android.sdk.api.Matrix$Companion.createInstance(Unknown Source:22) at im.vector.app.core.di.VectorStaticModule.providesMatrix(Unknown Source:12) at im.vector.app.core.di.VectorStaticModule_ProvidesMatrixFactory.providesMatrix(Unknown Source:2) at im.vector.app.DaggerVectorApplication_HiltComponents_SingletonC$SwitchingProvider.get(SourceFile:990) at cd1.get(SourceFile:14) at im.vector.app.DaggerVectorApplication_HiltComponents_SingletonC.legacySessionImporter(Unknown Source:2) at im.vector.app.DaggerVectorApplication_HiltComponents_SingletonC.injectVectorApplication2(SourceFile:1) at im.vector.app.DaggerVectorApplication_HiltComponents_SingletonC.injectVectorApplication(Unknown Source:0) at im.vector.app.Hilt_VectorApplication.onCreate(SourceFile:13) at im.vector.app.VectorApplication.onCreate(SourceFile:4) at com.app.App.onCreate(SourceFile:16)