Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[split_config.arm64_v8a.apk!librealmc.so] Java_io_realm_kotlin_internal_interop_realmcJNI_realm_1list_1size #1677

Open
ShivanshGoel-atom opened this issue Mar 7, 2024 · 5 comments

Comments

@ShivanshGoel-atom
Copy link

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

Pure virtual function called!
pid: 0, tid: 6642 >>> com.subconscious.thrive <<<

backtrace:
  #00  pc 0x000000000008cdb4  /apex/com.android.runtime/lib64/bionic/libc.so (abort+164)
  #01  pc 0x000000000083c954  /data/app/~~qbV1HCwZNK8FirACVSe9OQ==/com.subconscious.thrive-13E3Ub4NM9b3KpT8b8UZtw==/split_config.arm64_v8a.apk!librealmc.so (BuildId: 533e53c62871f9d2818ed137fd0c02c6241c7609)
  #02  pc 0x000000000083dab8  /data/app/~~qbV1HCwZNK8FirACVSe9OQ==/com.subconscious.thrive-13E3Ub4NM9b3KpT8b8UZtw==/split_config.arm64_v8a.apk!librealmc.so (BuildId: 533e53c62871f9d2818ed137fd0c02c6241c7609)
  #03  pc 0x0000000000564e6c  /data/app/~~qbV1HCwZNK8FirACVSe9OQ==/com.subconscious.thrive-13E3Ub4NM9b3KpT8b8UZtw==/split_config.arm64_v8a.apk!librealmc.so (BuildId: 533e53c62871f9d2818ed137fd0c02c6241c7609)
  #04  pc 0x000000000036cb64  /data/app/~~qbV1HCwZNK8FirACVSe9OQ==/com.subconscious.thrive-13E3Ub4NM9b3KpT8b8UZtw==/split_config.arm64_v8a.apk!librealmc.so (BuildId: 533e53c62871f9d2818ed137fd0c02c6241c7609)
  #05  pc 0x00000000005bc4d4  /data/app/~~qbV1HCwZNK8FirACVSe9OQ==/com.subconscious.thrive-13E3Ub4NM9b3KpT8b8UZtw==/split_config.arm64_v8a.apk!librealmc.so (BuildId: 533e53c62871f9d2818ed137fd0c02c6241c7609)
  #06  pc 0x00000000005bba48  /data/app/~~qbV1HCwZNK8FirACVSe9OQ==/com.subconscious.thrive-13E3Ub4NM9b3KpT8b8UZtw==/split_config.arm64_v8a.apk!librealmc.so (BuildId: 533e53c62871f9d2818ed137fd0c02c6241c7609)
  #07  pc 0x00000000005baf30  /data/app/~~qbV1HCwZNK8FirACVSe9OQ==/com.subconscious.thrive-13E3Ub4NM9b3KpT8b8UZtw==/split_config.arm64_v8a.apk!librealmc.so (BuildId: 533e53c62871f9d2818ed137fd0c02c6241c7609)
  #08  pc 0x0000000000313364  /data/app/~~qbV1HCwZNK8FirACVSe9OQ==/com.subconscious.thrive-13E3Ub4NM9b3KpT8b8UZtw==/split_config.arm64_v8a.apk!librealmc.so (BuildId: 533e53c62871f9d2818ed137fd0c02c6241c7609)
  #09  pc 0x00000000002eab9c  /data/app/~~qbV1HCwZNK8FirACVSe9OQ==/com.subconscious.thrive-13E3Ub4NM9b3KpT8b8UZtw==/split_config.arm64_v8a.apk!librealmc.so (Java_io_realm_kotlin_internal_interop_realmcJNI_realm_1list_1size+80) (BuildId: 533e53c62871f9d2818ed137fd0c02c6241c7609)
  #10  pc 0x0000000000355830  /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+144)
  #11  pc 0x0000000002075bc8  /memfd:jit-cache

Can you reproduce the bug?

No

Reproduction Steps

No response

Version

1.13.0

What Atlas App Services are you using?

Local Database only

Are you using encryption?

No

Platform OS and version(s)

Android 10-14

Build environment

No response

Copy link

sync-by-unito bot commented Mar 7, 2024

➤ PM Bot commented:

Jira ticket: RKOTLIN-1030

@ShivanshGoel-atom
Copy link
Author

ShivanshGoel-atom commented Mar 7, 2024

There is one more stacktrace for this:

pid: 0, tid: 20100 >>> com.subconscious.thrive <<<

backtrace:
  #00  pc 0x000000000008c630  /apex/com.android.runtime/lib64/bionic/libc.so (abort+164)
  #01  pc 0x000000000083c954  /data/app/~~JcJGW3zOHx185oFIlttUEQ==/com.subconscious.thrive-5-1WwE8tsuO4UrHv0tFIlQ==/split_config.arm64_v8a.apk!librealmc.so (BuildId: 533e53c62871f9d2818ed137fd0c02c6241c7609)
  #02  pc 0x000000000083dab8  /data/app/~~JcJGW3zOHx185oFIlttUEQ==/com.subconscious.thrive-5-1WwE8tsuO4UrHv0tFIlQ==/split_config.arm64_v8a.apk!librealmc.so (BuildId: 533e53c62871f9d2818ed137fd0c02c6241c7609)
  #03  pc 0x0000000000564e6c  /data/app/~~JcJGW3zOHx185oFIlttUEQ==/com.subconscious.thrive-5-1WwE8tsuO4UrHv0tFIlQ==/split_config.arm64_v8a.apk!librealmc.so (BuildId: 533e53c62871f9d2818ed137fd0c02c6241c7609)
  #04  pc 0x000000000036cb64  /data/app/~~JcJGW3zOHx185oFIlttUEQ==/com.subconscious.thrive-5-1WwE8tsuO4UrHv0tFIlQ==/split_config.arm64_v8a.apk!librealmc.so (BuildId: 533e53c62871f9d2818ed137fd0c02c6241c7609)
  #05  pc 0x00000000005bc4d4  /data/app/~~JcJGW3zOHx185oFIlttUEQ==/com.subconscious.thrive-5-1WwE8tsuO4UrHv0tFIlQ==/split_config.arm64_v8a.apk!librealmc.so (BuildId: 533e53c62871f9d2818ed137fd0c02c6241c7609)
  #06  pc 0x00000000005bba48  /data/app/~~JcJGW3zOHx185oFIlttUEQ==/com.subconscious.thrive-5-1WwE8tsuO4UrHv0tFIlQ==/split_config.arm64_v8a.apk!librealmc.so (BuildId: 533e53c62871f9d2818ed137fd0c02c6241c7609)
  #07  pc 0x00000000005baf30  /data/app/~~JcJGW3zOHx185oFIlttUEQ==/com.subconscious.thrive-5-1WwE8tsuO4UrHv0tFIlQ==/split_config.arm64_v8a.apk!librealmc.so (BuildId: 533e53c62871f9d2818ed137fd0c02c6241c7609)
  #08  pc 0x0000000000313364  /data/app/~~JcJGW3zOHx185oFIlttUEQ==/com.subconscious.thrive-5-1WwE8tsuO4UrHv0tFIlQ==/split_config.arm64_v8a.apk!librealmc.so (BuildId: 533e53c62871f9d2818ed137fd0c02c6241c7609)
  #09  pc 0x00000000002eab9c  /data/app/~~JcJGW3zOHx185oFIlttUEQ==/com.subconscious.thrive-5-1WwE8tsuO4UrHv0tFIlQ==/split_config.arm64_v8a.apk!librealmc.so (Java_io_realm_kotlin_internal_interop_realmcJNI_realm_1list_1size+80) (BuildId: 533e53c62871f9d2818ed137fd0c02c6241c7609)
  #10  pc 0x00000000002adbc4  /data/app/~~JcJGW3zOHx185oFIlttUEQ==/com.subconscious.thrive-5-1WwE8tsuO4UrHv0tFIlQ==/oat/arm64/base.odex (art_jni_trampoline+132)
  #11  pc 0x00000000005baf1c  /apex/com.android.art/lib64/libart.so (nterp_helper+1948)
  #12  pc 0x00000000017c19e4  /data/app/~~JcJGW3zOHx185oFIlttUEQ==/com.subconscious.thrive-5-1WwE8tsuO4UrHv0tFIlQ==/oat/arm64/base.vdex (io.realm.kotlin.internal.ManagedRealmList.U+60)
  #13  pc 0x0000000000c6b024  /data/app/~~JcJGW3zOHx185oFIlttUEQ==/com.subconscious.thrive-5-1WwE8tsuO4UrHv0tFIlQ==/oat/arm64/base.odex (kotlin.collections.AbstractMutableList.size+36)
  #14  pc 0x00000000004bdd3c  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (java.util.AbstractList$Itr.hasNext+60)
  #15  pc 0x000000000055f574  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (java.util.AbstractCollection.toString+84)
  #16  pc 0x000000000052d0c8  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (java.lang.StringBuilder.append+72)
  #17  pc 0x00000000005bb730  /apex/com.android.art/lib64/libart.so (nterp_helper+4016)
  #18  pc 0x0000000001541f06  /data/app/~~JcJGW3zOHx185oFIlttUEQ==/com.subconscious.thrive-5-1WwE8tsuO4UrHv0tFIlQ==/oat/arm64/base.vdex (com.subconscious.thrive.models.cohort.CohortModel.toString+66)
  #19  pc 0x000000000052d0c8  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (java.lang.StringBuilder.append+72)
  #20  pc 0x000000000055f614  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (java.util.AbstractCollection.toString+244)
  #21  pc 0x000000000052d0c8  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (java.lang.StringBuilder.append+72)
  #22  pc 0x00000000005bb730  /apex/com.android.art/lib64/libart.so (nterp_helper+4016)
  #23  pc 0x00000000013d303a  /data/app/~~JcJGW3zOHx185oFIlttUEQ==/com.subconscious.thrive-5-1WwE8tsuO4UrHv0tFIlQ==/oat/arm64/base.vdex (com.subconscious.thrive.common.cohorts.CohortManager$filterCohortsForSectionVariant$$inlined$map$1$2.emit+1546)
  #24  pc 0x0000000000c74d40  /data/app/~~JcJGW3zOHx185oFIlttUEQ==/com.subconscious.thrive-5-1WwE8tsuO4UrHv0tFIlQ==/oat/arm64/base.odex (kotlinx.coroutines.flow.StateFlowImpl.collect+1920)
  #25  pc 0x0000000000c68414  /data/app/~~JcJGW3zOHx185oFIlttUEQ==/com.subconscious.thrive-5-1WwE8tsuO4UrHv0tFIlQ==/oat/arm64/base.odex (kotlinx.coroutines.flow.StateFlowImpl$collect$1.invokeSuspend+100)
  #26  pc 0x0000000000c2b83c  /data/app/~~JcJGW3zOHx185oFIlttUEQ==/com.subconscious.thrive-5-1WwE8tsuO4UrHv0tFIlQ==/oat/arm64/base.odex (kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith+156)
  #27  pc 0x0000000000c2d91c  /data/app/~~JcJGW3zOHx185oFIlttUEQ==/com.subconscious.thrive-5-1WwE8tsuO4UrHv0tFIlQ==/oat/arm64/base.odex (kotlinx.coroutines.DispatchedTask.run+1372)
  #28  pc 0x00000000005bc554  /apex/com.android.art/lib64/libart.so (nterp_helper+7636)
  #29  pc 0x0000000001e9c246  /data/app/~~JcJGW3zOHx185oFIlttUEQ==/com.subconscious.thrive-5-1WwE8tsuO4UrHv0tFIlQ==/oat/arm64/base.vdex (kotlinx.coroutines.internal.LimitedDispatcher$Worker.run+6)
  #30  pc 0x0000000000c30f18  /data/app/~~JcJGW3zOHx185oFIlttUEQ==/com.subconscious.thrive-5-1WwE8tsuO4UrHv0tFIlQ==/oat/arm64/base.odex (kotlinx.coroutines.scheduling.TaskImpl.run+72)
  #31  pc 0x00000000005bc554  /apex/com.android.art/lib64/libart.so (nterp_helper+7636)
  #32  pc 0x0000000001e9eefc  /data/app/~~JcJGW3zOHx185oFIlttUEQ==/com.subconscious.thrive-5-1WwE8tsuO4UrHv0tFIlQ==/oat/arm64/base.vdex (kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run+200)
  #33  pc 0x000000000033eba4  /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub+612)
  #34  pc 0x000000000023a9ac  /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+144)
  #35  pc 0x000000000053b96c  /apex/com.android.art/lib64/libart.so (art::Thread::CreateCallback(void*)+1600)
  #36  pc 0x00000000000f1118  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208)
  #37  pc 0x000000000008dd54  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64)

