JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.87k stars 1.15k forks source link

TapGestureDetector mutex is not locked error on Touchscreen #4560

Open acarlsen opened 5 months ago

acarlsen commented 5 months ago

Describe the bug This bug is identical to a previous closed issue. https://github.com/JetBrains/compose-multiplatform/issues/3655

I had this error with version 1.6.0 for several of my users (reported on Sentry.io). The app is a JVM desktop app, and was running on a Windows x64.

Affected platforms Desktop (Windows JVM)

Versions

To Reproduce I don't know how to recreate it (don't have desktop with touchscreen).

Stacktrace below:

java.lang.IllegalStateException: This mutex is not locked
    at kotlinx.coroutines.sync.MutexImpl.unlock(SourceFile:208)
    at kotlinx.coroutines.sync.MutexImpl$CancellableContinuationWithOwner$tryResume$token$1.invoke(SourceFile:256)
    at kotlinx.coroutines.sync.MutexImpl$CancellableContinuationWithOwner$tryResume$token$1.invoke(SourceFile:253)
    at kotlinx.coroutines.CancellableContinuationImpl.callOnCancellation(SourceFile:255)
    at kotlinx.coroutines.CompletedContinuation.invokeHandlers(SourceFile:655)
    at kotlinx.coroutines.CancellableContinuationImpl.cancelCompletedResult$kotlinx_coroutines_core(SourceFile:176)
    at kotlinx.coroutines.DispatchedTask.run(SourceFile:98)
    at b.b.f.l.F$b.a(SourceFile:90)
    at b.b.f.l.F$b.invoke(SourceFile:78)
    at b.b.f.l.F.a(SourceFile:99)
    at b.b.f.l.F.a(SourceFile:78)
    at b.b.f.n.A.c(SourceFile:88)
    at b.b.f.n.a.a(SourceFile:165)
    at b.b.f.n.u.onRender(SourceFile:562)
    at org.jetbrains.skiko.SkiaLayer.update$skiko(SourceFile:548)
    at org.jetbrains.skiko.redrawer.AWTRedrawer.update(SourceFile:54)
    at org.jetbrains.skiko.redrawer.WindowsOpenGLRedrawer$Companion$frameDispatcher$1.invokeSuspend(SourceFile:98)
    at org.jetbrains.skiko.redrawer.WindowsOpenGLRedrawer$Companion$frameDispatcher$1.invoke(SourceFile)
    at org.jetbrains.skiko.redrawer.WindowsOpenGLRedrawer$Companion$frameDispatcher$1.invoke(SourceFile)
    at org.jetbrains.skiko.FrameDispatcher$job$1.invokeSuspend(SourceFile:33)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(SourceFile:33)
    at kotlinx.coroutines.DispatchedTask.run(SourceFile:104)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:792)
    at java.awt.EventQueue$3.run(EventQueue.java:739)
    at java.awt.EventQueue$3.run(EventQueue.java:733)
    at java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:761)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:92)
kotlinx.coroutines.CompletionHandlerException: Exception in resume onCancellation handler for CancellableContinuation(DispatchedContinuation[F@36a53f9, Continuation at androidx.compose.foundation.gestures.PressGestureScopeImpl.reset(TapGestureDetector.kt)@22defa2d]){Completed}@1a460993
    at kotlinx.coroutines.CancellableContinuationImpl.callOnCancellation(SourceFile:260)
    at kotlinx.coroutines.CompletedContinuation.invokeHandlers(SourceFile:655)
    at kotlinx.coroutines.CancellableContinuationImpl.cancelCompletedResult$kotlinx_coroutines_core(SourceFile:176)
    at kotlinx.coroutines.DispatchedTask.run(SourceFile:98)
    at b.b.f.l.F$b.a(SourceFile:90)
    at b.b.f.l.F$b.invoke(SourceFile:78)
    at b.b.f.l.F.a(SourceFile:99)
    at b.b.f.l.F.a(SourceFile:78)
    at b.b.f.n.A.c(SourceFile:88)
    at b.b.f.n.a.a(SourceFile:165)
    at b.b.f.n.u.onRender(SourceFile:562)
    at org.jetbrains.skiko.SkiaLayer.update$skiko(SourceFile:548)
    at org.jetbrains.skiko.redrawer.AWTRedrawer.update(SourceFile:54)
    at org.jetbrains.skiko.redrawer.WindowsOpenGLRedrawer$Companion$frameDispatcher$1.invokeSuspend(SourceFile:98)
    at org.jetbrains.skiko.redrawer.WindowsOpenGLRedrawer$Companion$frameDispatcher$1.invoke(SourceFile)
    at org.jetbrains.skiko.redrawer.WindowsOpenGLRedrawer$Companion$frameDispatcher$1.invoke(SourceFile)
    at org.jetbrains.skiko.FrameDispatcher$job$1.invokeSuspend(SourceFile:33)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(SourceFile:33)
    at kotlinx.coroutines.DispatchedTask.run(SourceFile:104)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:792)
    at java.awt.EventQueue$3.run(EventQueue.java:739)
    at java.awt.EventQueue$3.run(EventQueue.java:733)
    at java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:761)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:92)
acarlsen commented 4 months ago

Just FYI here is an de-obfuscated stacktrace:

java.lang.IllegalStateException: This mutex is not locked at kotlinx.coroutines.sync.MutexImpl.unlock(SourceFile:208) at kotlinx.coroutines.sync.MutexImpl$CancellableContinuationWithOwner$tryResume$token$1.invoke(SourceFile:256) at kotlinx.coroutines.sync.MutexImpl$CancellableContinuationWithOwner$tryResume$token$1.invoke(SourceFile:253) at kotlinx.coroutines.CancellableContinuationImpl.callOnCancellation(SourceFile:255) at kotlinx.coroutines.CompletedContinuation.invokeHandlers(SourceFile:655) at kotlinx.coroutines.CancellableContinuationImpl.cancelCompletedResult$kotlinx_coroutines_core(SourceFile:176) at kotlinx.coroutines.DispatchedTask.run(SourceFile:98) at androidx.compose.ui.platform.FlushCoroutineDispatcher$dispatch$2$1.invoke(SourceFile:62) at androidx.compose.ui.platform.FlushCoroutineDispatcher$dispatch$2$1.invoke(SourceFile:57) at androidx.compose.ui.platform.FlushCoroutineDispatcher.performRun(SourceFile:99) at androidx.compose.ui.platform.FlushCoroutineDispatcher.access$performRun(SourceFile:37) at androidx.compose.ui.platform.FlushCoroutineDispatcher$dispatch$2.invokeSuspend(SourceFile:57) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(SourceFile:33) at kotlinx.coroutines.DispatchedTask.run(SourceFile:104) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:781) at java.awt.EventQueue$4.run(EventQueue.java:728) at java.awt.EventQueue$4.run(EventQueue.java:722) at java.security.AccessController.doPrivileged(AccessController.java:400) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87) at java.awt.EventQueue.dispatchEvent(EventQueue.java:750) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105) at java.awt.EventDispatchThread.run(EventDispatchThread.java:92) kotlinx.coroutines.CompletionHandlerException: Exception in resume onCancellation handler for CancellableContinuation(DispatchedContinuation[FlushCoroutineDispatcher@50dd9877, Continuation at androidx.compose.foundation.gestures.PressGestureScopeImpl.reset(TapGestureDetector.kt)@2eddd6a]){Completed}@7756587b at kotlinx.coroutines.CancellableContinuationImpl.callOnCancellation(SourceFile:260) at kotlinx.coroutines.CompletedContinuation.invokeHandlers(SourceFile:655) at kotlinx.coroutines.CancellableContinuationImpl.cancelCompletedResult$kotlinx_coroutines_core(SourceFile:176) at kotlinx.coroutines.DispatchedTask.run(SourceFile:98) at androidx.compose.ui.platform.FlushCoroutineDispatcher$dispatch$2$1.invoke(SourceFile:62) at androidx.compose.ui.platform.FlushCoroutineDispatcher$dispatch$2$1.invoke(SourceFile:57) at androidx.compose.ui.platform.FlushCoroutineDispatcher.performRun(SourceFile:99) at androidx.compose.ui.platform.FlushCoroutineDispatcher.access$performRun(SourceFile:37) at androidx.compose.ui.platform.FlushCoroutineDispatcher$dispatch$2.invokeSuspend(SourceFile:57) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(SourceFile:33) at kotlinx.coroutines.DispatchedTask.run(SourceFile:104) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:781) at java.awt.EventQueue$4.run(EventQueue.java:728) at java.awt.EventQueue$4.run(EventQueue.java:722) at java.security.AccessController.doPrivileged(AccessController.java:400) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87) at java.awt.EventQueue.dispatchEvent(EventQueue.java:750) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105) at java.awt.EventDispatchThread.run(EventDispatchThread.java:92)

dazza5000 commented 3 months ago

We got this crash report in Crashlytics this morning

okushnikov commented 1 month ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.