realm / realm-kotlin

Kotlin Multiplatform and Android SDK for the Realm Mobile Database: Build Better Apps Faster.
Apache License 2.0
886 stars 52 forks source link

[realm-core-13.19.0] No built-in scheduler implementation #1688

Closed darrinps closed 3 months ago

darrinps commented 3 months ago

How frequently does the bug occur?

Every run

Description

I have a KMP app and I'm trying to use Realm in it.

When the following code is executed, I get the "No built-in scheduler..." error ever so briefly flash across the screen (had to video it to see what was happening).

`val configuration = RealmConfiguration.create(schema = setOf(PelletLot::class)) val realm = Realm.open(configuration)

fun saveNewLot(newPellotLot: PelletLot) {

realm.writeBlocking {
    val pellotLot = copyToRealm(newPellotLot)

    Napier.d("PellotLot: " + pellotLot.lotNumber + " saved off.")
}

}`

Stacktrace & log output

The only output I could see was that the error occurs at scheduler.cpp line 134

Can you reproduce the bug?

Yes

Reproduction Steps

Rerun the code.

Version

1.11.0

What Atlas App Services are you using?

Local Database only

Are you using encryption?

No

Platform OS and version(s)

Kotlin 1.9.22 Android 34 for a Desktop app running on Windows 11

Build environment

Android Studio version: ...2023.2.1 Android Build Tools version: ...35-rc1 Gradle version: ...8.5

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

➤ PM Bot commented:

Jira ticket: RKOTLIN-1036

kneth commented 3 months ago

@darrinps It has been fixed in 1.11.1

darrinps commented 3 months ago

I can still reproduce it.

I changed to version 1.11.1 as can be see here.

image

Executing the following code still caused the same error. Note that the error wasn't caught in the try/catch. I had to video the execution to see it.

`
fun saveNewLot(newPellotLot: PelletLot) { Logger.d("Saving new lot with Key: ${newPellotLot.dateOfInput} lotNumber: ${newPellotLot.lotNumber}")

val configuration = RealmConfiguration.create(schema = setOf(PelletLot::class))
Logger.d("About to open Realm Configuration: $configuration")

try {

    val realm = Realm.open(configuration)   //<---- ERROR OCCURS HERE

    Logger.d("Realm opened: : ${realm.toString()}")

    realm.writeBlocking {
        val pellotLot = copyToRealm(newPellotLot)

        //.d("PellotLot: " + pellotLot.lotNumber + " saved off.")
    }

    realm.close()

} catch (ex: Exception) {
    Logger.e("Exception caught: " + ex.message)
    Logger.e("Stack trace: " + ex.stackTraceToString())
}

}`

darrinps commented 3 months ago

Here is the error reported.

image