saket / telephoto

Building blocks for designing media experiences in Compose UI
https://saket.github.io/telephoto/
Apache License 2.0
869 stars 28 forks source link

Crash while panning around #41

Closed ganfra closed 5 months ago

ganfra commented 10 months ago

A user got a crash while panning around an image. I don't have the image to reproduce it, but hopefully the crash logs will be enough :

Thread: main, Exception: java.lang.IllegalStateException: Size is unspecified
at androidx.compose.ui.geometry.Size.getWidth-impl(Size.kt:48)
at me.saket.telephoto.zoomable.internal.DimensKt.roundToIntSize-uvyYCjk(dimens.kt:13)
at me.saket.telephoto.zoomable.internal.ContentPlacementKt$calculateTopLeftToOverlapWith$alignedOffset$2.invoke-nOcc-ac(contentPlacement.kt:33)
at me.saket.telephoto.zoomable.internal.ContentPlacementKt$calculateTopLeftToOverlapWith$alignedOffset$2.invoke(contentPlacement.kt:28)
at kotlin.UnsafeLazyImpl.getValue(Lazy.kt:81)
at me.saket.telephoto.zoomable.internal.ContentPlacementKt.calculateTopLeftToOverlapWith_x_KDEd0$lambda$1(contentPlacement.kt:28)
at me.saket.telephoto.zoomable.internal.ContentPlacementKt.calculateTopLeftToOverlapWith-x_KDEd0(contentPlacement.kt:45)
at me.saket.telephoto.zoomable.ZoomableState$coerceWithinBounds$1.invoke-MK-Hz9U(ZoomableState.kt:331)
at me.saket.telephoto.zoomable.ZoomableState$coerceWithinBounds$1.invoke(ZoomableState.kt:329)
at me.saket.telephoto.zoomable.internal.DimensKt.withZoomAndTranslate-aysBKyA(dimens.kt:54)
at me.saket.telephoto.zoomable.ZoomableState.coerceWithinBounds-8S9VItk(ZoomableState.kt:329)
at me.saket.telephoto.zoomable.ZoomableState.access$coerceWithinBounds-8S9VItk(ZoomableState.kt:88)
at me.saket.telephoto.zoomable.ZoomableState$transformableState$1.invoke-0DeBYlg(ZoomableState.kt:260)
at me.saket.telephoto.zoomable.ZoomableState$transformableState$1.invoke(ZoomableState.kt:197)
at me.saket.telephoto.zoomable.internal.DefaultTransformableState$transformScope$1.transformBy-0DeBYlg(transformableState.kt:111)
at me.saket.telephoto.zoomable.internal.TransformScope$-CC.transformBy-0DeBYlg$default(transformableState.kt:66)
at me.saket.telephoto.zoomable.ZoomableState$fling$2$1.invoke(ZoomableState.kt:470)
at me.saket.telephoto.zoomable.ZoomableState$fling$2$1.invoke(ZoomableState.kt:469)
at androidx.compose.animation.core.SuspendAnimationKt.doAnimationFrame(SuspendAnimation.kt:361)
at androidx.compose.animation.core.SuspendAnimationKt.doAnimationFrameWithScale(SuspendAnimation.kt:339)
at androidx.compose.animation.core.SuspendAnimationKt.access$doAnimationFrameWithScale(SuspendAnimation.kt:1)
at androidx.compose.animation.core.SuspendAnimationKt$animate$6.invoke(SuspendAnimation.kt:251)
at androidx.compose.animation.core.SuspendAnimationKt$animate$6.invoke(SuspendAnimation.kt:239)
at androidx.compose.animation.core.SuspendAnimationKt$callWithFrameNanos$2.invoke(SuspendAnimation.kt:304)
at androidx.compose.animation.core.SuspendAnimationKt$callWithFrameNanos$2.invoke(SuspendAnimation.kt:303)
at androidx.compose.runtime.BroadcastFrameClock$FrameAwaiter.resume(BroadcastFrameClock.kt:42)
at androidx.compose.runtime.BroadcastFrameClock.sendFrame(BroadcastFrameClock.kt:71)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:517)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:510)
at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(AndroidUiFrameClock.android.kt:34)
at androidx.compose.ui.platform.AndroidUiDispatcher.performFrameDispatch(AndroidUiDispatcher.android.kt:109)
at androidx.compose.ui.platform.AndroidUiDispatcher.access$performFrameDispatch(AndroidUiDispatcher.android.kt:41)
at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(AndroidUiDispatcher.android.kt:69)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1035)
at android.view.Choreographer.doCallbacks(Choreographer.java:845)
at android.view.Choreographer.doFrame(Choreographer.java:775)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1022)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7870)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [androidx.compose.ui.platform.MotionDurationScaleImpl@b094cc0, androidx.compose.runtime.BroadcastFrameClock@4d85df9, StandaloneCoroutine{Cancelling}@458113e, AndroidUiDispatcher@2b46b9f]
saket commented 10 months ago

Yea I've seen this happen a few times, but this particular crash has proven to be especially elusive. I recently made a change that will cause the crash to happen earlier in the call chain. Posting it here if someone is able to spot something obvious: https://github.com/saket/telephoto/blob/612c5a4ec26071e9f79628ecd330f02f0878159d/zoomable/src/commonMain/kotlin/me/saket/telephoto/zoomable/ZoomableState.kt#L332-L334

Can you also confirm telephoto's version in this crash report?

bmarty commented 10 months ago

We are using telephoto 0.5.0, and I confirm that we observe some crash reports with the check:

For instance:

Unspecified size, but how? Unscaled content = Rect.fromLTRB(0.0, 0.0, 756.0, 1008.0), proposed zoom = ContentZoom(baseZoom=ScaleFactor(1.4, 1.4), userZoom=1.3603797)

or

Unspecified size, but how? Unscaled content = Rect.fromLTRB(0.0, 0.0, 960.0, 1280.0), proposed zoom = ContentZoom(baseZoom=ScaleFactor(1.1, 1.1), userZoom=1.4155316)
saket commented 10 months ago

I spent a few hours but this crash seems to have become even more difficult to reproduce. I believe I have a better understanding of what might be causing it, but I'm still shooting in the dark.

To help myself, I've added some more debug information to the exception. @ganfra @bmarty possible for you to try out 0.6.0-SNAPSHOT in your apps and share any following crash reports here?

jmartinesp commented 10 months ago

Is the 0.6.0-SNAPSHOT version published somewhere? I tried bumping our local version to test this myself, but gradle couldn't find it and it's not in sonatype's snapshot repository.

saket commented 10 months ago

it's not in sonatype's snapshot repository.

Hmmm that doesn't sound right. Can you try again? You can find the snapshot artifacts here:

https://oss.sonatype.org/content/repositories/snapshots/me/saket/telephoto/zoomable-image-coil/0.6.0-SNAPSHOT/

allprojects {
  repositories {
    …
    maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" }
  }
}
igorilin13 commented 10 months ago

I did run into this crash but haven't been able to reproduce it since. I was just doing a lot of zoom and double tap gestures in random order, and right before it crashed I tried to do a double tap Hope this helps at all


java.lang.IllegalStateException: Can't coerce an infinite offset 
    proposedZoom = ContentZoom(baseZoom=ScaleFactor(1.0, 1.0), userZoom=1.1901567)
    rawTransformation = RawTransformation(offset=Offset(113.4, 199.6), zoom=ContentZoom(baseZoom=ScaleFactor(1.0, 1.0), userZoom=1.1901567), lastCentroid=Offset(327.0, 897.5), contentSize=Size(720.0, 1249.0))
    contentTransformation = ZoomableContentTransformation(isSpecified=true, contentSize=Size(720.0, 1249.0), scale=ScaleFactor(1.2, 1.2), rotationZ=0.0, offset=Offset(-134.9, -237.5), transformOrigin=TransformOrigin(packedValue=0))
    contentScale = androidx.compose.ui.layout.ContentScale$Companion$Fit$1@418e67e
    contentAlignment = BiasAlignment(horizontalBias=0.0, verticalBias=0.0)
    isReadyToInteract = true
    unscaledContentLocation = me.saket.telephoto.zoomable.ZoomableContentLocation$SameAsLayoutBounds@848b7df
    unscaledContentBounds = Rect.fromLTRB(0.0, 0.0, 720.0, 1249.0)
    contentLayoutSize = Size(720.0, 1249.0)
    zoomSpec = ZoomSpec(maxZoomFactor=3.0, preventOverOrUnderZoom=true)
    Device = SM-A127F
    Android version = 33
    Display resolution = Point(720, 1600)
    Current window bounds = Rect(0, 0 - 720, 1600), insets = Insets{left=0, top=45, right=0, bottom=28}
saket commented 10 months ago

Thanks @igorilin13! Can you also share the full stacktrace? coerceWithinBounds() is called from 3 places so I need to make sure I'm pulling the right thread.

igorilin13 commented 10 months ago
at me.saket.telephoto.zoomable.ZoomableState.coerceWithinBounds-8S9VItk(ZoomableState.kt:339)
at me.saket.telephoto.zoomable.ZoomableState.access$coerceWithinBounds-8S9VItk(ZoomableState.kt:91)
at me.saket.telephoto.zoomable.ZoomableState$transformableState$1.invoke-0DeBYlg(ZoomableState.kt:269)
at me.saket.telephoto.zoomable.ZoomableState$transformableState$1.invoke(ZoomableState.kt:200)
at me.saket.telephoto.zoomable.internal.DefaultTransformableState$transformScope$1.transformBy-0DeBYlg(transformableState.kt:109)
at me.saket.telephoto.zoomable.internal.TransformScope$DefaultImpls.transformBy-0DeBYlg$default(transformableState.kt:64)
at me.saket.telephoto.zoomable.ZoomableState$fling$2$1.invoke(ZoomableState.kt:500)
at me.saket.telephoto.zoomable.ZoomableState$fling$2$1.invoke(ZoomableState.kt:499)
at androidx.compose.animation.core.SuspendAnimationKt.doAnimationFrame(SuspendAnimation.kt:361)
at androidx.compose.animation.core.SuspendAnimationKt.doAnimationFrameWithScale(SuspendAnimation.kt:339)
at androidx.compose.animation.core.SuspendAnimationKt.access$doAnimationFrameWithScale(SuspendAnimation.kt:1)
at androidx.compose.animation.core.SuspendAnimationKt$animate$6.invoke(SuspendAnimation.kt:251)
at androidx.compose.animation.core.SuspendAnimationKt$animate$6.invoke(SuspendAnimation.kt:239)
at androidx.compose.animation.core.SuspendAnimationKt$callWithFrameNanos$2.invoke(SuspendAnimation.kt:304)
at androidx.compose.animation.core.SuspendAnimationKt$callWithFrameNanos$2.invoke(SuspendAnimation.kt:303)
at androidx.compose.runtime.BroadcastFrameClock$FrameAwaiter.resume(BroadcastFrameClock.kt:42)
at androidx.compose.runtime.BroadcastFrameClock.sendFrame(BroadcastFrameClock.kt:71)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:517)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:510)
at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(AndroidUiFrameClock.android.kt:34)
at androidx.compose.ui.platform.AndroidUiDispatcher.performFrameDispatch(AndroidUiDispatcher.android.kt:109)
at androidx.compose.ui.platform.AndroidUiDispatcher.access$performFrameDispatch(AndroidUiDispatcher.android.kt:41)
at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(AndroidUiDispatcher.android.kt:69)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1299)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1309)
at android.view.Choreographer.doCallbacks(Choreographer.java:923)
saket commented 10 months ago

Huh these logs suggest that I've been investigating in the wrong direction all this time. The infinite offset isn't being calculated by any division by zero errors, but rather an infinite velocity tracked by the gesture receiver. I've added a few more logs to confirm this. Please keep sending the stacktraces, and thanks again!

jmartinesp commented 10 months ago

We have another recent stacktrace here:

Exception java.lang.IllegalStateException:
  at me.saket.telephoto.zoomable.ZoomableState$coerceWithinBounds$1.invoke-MK-Hz9U (ZoomableState.kt:332)
  at me.saket.telephoto.zoomable.ZoomableState$coerceWithinBounds$1.invoke (ZoomableState.kt:330)
  at me.saket.telephoto.zoomable.internal.DimensKt.withZoomAndTranslate-aysBKyA (Dimens.kt:54)
  at me.saket.telephoto.zoomable.ZoomableState.coerceWithinBounds-8S9VItk (ZoomableState.kt:330)
  at me.saket.telephoto.zoomable.ZoomableState.access$coerceWithinBounds-8S9VItk (ZoomableState.kt:89)
  at me.saket.telephoto.zoomable.ZoomableState$transformableState$1.invoke-0DeBYlg (ZoomableState.kt:261)
  at me.saket.telephoto.zoomable.ZoomableState$transformableState$1.invoke (ZoomableState.kt:198)
  at me.saket.telephoto.zoomable.internal.DefaultTransformableState$transformScope$1.transformBy-0DeBYlg (DefaultTransformableState.java:111)
  at me.saket.telephoto.zoomable.internal.TransformScope.transformBy-0DeBYlg$default (TransformScope.java:66)
  at me.saket.telephoto.zoomable.ZoomableState$fling$2$1.invoke (ZoomableState.java:473)
  at me.saket.telephoto.zoomable.ZoomableState$fling$2$1.invoke (ZoomableState.java:472)
  at androidx.compose.animation.core.SuspendAnimationKt.doAnimationFrame (SuspendAnimation.kt:361)
  at androidx.compose.animation.core.SuspendAnimationKt.doAnimationFrameWithScale (SuspendAnimation.kt:339)
  at androidx.compose.animation.core.SuspendAnimationKt.access$doAnimationFrameWithScale (SuspendAnimation.kt:1)
  at androidx.compose.animation.core.SuspendAnimationKt$animate$6.invoke (SuspendAnimation.kt:251)
  at androidx.compose.animation.core.SuspendAnimationKt$animate$6.invoke (SuspendAnimation.kt:239)
  at androidx.compose.animation.core.SuspendAnimationKt$callWithFrameNanos$2.invoke (SuspendAnimation.kt:304)
  at androidx.compose.animation.core.SuspendAnimationKt$callWithFrameNanos$2.invoke (SuspendAnimation.kt:303)
  at androidx.compose.runtime.BroadcastFrameClock$FrameAwaiter.resume (BroadcastFrameClock.java:42)
  at androidx.compose.runtime.BroadcastFrameClock.sendFrame (BroadcastFrameClock.kt:71)
  at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke (Recomposer.kt:555)
  at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke (Recomposer.kt:548)
  at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame (AndroidUiFrameClock.android.kt:41)
  at androidx.compose.ui.platform.AndroidUiDispatcher.performFrameDispatch (AndroidUiDispatcher.java:109)
  at androidx.compose.ui.platform.AndroidUiDispatcher.access$performFrameDispatch (AndroidUiDispatcher.java:41)
  at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame (AndroidUiDispatcher.android.kt:69)
  at android.view.Choreographer$CallbackRecord.run (Choreographer.java:1229)
  at android.view.Choreographer$CallbackRecord.run (Choreographer.java:1239)
  at android.view.Choreographer.doCallbacks (Choreographer.java:899)
  at android.view.Choreographer.doFrame (Choreographer.java:827)
  at android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:1214)
  at android.os.Handler.handleCallback (Handler.java:942)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loopOnce (Looper.java:201)
  at android.os.Looper.loop (Looper.java:288)
  at android.app.ActivityThread.main (ActivityThread.java:7918)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:548)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:936)
saket commented 10 months ago

Does that stacktrace not contain any message? The line numbers seem to point to https://github.com/saket/telephoto/commit/bb4929b7dfa461ce11af899726a146f10725907e, which is an old snapshot build before any debug information was added to the exceptions.

jmartinesp commented 10 months ago

Does that stacktrace not contain any message? The line numbers seem to point to bb4929b, which is an old snapshot build before any debug information was added to the exceptions.

No, that's all we got from the crash in play store, sorry. I thought this stacktrace was from a version that should have a SNAPSHOT with the debug info, but I believe it comes from nightly versions who share the same string version, so maybe it was one before we switched to using the snapshots 🤔 .

saket commented 10 months ago

No worries, I should have bumped up the snapshot version to avoid this confusion.

FWIW I was able to reproduce a situation where quick zooms would result in a division by zero error and it looks awfully similar to this crash. I'm not 100% sure it's the same one because @igorilin13's stacktrace in https://github.com/saket/telephoto/issues/41#issuecomment-1701315404 indicates that a fling was made before the crash occurred, but 🤞! I'll make a new release soon.

jmartinesp commented 9 months ago

We got some new logs for a crash:

Exception: java.lang.IllegalArgumentException: Cannot coerce value to an empty range: maximum 700 is less than minimum 1030.
at coil.size.-Sizes.coerceIn(SourceFile:7)
at kotlinx.coroutines.flow.FlowKt__DelayKt$debounceInternal$1.invokeSuspend(SourceFile:584)
at kotlinx.coroutines.flow.FlowKt__DelayKt$debounceInternal$1.invoke(SourceFile:65)
at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3$1$2.invokeSuspend(SourceFile:35)
at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3$1$2.invoke(SourceFile:13)
at kotlinx.coroutines.AbstractCoroutine.start$enumunboxing$(SourceFile:28)
at kotlinx.coroutines.JobKt.launch$default(SourceFile:35)
at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3$1.emit(SourceFile:105)
at me.saket.telephoto.zoomable.ZoomableImageKt$ZoomableImage$lambda$5$$inlined$filter$1$2.emit(SourceFile:83)
at kotlinx.coroutines.flow.FlowKt__MergeKt$flattenConcat$1$1.emit(SourceFile:290)
at kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SourceFile:5)
at kotlinx.coroutines.flow.internal.SafeCollector.emit(SourceFile:23)
at kotlinx.coroutines.flow.internal.SafeCollector.emit(SourceFile:1)
at androidx.compose.runtime.SnapshotStateKt__SnapshotFlowKt$snapshotFlow$1.invokeSuspend(SourceFile:142)
at androidx.compose.runtime.SnapshotStateKt__SnapshotFlowKt$snapshotFlow$1.invoke(SourceFile:13)
at kotlinx.coroutines.flow.SafeFlow.collect(SourceFile:172)
at coil.size.ViewSizeResolver$-CC.m(SourceFile:4)
at com.bumble.appyx.core.FlowExtKt$withPrevious$$inlined$filter$1.collect(SourceFile:354)
at me.saket.telephoto.zoomable.ZoomableImageKt$ZoomableImage$lambda$5$$inlined$filter$1.collect(SourceFile:17)
at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3.invokeSuspend(SourceFile:47)
at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3.invoke(SourceFile:13)
at okhttp3.logging.Utf8Kt.startUndispatchedOrReturn(SourceFile:5)
at org.jsoup.Jsoup.coroutineScope(SourceFile:10)
at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest.flowCollect(SourceFile:7)
at kotlinx.coroutines.flow.internal.ChannelFlowOperator.collectTo(SourceFile:6)
at kotlinx.coroutines.flow.internal.ChannelFlow$collectToFun$1.invokeSuspend(SourceFile:33)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(SourceFile:9)
at kotlinx.coroutines.DispatchedTask.run(SourceFile:116)
at com.google.android.gms.tasks.zzc.run(SourceFile:32)
at kotlinx.coroutines.scheduling.TaskImpl.run(SourceFile:3)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(SourceFile:94)
Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [androidx.compose.ui.platform.MotionDurationScaleImpl@469ec73, androidx.compose.runtime.BroadcastFrameClock@b16e730, StandaloneCoroutine{Cancelling}@2513fa9, AndroidUiDispatcher@3b3c92e]
saket commented 9 months ago

Interesting, can you include the full stacktrace? It is unclear where the crash is happening.

jmartinesp commented 9 months ago

Interesting, can you include the full stacktrace? It is unclear where the crash is happening.

I edited the stacktrace above, but now that I look at it again this might be an actual bug in our code that I mistook for this issue. I saw IllegalArgumentException and coerceIn and I assumed it was the same issue, but looking at the previous stacktraces, it should be IllegalStateException and coerceWithingBounds instead.

saket commented 9 months ago

Haha no worries!

saket commented 9 months ago

FWIW I was able to reproduce a situation where quick zooms would result in a division by zero error and it looks awfully similar to this crash. I'm not 100% sure it's the same one because @igorilin13's stacktrace in https://github.com/saket/telephoto/issues/41#issuecomment-1701315404 indicates that a fling was made before the crash occurred, but 🤞! I'll make a new release soon.

Has anyone received any new crash reports since ^ this change was published?

saket commented 9 months ago

@jmartinesp is it possible that your crash is related to https://github.com/saket/telephoto/issues/49? The presence of coil.size.-Sizes in your stacktrace suggests otherwise but I wonder if your crash reporting service is somehow mangling your crash stacktraces?

FilippoVigani commented 8 months ago

@saket I just had this happen to me (version 0.6.1). Here are the logs:

FATAL EXCEPTION: main
Process: com.truescreen.app.dev, PID: 21333
java.lang.IllegalStateException: Can't coerce an infinite offset 
proposedZoom = ContentZoom(baseZoom=ScaleFactor(0.0, 0.0), userZoom=1.0)
rawTransformation = RawTransformation(offset=Offset(1.0, 0.0), zoom=ContentZoom(baseZoom=ScaleFactor(0.0, 0.0), userZoom=1.0), lastCentroid=Offset(0.0, 0.0), contentSize=Size(0.0, 0.0))
contentTransformation = ZoomableContentTransformation(isSpecified=false, contentSize=Size.Unspecified, scale=ScaleFactor(0.0, 0.0), rotationZ=0.0, offset=Offset(0.0, 0.0), transformOrigin=TransformOrigin(packedValue=0), centroid=null)
contentScale = androidx.compose.ui.layout.ContentScale$Companion$Fit$1@95e8f85
contentAlignment = BiasAlignment(horizontalBias=0.0, verticalBias=0.0)
isReadyToInteract = true
unscaledContentLocation = me.saket.telephoto.zoomable.ZoomableContentLocation$SameAsLayoutBounds@2dbd1da
unscaledContentBounds = Rect.fromLTRB(0.0, 0.0, 1078.0, 1526.0)
contentLayoutSize = Size(1078.0, 1526.0)
zoomSpec = ZoomSpec(maxZoomFactor=2.0, preventOverOrUnderZoom=true)
Device = Pixel 6
Android version = 33
Display resolution = Point(1080, 2400)
Current window bounds = Rect(0, 0 - 1080, 2400), insets = Insets{left=0, top=128, right=0, bottom=63}
Please share this error message to https://github.com/saket/telephoto/issues/41?

    at me.saket.telephoto.zoomable.ZoomableState.coerceWithinBounds-8S9VItk(ZoomableState.kt:359)
    at me.saket.telephoto.zoomable.ZoomableState.canConsumePanChange-k-4lQ0M$zoomable_release(ZoomableState.kt:292)
    at me.saket.telephoto.zoomable.ZoomableKt$zoomable$1$zoomableModifier$1.invoke-k-4lQ0M(Zoomable.kt:57)
    at me.saket.telephoto.zoomable.ZoomableKt$zoomable$1$zoomableModifier$1.invoke(Zoomable.kt:57)
    at me.saket.telephoto.zoomable.internal.TransformableKt.detectZoom(transformable.kt:200)
    at me.saket.telephoto.zoomable.internal.TransformableKt.access$detectZoom(transformable.kt:1)
    at me.saket.telephoto.zoomable.internal.TransformableKt$detectZoom$1.invokeSuspend(Unknown Source:17)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTaskKt.resume(DispatchedTask.kt:179)
    at kotlinx.coroutines.DispatchedTaskKt.dispatch(DispatchedTask.kt:168)
    at kotlinx.coroutines.CancellableContinuationImpl.dispatchResume(CancellableContinuationImpl.kt:474)
    at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl(CancellableContinuationImpl.kt:508)
    at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl$default(CancellableContinuationImpl.kt:497)
    at kotlinx.coroutines.CancellableContinuationImpl.resumeWith(CancellableContinuationImpl.kt:368)
    at androidx.compose.ui.input.pointer.SuspendingPointerInputModifierNodeImpl$PointerEventHandlerCoroutine.offerPointerEvent(SuspendingPointerInputFilter.kt:665)
    at androidx.compose.ui.input.pointer.SuspendingPointerInputModifierNodeImpl.dispatchPointerEvent(SuspendingPointerInputFilter.kt:544)
    at androidx.compose.ui.input.pointer.SuspendingPointerInputModifierNodeImpl.onPointerEvent-H0pRuoY(SuspendingPointerInputFilter.kt:566)
    at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(HitPathTracker.kt:317)
    at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(HitPathTracker.kt:303)
    at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(HitPathTracker.kt:303)
    at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(HitPathTracker.kt:303)
    at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(HitPathTracker.kt:303)
    at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(HitPathTracker.kt:303)
    at androidx.compose.ui.input.pointer.NodeParent.dispatchMainEventPass(HitPathTracker.kt:185)
    at androidx.compose.ui.input.pointer.HitPathTracker.dispatchChanges(HitPathTracker.kt:104)
    at androidx.compose.ui.input.pointer.PointerInputEventProcessor.process-BIzXfog(PointerInputEventProcessor.kt:106)
2023-10-10 15:25:04.176 21333-21333 AndroidRuntime          com.truescreen.app.dev               E      at androidx.compose.ui.platform.AndroidComposeView.sendMotionEvent-8iAsVTc(AndroidComposeView.android.kt:1495)
    at androidx.compose.ui.platform.AndroidComposeView.handleMotionEvent-8iAsVTc(AndroidComposeView.android.kt:1446)
    at androidx.compose.ui.platform.AndroidComposeView.dispatchTouchEvent(AndroidComposeView.android.kt:1386)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802)
    at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:500)
    at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1912)
    at android.app.Activity.dispatchTouchEvent(Activity.java:4299)
    at io.sentry.android.core.internal.gestures.WindowCallbackAdapter.dispatchTouchEvent(WindowCallbackAdapter.java:39)
    at io.sentry.android.core.internal.gestures.SentryWindowCallback.dispatchTouchEvent(SentryWindowCallback.java:64)
    at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:458)
    at android.view.View.dispatchPointerEvent(View.java:15309)
    at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:6778)
    at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:6578)
    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:6034)
    at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:6091)
    at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:6057)
    at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:6222)
    at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:6065)
    at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:6279)
    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:6038)
    at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:6091)
    at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:6057)
    at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:6065)
    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:6038)
    at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:9206)
    at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:9157)
    at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:9126)
    at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:9329)
    at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:267)
    at android.os.MessageQueue.nativePollOnce(Native Method)
    at android.os.MessageQueue.next(MessageQueue.java:335)
    at android.os.Looper.loopOnce(Looper.java:161)
    at android.os.Looper.loop(Looper.java:288)
    at android.app.ActivityThread.main(ActivityThread.java:7918)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
    Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [androidx.compose.ui.platform.MotionDurationScaleImpl@963d100, androidx.compose.runtime.BroadcastFrameClock@f2e2d39, StandaloneCoroutine{Cancelling}@b86cf7e, AndroidUiDispatcher@512ecdf]

I am using ZoomableAsyncImage in a LazyColumn fyi.

saket commented 7 months ago

@FilippoVigani this was very helpful, thank you!

I think I'm close to marking these crashes as resolved after this and https://github.com/saket/telephoto/issues/53.

I am using ZoomableAsyncImage in a LazyColumn fyi.

How are you finding its performance? Modifier.zoomable() uses Modifier.composed() underneath so it is not super performant yet. Migrating it to Modifier.Node is on my todo list.

saket commented 7 months ago

0.7.1 should hopefully mark the end of this issue. I'll keep this open for a few months just to be sure.

saket commented 5 months ago

I haven't received any more crash reports so I'm going ahead and closing this one. Please feel free to reopen if you see anything in your crash monitoring system.