**CohortModel.kt: **

@Parcelize
@JsonClass(generateAdapter = true)
data class CohortModel(
    val active: Boolean = true,
    val conditions: @RawValue List<CohortCondition> = emptyList(),
    val baseJourneyIds: List<String> = emptyList(),
    val journeyPrefix: String = "",
    val cohortApplication: @RawValue CohortApplication = CohortApplication.JourneySectionVariant("")
) : BaseModel()

**CohortApplication.kt: **

@Keep
@JsonClass(generateAdapter = true, generator = "sealed:cohortType")
sealed interface CohortApplication: Parcelable {

    @Keep
    @TypeLabel(label = ApplicationTypeNames.JOURNEY_VARIANT)
    @Parcelize
    @JsonClass(generateAdapter = true)
    data class JourneyVariant(
        val journeyName: String
    ) : CohortApplication

    @Keep
    @TypeLabel(label = ApplicationTypeNames.JOURNEY_SECTION_VARIANT)
    @Parcelize
    @JsonClass(generateAdapter = true)
    data class JourneySectionVariant(
        val journeyPrefix: String
    ): CohortApplication

    @Keep
    @TypeLabel(label = ApplicationTypeNames.JOURNEY_TASK_VARIANT)
    @Parcelize
    @JsonClass(generateAdapter = true)
    data class JourneyTaskVariant(
        val journeyPrefix: String
    ): CohortApplication

