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

[split_config.arm64_v8a.apk!librealmc.so] Java_io_realm_kotlin_internal_interop_realmcJNI_realm_1dictionary_1size

      How frequently does the bug occur?

      Sometimes

      Description

      This crash is reported on Google Play console.
      Also, we are not getting the crash reports on crashlytics. I believe this is because the app crashes as soon as it launches.

      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
      *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
      pid: 0, tid: 12065 >>> com.subconscious.thrive <<<
      
      backtrace:
        #00  pc 0x000000000036cb3c  /data/app/com.subconscious.thrive-9etz6fhUqBFILQQ1uWFalg==/split_config.arm64_v8a.apk!librealmc.so (BuildId: 533e53c62871f9d2818ed137fd0c02c6241c7609)
        #01  pc 0x000000000058e200  /data/app/com.subconscious.thrive-9etz6fhUqBFILQQ1uWFalg==/split_config.arm64_v8a.apk!librealmc.so (BuildId: 533e53c62871f9d2818ed137fd0c02c6241c7609)
        #02  pc 0x000000000058de94  /data/app/com.subconscious.thrive-9etz6fhUqBFILQQ1uWFalg==/split_config.arm64_v8a.apk!librealmc.so (BuildId: 533e53c62871f9d2818ed137fd0c02c6241c7609)
        #03  pc 0x000000000058bb94  /data/app/com.subconscious.thrive-9etz6fhUqBFILQQ1uWFalg==/split_config.arm64_v8a.apk!librealmc.so (BuildId: 533e53c62871f9d2818ed137fd0c02c6241c7609)
        #04  pc 0x0000000000308e58  /data/app/com.subconscious.thrive-9etz6fhUqBFILQQ1uWFalg==/split_config.arm64_v8a.apk!librealmc.so (BuildId: 533e53c62871f9d2818ed137fd0c02c6241c7609)
        #05  pc 0x00000000002ed5ac  /data/app/com.subconscious.thrive-9etz6fhUqBFILQQ1uWFalg==/split_config.arm64_v8a.apk!librealmc.so (Java_io_realm_kotlin_internal_interop_realmcJNI_realm_1dictionary_1size+80) (BuildId: 533e53c62871f9d2818ed137fd0c02c6241c7609)
        #06  pc 0x00000000005dc0d4  /data/app/com.subconscious.thrive-9etz6fhUqBFILQQ1uWFalg==/oat/arm64/base.odex (art_jni_trampoline+180)
        #07  pc 0x00000000012e5d9c  /data/app/com.subconscious.thrive-9etz6fhUqBFILQQ1uWFalg==/oat/arm64/base.odex (io.realm.kotlin.internal.PrimitiveMapOperator.a+492)
        #08  pc 0x00000000012e7150  /data/app/com.subconscious.thrive-9etz6fhUqBFILQQ1uWFalg==/oat/arm64/base.odex (io.realm.kotlin.internal.RealmMapGenericIterator.hasNext+256)
        #09  pc 0x0000000000f418a0  /data/app/com.subconscious.thrive-9etz6fhUqBFILQQ1uWFalg==/oat/arm64/base.odex (com.google.firebase.firestore.util.CustomClassMapper.j+4160)
        #10  pc 0x0000000000f40fec  /data/app/com.subconscious.thrive-9etz6fhUqBFILQQ1uWFalg==/oat/arm64/base.odex (com.google.firebase.firestore.util.CustomClassMapper.j+1932)
        #11  pc 0x0000000000f417bc  /data/app/com.subconscious.thrive-9etz6fhUqBFILQQ1uWFalg==/oat/arm64/base.odex (com.google.firebase.firestore.util.CustomClassMapper.j+3932)
        #12  pc 0x0000000000f419ac  /data/app/com.subconscious.thrive-9etz6fhUqBFILQQ1uWFalg==/oat/arm64/base.odex (com.google.firebase.firestore.util.CustomClassMapper.j+4428)
        #13  pc 0x000000000066b06c  /data/app/com.subconscious.thrive-9etz6fhUqBFILQQ1uWFalg==/oat/arm64/base.odex (com.google.firebase.firestore.UserDataReader.a+188)
        #14  pc 0x0000000000669340  /data/app/com.subconscious.thrive-9etz6fhUqBFILQQ1uWFalg==/oat/arm64/base.odex (com.google.firebase.firestore.DocumentReference.g+592)
        #15  pc 0x0000000000137334  /apex/com.android.runtime/lib64/libart.so (art_quick_invoke_stub+548)
        #16  pc 0x00000000001460ac  /apex/com.android.runtime/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+244)
        #17  pc 0x00000000002e38d8  /apex/com.android.runtime/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+384)
        #18  pc 0x00000000002de964  /apex/com.android.runtime/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+900)
        #19  pc 0x00000000005a832c  /apex/com.android.runtime/lib64/libart.so (MterpInvokeVirtualQuick+596)
        #20  pc 0x0000000000135594  /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_virtual_quick+20)
        #21  pc 0x000000000139b9c2  /data/app/com.subconscious.thrive-9etz6fhUqBFILQQ1uWFalg==/oat/arm64/base.vdex (com.subconscious.thrive.data.source.remote.UserGameItemRemoteDataSource.updateUserGameItemListAsync+66)
        #22  pc 0x00000000002b4208  /apex/com.android.runtime/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.15828722791915351494)+240)
        #23  pc 0x00000000005935a0  /apex/com.android.runtime/lib64/libart.so (artQuickToInterpreterBridge+1024)
        #24  pc 0x0000000000140468  /apex/com.android.runtime/lib64/libart.so (art_quick_to_interpreter_bridge+88)
        #25  pc 0x000000000128ac64  /data/app/com.subconscious.thrive-9etz6fhUqBFILQQ1uWFalg==/oat/arm64/base.odex (com.subconscious.thrive.data.repository.remote.UserGameItemRepoImpl.syncData+3524)
        #26  pc 0x0000000001301940  /data/app/com.subconscious.thrive-9etz6fhUqBFILQQ1uWFalg==/oat/arm64/base.odex (com.subconscious.thrive.data.repository.remote.UserGameItemRepoImpl$syncData$1.invokeSuspend+96)
        #27  pc 0x0000000001684d64  /data/app/com.subconscious.thrive-9etz6fhUqBFILQQ1uWFalg==/oat/arm64/base.odex (kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith+164)
        #28  pc 0x00000000016c0990  /data/app/com.subconscious.thrive-9etz6fhUqBFILQQ1uWFalg==/oat/arm64/base.odex (kotlinx.coroutines.DispatchedTask.run+1120)
        #29  pc 0x00000000015a6c64  /data/app/com.subconscious.thrive-9etz6fhUqBFILQQ1uWFalg==/oat/arm64/base.odex (kotlinx.coroutines.internal.LimitedDispatcher$Worker.run+84)
        #30  pc 0x00000000016c9558  /data/app/com.subconscious.thrive-9etz6fhUqBFILQQ1uWFalg==/oat/arm64/base.odex (kotlinx.coroutines.scheduling.TaskImpl.run+72)
        #31  pc 0x00000000015ade78  /data/app/com.subconscious.thrive-9etz6fhUqBFILQQ1uWFalg==/oat/arm64/base.odex (kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run+2600)
        #32  pc 0x0000000000137334  /apex/com.android.runtime/lib64/libart.so (art_quick_invoke_stub+548)
        #33  pc 0x00000000001460ac  /apex/com.android.runtime/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+244)
        #34  pc 0x00000000004b2410  /apex/com.android.runtime/lib64/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+104)
        #35  pc 0x00000000004b34c0  /apex/com.android.runtime/lib64/libart.so (art::InvokeVirtualOrInterfaceWithJValues(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, jvalue const*)+416)
        #36  pc 0x00000000004f3a10  /apex/com.android.runtime/lib64/libart.so (art::Thread::CreateCallback(void*)+1176)
        #37  pc 0x00000000000e2364  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+36)
        #38  pc 0x0000000000083d98  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64)
      

      Can you reproduce the bug?

      No

      Reproduction Steps

      Our UserGameItemRepoImpl snippet:

      override fun updateUserGameItemListAsync(
              id: String,
              userGameItemList: List<GameItem>
          ): AsyncResult<EmptyModel> {
              return localDataSource.updateUserGameItemListAsync(id, userGameItemList).also {
                  remoteDataSource.updateUserGameItemListAsync(id, userGameItemList)
              }
          }
      
      override suspend fun syncData(): Result<Unit> = Result {
              val local = localDataSource.getById(id).firstSuccessOrFailure().dataOrNull()
              val remote = remoteDataSource.getById(id).firstSuccessOrFailure().dataOrNull()
              if (remote != null || local != null) {
                  if (remote == null) {
                      updateUserGameItemListAsync(id, local.requireNotNull().objects)
                  } else if (local == null) {
                      updateUserGameItemListAsync(id, remote.requireNotNull().objects)
                  } else {
                      updateUserGameItemListAsync(id, local.objects)
                  }
              }
          }
      

      Our UserGameItemLocalDataSource snippet:

      val realm by lazy {
              Realm.create(
                  setOf(
                      UserGameItemsRealm::class,
                      GameItemRealm::class
                  ),
                  "user_game_item.realm"
              )
          }
      
      override fun updateUserGameItemListAsync(
              id: String,
              userGameItemList: List<GameItem>
          ): AsyncResult<EmptyModel> {
              val res = AsyncResult<EmptyModel>()
              AppScope.launch(Dispatchers.IO) {
                  realm.write {
                      val userGameItems =
                          UserGameItemsRealm(userGameItemList.map { GameItemRealm.from(it) }
                              .toRealmList()).apply {
                              this.id = id
                          }
                      copyModelToRealm(userGameItems)
                  }
                  res.postValue(EmptyModel)
              }
              return res
          }
      

      Our realm initialization extension function:

      fun Realm.Companion.create(
          schema: Set<KClass<out TypedRealmObject>>,
          dbName: String,
          schemaVersion: Long = 6,
          migration: RealmMigration? = null
      ): Realm = runCatching {
          createExplicitly(
              schema = schema,
              dbName = dbName,
              schemaVersion = schemaVersion,
              migration = migration
          )
      }.getOrElse {
          AnalyticsManager.track(
              "realm_initialization_failed",
              mutableMapOf(
                  "Reason" to it.message
              )
          )
          ProcessPhoenix.triggerRebirth(appContext)
          throw AtomException.SelfHandledException(it)
      }
      
      private fun Realm.Companion.createExplicitly(
          schema: Set<KClass<out TypedRealmObject>>,
          dbName: String,
          schemaVersion: Long,
          migration: RealmMigration?
      ): Realm {
          if (!isRealmInitialized.get()) {
              synchronized(isRealmInitialized) {
                  val appInitializer = AppInitializer.getInstance(appContext)
                  appInitializer.initializeComponent(RealmInitializer::class.java)
                  isRealmInitialized.set(true)
              }
          }
      
          val config = RealmConfiguration.Builder(schema)
              .name(dbName)
              .apply {
                  if (migration != null) migration(migration)
              }
              .schemaVersion(schemaVersion)
              .build()
      
          return open(config)
      }
      

      Version

      1.10.0

      What Atlas App Services are you using?

      Local Database only

      Are you using encryption?

      No

      Platform OS and version(s)

      On almost all android versions

      Build environment

      Android Studio version: 2023.1.1 Patch 2
      Gradle version: 8.0.2

            Assignee:
            Unassigned Unassigned
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: