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

[realm-core-12.3.0] Assertion failed: false #7877

Open jalen-ma opened 4 months ago

jalen-ma commented 4 months ago

SDK and version

SDK : java realm-core-12.3.0 Version: 12.3.0

Observations

i dont not the step, user crashes while using the app。

Crash log / stacktrace

backtrace:

00 pc 000000000007066c /apex/com.android.runtime/lib64/bionic/libc.so (abort+160)

realm/realm-core#1 pc 000000000066d55c  /data/app/com.demo.eh-9zyvbbrKmFJvAIcxvAHXjw==/lib/arm64/librealm-jni.so
realm/realm-core#2 pc 000000000066d858  /data/app/com.demo.eh-9zyvbbrKmFJvAIcxvAHXjw==/lib/arm64/librealm-jni.so
realm/realm-core#3 pc 000000000066d694  /data/app/com.demo.eh-9zyvbbrKmFJvAIcxvAHXjw==/lib/arm64/librealm-jni.so
realm/realm-core#4 pc 00000000003c64b8  /data/app/com.demo.eh-9zyvbbrKmFJvAIcxvAHXjw==/lib/arm64/librealm-jni.so
realm/realm-core#5 pc 00000000000d2578  /apex/com.android.runtime/lib64/bionic/libc.so (__cxa_finalize+212)
realm/realm-core#6 pc 00000000000cdf60  /apex/com.android.runtime/lib64/bionic/libc.so (exit+24)
realm/realm-core#7 pc 0000000000557828  /data/app/com.demo.eh-9zyvbbrKmFJvAIcxvAHXjw==/lib/arm64/libflutter.so
realm/realm-core#8 pc 00000000005591b8  /data/app/com.demo.eh-9zyvbbrKmFJvAIcxvAHXjw==/lib/arm64/libflutter.so
realm/realm-core#9 pc 000000000062da0c  /data/app/com.demo.eh-9zyvbbrKmFJvAIcxvAHXjw==/lib/arm64/libflutter.so
realm/realm-core#10 pc 000000000062d864  /data/app/com.demo.eh-9zyvbbrKmFJvAIcxvAHXjw==/lib/arm64/libflutter.so
realm/realm-core#11 pc 00000000000044fc  /data/app/com.demo.eh-9zyvbbrKmFJvAIcxvAHXjw==/lib/arm64/libapp.so (_kDartVmSnapshotInstructions+9468)

01-25 15:23:44.968 22446 22649 E REALM : /tmp/realm-java/realm/realm-library/src/main/cpp/jni_util/jni_utils.cpp:54: [realm-core-12.3.0] Assertion failed: false 01-25 15:23:44.968 22446 22649 E REALM : !!! IMPORTANT: Please report this at https://github.com/realm/realm-core/issues/new/choose

Steps & Code to Reproduce

i dont not the step

nicola-cab commented 3 months ago

Hello, thanks for reporting this, however this is not a core issue, It is a JNI issue in the Java SDK. In particular, I think this is the offending code:

JNIEnv* JniUtils::get_env(bool attach_if_needed)
{
    REALM_ASSERT_DEBUG(s_instance);

    JNIEnv* env;
    if (s_instance->m_vm->GetEnv(reinterpret_cast<void**>(&env), s_instance->m_vm_version) != JNI_OK) {
        if (attach_if_needed) {
            jint ret = s_instance->m_vm->AttachCurrentThread(&env, nullptr);
            REALM_ASSERT_RELEASE(ret == JNI_OK);
        }
        else {
            REALM_ASSERT_RELEASE(false);
        }
    }

    return env;
}

I am not an expert, but it seems to me that JniUtils::get_env(bool attach_if_needed) was called with attach_if_needed = false.

sync-by-unito[bot] commented 3 months ago

➤ PM Bot commented:

Jira ticket: RJAVA-1252

kneth commented 3 months ago

@jalen-ma

It is similar to https://github.com/realm/realm-java/issues/6987.

How often does it happen? Any particular operation which triggers it?