    @Keep
    @TypeLabel(label = ApplicationTypeNames.SURVEY_TRIGGER)
    @Parcelize
    @JsonClass(generateAdapter = true)
    data class SurveyTrigger(
        val trigger: String,
        val surveyIds: List<String>
    ): CohortApplication

    @DefaultObject
    @Parcelize
    object Incompatible: CohortApplication

    object Trigger {
        const val HOME_LOAD = "HOME-LOAD"
        const val TASK_QUIT = "TASK-QUIT"
    }
}

CohortManager.filterCohortsForSectionVariant:

fun filterCohortsForSectionVariant(
        currentOffset: Int,
        userJourneys: List<UserJourneyModel>
    ) {
        AppScope.launch(Dispatchers.IO) {
            cohorts.map { cohortModels ->
                val (lastArticleCounts, lastMeditationCounts) = initHistoryCounts(currentOffset - 1)
                cohortModels.filter { cohortModel ->
                    var isCohortApplicable = true
                    var currentLogicalOperator = LogicalOperator.AND
                    for (condition in cohortModel.conditions) {
                        if (isCohortApplicable && (currentLogicalOperator == LogicalOperator.OR)) break
                        if (!isCohortApplicable && (currentLogicalOperator == LogicalOperator.AND)) break
                        when (condition) {
                            is CohortCondition.UserPreferences -> {
                                val isCurrentApplicable = operate(
                                    userValue = userPreferences[condition.userParameter],
                                    operator = condition.conditionOperator,
                                    requiredValue = condition.value
                                )
                                isCohortApplicable = isCohortApplicable.operateNext(
                                    currentLogicalOperator,
                                    isCurrentApplicable
                                )
                            }

                            is CohortCondition.JoinerOperator -> {
                                currentLogicalOperator = condition.conditionOperator
                            }

                            is CohortCondition.HistoryTasksCount -> {
                                val lastTasks =
                                    if (condition.userParameter == UserParameters.MEDITATION_TASK) {
                                        try {
                                            lastMeditationCounts[condition.relativeOffset]
                                        } catch (_: IndexOutOfBoundsException) {
                                            lastMeditationCounts.last()
                                        }
                                    } else {
                                        try {
                                            lastArticleCounts[condition.relativeOffset]
                                        } catch (_: IndexOutOfBoundsException) {
                                            lastArticleCounts.last()
                                        }
                                    }
                                val isCurrentApplicable = operate(
                                    userValue = lastTasks.toLong(),
                                    operator = condition.conditionOperator,
                                    requiredValue = condition.count.toLong()
                                )
                                isCohortApplicable = isCohortApplicable.operateNext(
                                    currentLogicalOperator,
                                    isCurrentApplicable
                                )
                            }

                            is CohortCondition.AppVersion -> {
                                val isCurrentApplicable = operate(
                                    userValue = BuildConfig.VERSION_NAME,
                                    operator = condition.conditionOperator,
                                    requiredValue = condition.version
                                )
                                isCohortApplicable = isCohortApplicable.operateNext(
                                    currentLogicalOperator,
                                    isCurrentApplicable
                                )
                            }

                            is CohortCondition.AppVersionCode -> {
                                val isCurrentApplicable = operate(
                                    userValue = BuildConfig.VERSION_CODE.toLong(),
                                    operator = condition.conditionOperator,
                                    requiredValue = condition.versionCode
                                )
                                isCohortApplicable = isCohortApplicable.operateNext(
                                    currentLogicalOperator,
                                    isCurrentApplicable
                                )
                            }

                            is CohortCondition.LinearJourneyStatus -> {
                                val userJourney = userJourneys.firstOrNull {
                                    it.journeyId == condition.journeyId
                                }
                                val isCurrentApplicable = operate(
                                    userValue = userJourney?.isLinearJourney,
                                    operator = condition.conditionOperator,
                                    requiredValue = condition.isLinearJourney
                                )
                                isCohortApplicable = isCohortApplicable.operateNext(
                                    currentLogicalOperator,
                                    isCurrentApplicable
                                )
                            }

                            is CohortCondition.JourneyDay -> {
                                val journey =
                                    userJourneys.firstOrNull { it.journeyId == condition.journeyId }
                                val isCurrentApplicable = journey?.let {
                                    operate(
                                        userValue = journey.activeJourneySectionRank,
                                        operator = condition.conditionOperator,
                                        requiredValue = condition.journeyDay
                                    )
                                } ?: false
                                isCohortApplicable = isCohortApplicable.operateNext(
                                    currentLogicalOperator,
                                    isCurrentApplicable
                                )
                            }

                            is CohortCondition.JourneyDayTasks -> {
                                val journey =
                                    userJourneys.firstOrNull { it.journeyId == condition.journeyId }
                                val isCurrentApplicable = journey?.let {
                                    operate(
                                        userValue = it.tasksCompleted.size.toLong(),
                                        operator = condition.conditionOperator,
                                        requiredValue = condition.tasksCompleted.toLong()
                                    )
                                } ?: false
                                isCohortApplicable = isCohortApplicable.operateNext(
                                    currentLogicalOperator,
                                    isCurrentApplicable
                                )
                            }

                            is CohortCondition.SubscriptionStatusChange -> {
                                val isCurrentApplicable =
                                    SharedPrefManager.instance.subscriptionHistory.peek().second == condition.subscriptionStatus
                                isCohortApplicable = isCohortApplicable.operateNext(
                                    currentLogicalOperator,
                                    isCurrentApplicable
                                )
                            }

                            is CohortCondition.Subscriber -> {
                                val isCurrentApplicable = operate(
                                    userValue = BuildConfig.SUBSCRIBER,
                                    operator = condition.conditionOperator,
                                    requiredValue = condition.subscriber
                                )
                                isCohortApplicable = isCohortApplicable.operateNext(
                                    currentLogicalOperator,
                                    isCurrentApplicable
                                )
                            }

                            is CohortCondition.Incompatible -> {
                                Timber.e("Incompatible Cohort Condition")
                            }
                        }
                    }
                    isCohortApplicable && cohortModel.cohortApplication is CohortApplication.JourneySectionVariant
                }
            }.let {
                filteredCohorts.emitAll(it)
            }
        }
    }

@ShivanshGoel-atom
Copy link
Author

ShivanshGoel-atom commented Mar 22, 2024

We updated the realm SDK to 1.14.0. But issue still persist

@ShivanshGoel-atom
Copy link
Author

This crash is affecting our production metrics. Can you please prioritize this?

@alxgord
Copy link

alxgord commented Oct 2, 2024

I have the same problem. The app randomly crashes without logging in to Crashlytics or Google Play. Is there a solution?
realm version - 2.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants