Open BlueCobold opened 1 month ago
➤ PM Bot commented:
Jira ticket: RCORE-2260
Hello @BlueCobold thanks for reporting this. Without the file however it is almost impossible to understand what happened.
Clearly, the top ref array is not valid: https://github.com/realm/realm-core/blob/c729fc803dc64753028f739bd2faf9d3f30bcad3/src/realm/group.cpp#L493
I can only think about something bad happening when a transaction was committed. Do you have more information on your side that can give us some tips about how to try to reproduce this issue?
I'm afraid I can not provide more info that this crash report. I understand it's probably super hard to identify. I can say that access to the realm is temporary opened and closed in a single-threaded exclusive way. If it's impossible to find a reason for such an invalid top-ref, I'm sure you can at least correct the wrong error-message which claims the file-size to be 0, which is logically impossible if a top-ref can be read.
The file size we are referring to here is the logical file size that is stored in the top array. So if the top ref is pointing to some invalid array, that size can perfectly fine be 0. Unfortunately we have not been able to find the reason why the top ref can be wrong. Can you tell on which platform this is happening? Historically we have only seen these kind of problems on iOS. So the theory is that something weird is going on in the file system - possibly if the platform crashes.
Ah, I see. So it's a confusing message, because it says "array size: 655360), file size: 0".
It happened on Android.
@jedelbo I may be wrong (because I don't recall in detail what we did). But as far as I remember, we only added the extra msync call for IOS and left the management of the dirty pages untouched for the other platforms. I repeat, I might be wrong on this. Probably this is just speculation, though.
➤ jedelbo commented:
Without having the file, I can't see how we can move forward on this issue, I I will close it.
@jedelbo The issue persists. I keep getting reports.
Failed to open Realm file at path "...": Failed to memory buffer:Invalid top array size (ref: 2882016, array size: 16777215) file size: 108086541928145056, read lock size: none, read lock version: none
SDK and version
SDK : RealmKotlin Version: 2.2.0 (Core 14.12.0)
Observations
Crash log / stacktrace
Failed to memory buffer:Invalid top array size (ref: 2224064, array size: 655360) file size: 0, read lock size: none, read lock version: none: java.lang.IllegalStateException: [RLM_ERR_INVALID_DATABASE]: Failed to open Realm file at path "....": Failed to memory buffer:Invalid top array size (ref: 2224064, array size: 655360) file size: 0, read lock size: none, read lock version: none at io.realm.kotlin.internal.interop.CoreErrorConverter.asThrowable(SourceFile:96) at io.realm.kotlin.internal.interop.realmcJNI.realm_open(Native Method) at io.realm.kotlin.internal.interop.realmc.realm_open(SourceFile:1) at io.realm.kotlin.internal.interop.RealmInterop.realm_open(SourceFile:41) at io.realm.kotlin.internal.ConfigurationImpl.openRealm$lambda$0(SourceFile:18) at io.realm.kotlin.internal.ConfigurationImpl.a(SourceFile:1) at io.realm.kotlin.internal.b.invoke(SourceFile:1) at io.realm.kotlin.internal.interop.NativePointerKt.use(SourceFile:11) at io.realm.kotlin.internal.ConfigurationImpl.openRealm$suspendImpl(SourceFile:20) at io.realm.kotlin.internal.ConfigurationImpl.openRealm(SourceFile:1) at io.realm.kotlin.internal.RealmImpl$1.invokeSuspend(SourceFile:138) at kotlin.coroutines.jvm.internal.a.resumeWith(SourceFile:12) at kotlinx.coroutines.DispatchedTask.run(SourceFile:129) at kotlinx.coroutines.EventLoopImplBase.processNextEvent(SourceFile:82) at kotlinx.coroutines.BlockingCoroutine.joinBlocking(SourceFile:27) at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(SourceFile:77) at kotlinx.coroutines.BuildersKt.runBlocking(SourceFile:1) at io.realm.kotlin.internal.platform.CoroutineUtilsSharedJvmKt.runBlocking(SourceFile:11) at io.realm.kotlin.internal.platform.CoroutineUtilsSharedJvmKt.runBlocking$default(SourceFile:7) at io.realm.kotlin.internal.RealmImpl.\u003cinit\u003e(SourceFile:15) at io.realm.kotlin.internal.RealmImpl.\u003cinit\u003e(SourceFile:1) at io.realm.kotlin.internal.RealmImpl$Companion.create$io_realm_kotlin_library(SourceFile:9) at io.realm.kotlin.Realm$Companion.open(SourceFile:10)
Steps & Code to Reproduce
I sadly do not have the file in question. However, a broken topRef means there are still bugs which make Realm not ACID and a reported file size of 0 means the error message is incorrect as well, because if it was 0 bytes in size, there would not be a readable topRef at all.