Uploaded image for project: 'Realm Kotlin'
  1. Realm Kotlin
  2. RKOTLIN-856

Invalid streaming format cookie

      How frequently does the bug occur?

      Sometimes

      Description

      We have two users who are currently experiencing a crash [RLM_ERR_INVALID_DATABASE]: Failed to open Realm file at path '/data/user/0/****/files/*****.realm': file is in streaming format but has an invalid footer cookie (0). The file is probably truncated.

      It appears to happen when the app is started (potentially woken up via a worker) and we attempt to open a realm, however we do not understand what could be causing this issue because neither user had any other errors around the time this occurred (that we can see). It seems like it may have started overnight when the device was sleeping because both instances started in the early am hours and then the user reported it repeatedly crashing after attempting to use it.

      Currently we have no way of resolving this issue, so our only course of action for now is to have the user re-install the application. For now we are planning on simply catching this error and then deleting the realm and re-opening a new one, but this is not an ideal solution either.

      Stacktrace & log output

      Unable to find source-code formatter for language: shell. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      Fatal Exception: java.lang.IllegalStateException: [RLM_ERR_INVALID_DATABASE]: Failed to open Realm file at path '/data/user/0/*******/files/********.realm': file is in streaming format but has an invalid footer cookie (0). The file is probably truncated.
             at io.realm.kotlin.internal.interop.CoreErrorConverter.asThrowable(CoreErrorConverter.kt:44)
             at io.realm.kotlin.internal.interop.realmcJNI.open_realm_with_scheduler(realmcJNI.java)
             at io.realm.kotlin.internal.interop.realmc.open_realm_with_scheduler(realmc.java)
             at io.realm.kotlin.internal.interop.RealmInterop.realm_open(RealmInterop.kt:193)
             at io.realm.kotlin.internal.interop.RealmInterop.realm_open$default(RealmInterop.kt:181)
             at io.realm.kotlin.internal.ConfigurationImpl.openRealm$suspendImpl(ConfigurationImpl.kt:107)
             at io.realm.kotlin.internal.ConfigurationImpl.openRealm(ConfigurationImpl.kt)
             at io.realm.kotlin.internal.RealmImpl$1.invokeSuspend(RealmImpl.kt:107)
             at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
             at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
             at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:284)
             at kotlinx.coroutines.BlockingCoroutine.joinBlocking(BlockingCoroutine.java:85)
             at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(BuildersKt__Builders.kt:59)
             at kotlinx.coroutines.BuildersKt.runBlocking(Builders.kt: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:106)
             at io.realm.kotlin.internal.RealmImpl.<init>(RealmImpl.kt)
             at io.realm.kotlin.internal.RealmImpl$Companion.create$io_realm_kotlin_library(RealmImpl.kt:263)
             at io.realm.kotlin.Realm$Companion.open(Realm.kt:82)
             ******************************************************************************************
             at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
             at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
             at android.os.Handler.handleCallback(Handler.java:942)
             at android.os.Handler.dispatchMessage(Handler.java:99)
             at android.os.Looper.loopOnce(Looper.java:201)
             at android.os.Looper.loop(Looper.java:288)
             at android.os.HandlerThread.run(HandlerThread.java:67)
      

      Can you reproduce the bug?

      No

      Reproduction Steps

      No response

      Version

      1.8.0

      What Atlas App Services are you using?

      Local Database only

      Are you using encryption?

      No

      Platform OS and version(s)

      Android 13

      Build environment

      Android Studio version: Android Studio Flamingo | 2022.2.1 Patch 2
      Android Build Tools version: 30.0.3
      Gradle version: 7.5

        1. corrupted1.realm
          2.00 MB
        2. corrupted2.realm
          512 kB

            Assignee:
            finn.schiermer-andersen@mongodb.com Finn Andersen
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: