You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not sure if this behavior is only related to JVM or if other platforms have similar issues, but I have seen it appear the most on JVM.
I can reproduce after a few changes every time on my demo app for Sync.
The relevant code is:
public fun adjust(change: Int) {
// Use an application wide dispatcher
println("Adjust $change")
CoroutineScope(Dispatchers.Default).launch {
realm.write {
println("Start change on ${this.version()}")
println("Find ${counterObj.version()}")
findLatest(counterObj)?.run {
list.add(change)
}
}
}
}
It crashes pretty quickly with the below trace, indicating that the Realm that should have been held by counterObj has been closed.
Start change on VersionId(version=16)
Exception in thread "DefaultDispatcher-worker-3 @coroutine#1078" java.lang.IllegalStateException: Realm has been closed and is no longer accessible: ./default.realm
at io.realm.internal.RealmReference.version(RealmReference.kt:53)
at io.realm.internal.RealmStateHolder$DefaultImpls.version(RealmState.kt:50)
at io.realm.internal.RealmObjectInternal$DefaultImpls.version(RealmObjectInternal.kt:37)
at io.realm.kotlin.demo.model.Counter.version(Counter.kt:8)
at io.realm.RealmObjectKt.version(RealmObject.kt:46)
at io.realm.kotlin.demo.CounterRepository$adjust$1$1.invoke(CounterRepository.kt:58)
at io.realm.kotlin.demo.CounterRepository$adjust$1$1.invoke(CounterRepository.kt:56)
at io.realm.internal.SuspendableWriter$write$2.invokeSuspend(SuspendableWriter.kt:67)
(Coroutine boundary)
at io.realm.internal.RealmImpl.write(RealmImpl.kt:96)
at io.realm.kotlin.demo.CounterRepository$adjust$1.invokeSuspend(CounterRepository.kt:56)
(Coroutine creation stacktrace)
at kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt.createCoroutineUnintercepted(IntrinsicsJvm.kt:122)
at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt:30)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(Builders.common.kt:47)
at kotlinx.coroutines.BuildersKt.launch$default(Unknown Source)
at io.realm.kotlin.demo.CounterRepository.adjust(CounterRepository.kt:55)
at io.realm.kotlin.demo.MainKt$main$1$2$1$1$1$1.invoke(Main.kt:36)
at io.realm.kotlin.demo.MainKt$main$1$2$1$1$1$1.invoke(Main.kt:35)
at androidx.compose.foundation.ClickableKt$clickable$4$gesture$1$2.invoke-k-4lQ0M(Clickable.kt:137)
at androidx.compose.foundation.ClickableKt$clickable$4$gesture$1$2.invoke(Clickable.kt:137)
at androidx.compose.foundation.gestures.TapGestureDetectorKt$detectTapAndPress$2$1$1.invokeSuspend(TapGestureDetector.kt:378)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTaskKt.resume(DispatchedTask.kt:179)
at kotlinx.coroutines.CancellableContinuationImpl.resumeWith(CancellableContinuationImpl.kt:337)
at androidx.compose.ui.input.pointer.SuspendingPointerInputFilter$PointerEventHandlerCoroutine.offerPointerEvent(SuspendingPointerInputFilter.kt:432)
at androidx.compose.ui.input.pointer.SuspendingPointerInputFilter.dispatchPointerEvent(SuspendingPointerInputFilter.kt:330)
at androidx.compose.ui.input.pointer.SuspendingPointerInputFilter.onPointerEvent-H0pRuoY(SuspendingPointerInputFilter.kt:343)
at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(HitPathTracker.kt:287)
at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(HitPathTracker.kt:275)
at androidx.compose.ui.input.pointer.NodeParent.dispatchMainEventPass(HitPathTracker.kt:151)
at androidx.compose.ui.input.pointer.HitPathTracker.dispatchChanges(HitPathTracker.kt:90)
at androidx.compose.ui.input.pointer.PointerInputEventProcessor.process-gBdvCQM(PointerInputEventProcessor.kt:77)
at androidx.compose.ui.platform.DesktopOwner.processPointerInput-8iAsVTc$ui(DesktopOwner.desktop.kt:322)
at androidx.compose.ui.platform.DesktopOwners.onMouseReleased(DesktopOwners.desktop.kt:177)
at androidx.compose.ui.awt.ComposeLayer$initCanvas$2$mouseReleased$1.invoke(ComposeLayer.desktop.kt:183)
at androidx.compose.ui.awt.ComposeLayer$initCanvas$2$mouseReleased$1.invoke(ComposeLayer.desktop.kt:182)
at androidx.compose.ui.awt.AWTDebounceEventQueue$job$1.invokeSuspend(AWTDebounceEventQueue.desktop.kt:59)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: java.lang.IllegalStateException: Realm has been closed and is no longer accessible: ./default.realm
at io.realm.internal.RealmReference.version(RealmReference.kt:53)
at io.realm.internal.RealmStateHolder$DefaultImpls.version(RealmState.kt:50)
at io.realm.internal.RealmObjectInternal$DefaultImpls.version(RealmObjectInternal.kt:37)
at io.realm.kotlin.demo.model.Counter.version(Counter.kt:8)
at io.realm.RealmObjectKt.version(RealmObject.kt:46)
at io.realm.kotlin.demo.CounterRepository$adjust$1$1.invoke(CounterRepository.kt:58)
at io.realm.kotlin.demo.CounterRepository$adjust$1$1.invoke(CounterRepository.kt:56)
at io.realm.internal.SuspendableWriter$write$2.invokeSuspend(SuspendableWriter.kt:67)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
The text was updated successfully, but these errors were encountered:
Not sure if this behavior is only related to JVM or if other platforms have similar issues, but I have seen it appear the most on JVM.
I can reproduce after a few changes every time on my demo app for Sync.
The relevant code is:
It crashes pretty quickly with the below trace, indicating that the Realm that should have been held by
counterObj
has been closed.The text was updated successfully, but these errors were encountered: