realm-kotlin icon indicating copy to clipboard operation
realm-kotlin copied to clipboard

[RLM_ERR_SYSTEM_ERROR]: posix_fallocate() failed: Operation not supported on transport endpoint

Open RomainGF opened this issue 1 year ago • 2 comments

How frequently does the bug occur?

Always

Description

Hi, We've got a crash on Samsung devices, might be related to secure folder feature of Samsung.

This crash seems to be the same as the one on RealmJS and the one on RealmDotNet which seems to be a problem with the core codebase. According to RealmJS release note Handle EOPNOTSUPP when using posix_fallocate() and fallback to manually consume space. This should enable android users to open a Realm on restrictive file systems.. On their last release, they target Realm Core v13.26.0 (which is the one of the next version of this lib).

The exception is raised when calling io.realm.kotlin.Realm.open(configuration).

Stacktrace & log output

Fatal Exception: java.lang.RuntimeException: Unable to create application com.xxxxxxxx.xxxxxxxx.app.xxxxxxxxApplication: java.lang.IllegalStateException: [RLM_ERR_SYSTEM_ERROR]: posix_fallocate() failed: Operation not supported on transport endpoint: Operation not supported on transport endpoint (95)
       at android.app.ActivityThread.handleMakeApplication(ActivityThread.java:7189)
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7134)
       at android.app.ActivityThread.access$1600(ActivityThread.java:274)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2102)
       at android.os.Handler.dispatchMessage(Handler.java:107)
       at android.os.Looper.loop(Looper.java:237)
       at android.app.ActivityThread.main(ActivityThread.java:8167)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)

Caused by java.lang.IllegalStateException: [RLM_ERR_SYSTEM_ERROR]: posix_fallocate() failed: Operation not supported on transport endpoint: Operation not supported on transport endpoint (95)
       at io.realm.kotlin.internal.interop.CoreErrorConverter.asThrowable(CoreErrorConverter.kt:47)
       at io.realm.kotlin.internal.interop.realmcJNI.realm_open(realmcJNI.java)
       at io.realm.kotlin.internal.interop.realmc.realm_open(realmc.java:426)
       at io.realm.kotlin.internal.interop.RealmInterop.realm_open(RealmInterop.kt:235)
       at io.realm.kotlin.internal.ConfigurationImpl$openRealm$2.invoke(ConfigurationImpl.kt:115)
       at io.realm.kotlin.internal.ConfigurationImpl$openRealm$2.invoke(ConfigurationImpl.kt:114)
       at io.realm.kotlin.internal.interop.NativePointerKt.use(NativePointer.kt:53)
       at io.realm.kotlin.internal.ConfigurationImpl.openRealm$suspendImpl(ConfigurationImpl.kt:114)
       at io.realm.kotlin.internal.ConfigurationImpl.openRealm()
       at io.realm.kotlin.internal.RealmImpl$1.invokeSuspend(RealmImpl.kt:130)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
       at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:280)
       at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
       at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
       at kotlinx.coroutines.BuildersKt.runBlocking(:1)
       at io.realm.kotlin.internal.platform.CoroutineUtilsSharedJvmKt.runBlocking(CoroutineUtilsSharedJvm.kt:22)
       at io.realm.kotlin.internal.platform.CoroutineUtilsSharedJvmKt.runBlocking$default(CoroutineUtilsSharedJvm.kt:21)
       at io.realm.kotlin.internal.RealmImpl.<init>(RealmImpl.kt:112)
       at io.realm.kotlin.internal.RealmImpl.<init>()
       at io.realm.kotlin.internal.RealmImpl$Companion.create$io_realm_kotlin_library(RealmImpl.kt:308)
       at io.realm.kotlin.Realm$Companion.open(Realm.kt:83)
       at com.xxxxxxxx.xxxxxxxx.data.common.libs.realm.RealmModule.providesRealm(RealmModule.kt:107)
       at com.xxxxxxxx.xxxxxxxx.data.common.libs.realm.RealmModule_ProvidesRealmFactory.providesRealm(RealmModule_ProvidesRealmFactory.java:41)
       at com.xxxxxxxx.xxxxxxxx.app.DaggerxxxxxxxxApplication_HiltComponents_SingletonC$SingletonCImpl$SwitchingProvider.get0(DaggerxxxxxxxxApplication_HiltComponents_SingletonC.java:7729)
       at com.xxxxxxxx.xxxxxxxx.app.DaggerxxxxxxxxApplication_HiltComponents_SingletonC$SingletonCImpl$SwitchingProvider.get(DaggerxxxxxxxxApplication_HiltComponents_SingletonC.java:8015)
       at dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
       at com.xxxxxxxx.xxxxxxxx.app.DaggerxxxxxxxxApplication_HiltComponents_SingletonC$SingletonCImpl$SwitchingProvider.get0(DaggerxxxxxxxxApplication_HiltComponents_SingletonC.java:7726)
       at com.xxxxxxxx.xxxxxxxx.app.DaggerxxxxxxxxApplication_HiltComponents_SingletonC$SingletonCImpl$SwitchingProvider.get(DaggerxxxxxxxxApplication_HiltComponents_SingletonC.java:8015)
       at dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
       at com.xxxxxxxx.xxxxxxxx.app.DaggerxxxxxxxxApplication_HiltComponents_SingletonC$SingletonCImpl$SwitchingProvider.get0(DaggerxxxxxxxxApplication_HiltComponents_SingletonC.java:7720)
       at com.xxxxxxxx.xxxxxxxx.app.DaggerxxxxxxxxApplication_HiltComponents_SingletonC$SingletonCImpl$SwitchingProvider.get(DaggerxxxxxxxxApplication_HiltComponents_SingletonC.java:8015)
       at dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
       at com.xxxxxxxx.xxxxxxxx.app.DaggerxxxxxxxxApplication_HiltComponents_SingletonC$SingletonCImpl.shouldUseAntelopScaProviderUseCase(DaggerxxxxxxxxApplication_HiltComponents_SingletonC.java:6398)
       at com.xxxxxxxx.xxxxxxxx.app.DaggerxxxxxxxxApplication_HiltComponents_SingletonC$SingletonCImpl.getScaProvidersEnrolmentStatusUseCase(DaggerxxxxxxxxApplication_HiltComponents_SingletonC.java:6402)
       at com.xxxxxxxx.xxxxxxxx.app.DaggerxxxxxxxxApplication_HiltComponents_SingletonC$SingletonCImpl.isUserEnrolledForScaUseCase(DaggerxxxxxxxxApplication_HiltComponents_SingletonC.java:6406)
       at com.xxxxxxxx.xxxxxxxx.app.DaggerxxxxxxxxApplication_HiltComponents_SingletonC$SingletonCImpl.shouldAuthenticateUserForScaUseCase(DaggerxxxxxxxxApplication_HiltComponents_SingletonC.java:6410)
       at com.xxxxxxxx.xxxxxxxx.app.DaggerxxxxxxxxApplication_HiltComponents_SingletonC$SingletonCImpl.scaAuthenticationLifecycleObserver(DaggerxxxxxxxxApplication_HiltComponents_SingletonC.java:6414)
       at com.xxxxxxxx.xxxxxxxx.app.DaggerxxxxxxxxApplication_HiltComponents_SingletonC$SingletonCImpl.appLifecycleObserverContainer(DaggerxxxxxxxxApplication_HiltComponents_SingletonC.java:6614)
       at com.xxxxxxxx.xxxxxxxx.app.DaggerxxxxxxxxApplication_HiltComponents_SingletonC$SingletonCImpl.injectxxxxxxxxApplication2(DaggerxxxxxxxxApplication_HiltComponents_SingletonC.java:7564)
       at com.xxxxxxxx.xxxxxxxx.app.DaggerxxxxxxxxApplication_HiltComponents_SingletonC$SingletonCImpl.injectxxxxxxxxApplication(DaggerxxxxxxxxApplication_HiltComponents_SingletonC.java:7538)
       at com.xxxxxxxx.xxxxxxxx.app.Hilt_xxxxxxxxApplication.hiltInternalInject(Hilt_xxxxxxxxApplication.java:52)
       at com.xxxxxxxx.xxxxxxxx.app.Hilt_xxxxxxxxApplication.onCreate(Hilt_xxxxxxxxApplication.java:43)
       at com.xxxxxxxx.xxxxxxxx.app.xxxxxxxxApplication.onCreate(xxxxxxxxApplication.kt:118)
       at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1190)
       at android.app.ActivityThread.handleMakeApplication(ActivityThread.java:7184)
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7134)
       at android.app.ActivityThread.access$1600(ActivityThread.java:274)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2102)
       at android.os.Handler.dispatchMessage(Handler.java:107)
       at android.os.Looper.loop(Looper.java:237)
       at android.app.ActivityThread.main(ActivityThread.java:8167)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)

Can you reproduce the bug?

No

Reproduction Steps

I've no Samsung device with Secure Folder to test on it specifically. But reproduction step seems to be:

  • enable Samsung secure folder on device
  • launch an app with a basic Realm configuration
  • wait for the crash at opening

Version

1.13.0

What Atlas App Services are you using?

Local Database only

Are you using encryption?

No

Platform OS and version(s)

Samsung devices, for now only on Galaxy Note9, Galaxy S9+, Galaxy S8 running Android 9/10 but not exhaustive

Build environment

Android Studio version: Hedgehog 2023.1.1 Patch 2 Android Build Tools version: 34.0.0 Gradle version: 8.2.2 androidMinSdk = "23" androidTargetSdk = "34" androidCompileSdk = "34" kotlin = "1.9.21"

RomainGF avatar Feb 02 '24 13:02 RomainGF

@RomainGF Thank you for reporting. We believe it has been fixed by Realm Core v13.26.0, and we need to upgrade in order to get the fix out.

kneth avatar Feb 05 '24 09:02 kneth

Thanks for the reply, can we expect this core update in the next version (1.14.0) ? 🤞 Cause I see in the changelog that you bump the version but then revert it

RomainGF avatar Feb 07 '24 08:02 RomainGF

The fix for this should be included in 1.14.0 with Core 13.16.0.

rorbech avatar Apr 09 '24 13:04 rorbech