Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash while panning around #41

Closed
ganfra opened this issue Aug 8, 2023 · 23 comments
Closed

Crash while panning around #41

ganfra opened this issue Aug 8, 2023 · 23 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@ganfra
Copy link

ganfra commented Aug 8, 2023

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
Copy link
Owner

saket commented Aug 8, 2023

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:

check (expectedDrawRegion.size.isSpecified) {
"Unspecified size, but how? Unscaled content = $unscaledContentBounds, proposed zoom = $proposedZoom"
}

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

@saket saket added bug Something isn't working help wanted Extra attention is needed labels Aug 8, 2023
@bmarty
Copy link

bmarty commented Aug 21, 2023

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
Copy link
Owner

saket commented Aug 22, 2023

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
Copy link

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
Copy link
Owner

saket commented Aug 28, 2023

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
Copy link

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
Copy link
Owner

saket commented Aug 31, 2023

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
Copy link

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 added a commit that referenced this issue Aug 31, 2023
@saket
Copy link
Owner

saket commented Sep 1, 2023

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
Copy link

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
Copy link
Owner

saket commented Sep 4, 2023

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.

@jmartinesp
Copy link

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
Copy link
Owner

saket commented Sep 5, 2023

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 #41 (comment) indicates that a fling was made before the crash occurred, but 🤞! I'll make a new release soon.

@jmartinesp
Copy link

jmartinesp commented Sep 13, 2023

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
Copy link
Owner

saket commented Sep 19, 2023

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

@jmartinesp
Copy link

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
Copy link
Owner

saket commented Sep 19, 2023

Haha no worries!

@saket
Copy link
Owner

saket commented Sep 21, 2023

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 #41 (comment) 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
Copy link
Owner

saket commented Sep 22, 2023

@jmartinesp is it possible that your crash is related to #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
Copy link

@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 added a commit that referenced this issue Nov 9, 2023
@saket
Copy link
Owner

saket commented Nov 9, 2023

@FilippoVigani this was very helpful, thank you!

I think I'm close to marking these crashes as resolved after this and #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
Copy link
Owner

saket commented Nov 18, 2023

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

slack-oss-bot added a commit to slackhq/circuit that referenced this issue Nov 20, 2023
…1002)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
|
[me.saket.telephoto:zoomable-image-coil](https://togithub.com/saket/telephoto)
| dependencies | minor | `0.6.2` -> `0.7.1` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>saket/telephoto
(me.saket.telephoto:zoomable-image-coil)</summary>

### [`v0.7.1`](https://togithub.com/saket/telephoto/releases/tag/0.7.1)

- Migrated all usages of `Modifier.composed()` to the new
[`Modifier.Node`
architecture](https://www.youtube.com/watch?v=BjGX2RftXsU). This should
help with performance, especially if your app uses multiple zoomable
content on the same screen.
-
[saket/telephoto#54:
`ZoomableContentTransformation` now includes additional information
about the content's scale:
[`ScaleMetadata`](https://togithub.com/saket/telephoto/blob/9bf0937333e240832d5ecaad57bf31825f0d76b7/zoomable/src/commonMain/kotlin/me/saket/telephoto/zoomable/ZoomableContentTransformation.kt#L78-L90),

Breaking changes

- Reduced the public API surface by replacing all `data` classes with
plain classes. These classes still implement `equals` and `hashCode`
(thanks to [poko](https://togithub.com/drewhamilton/poko/)), but they no
longer offer any `componentN()` or `copy()` functions.

Bug fixes

-
[saket/telephoto#53:
Prevent crashes when Compose UI reports the velocity of a gesture to be
infinite.
-
[saket/telephoto#41:
Fixed a crash where touch events received after the UI was restored
would cause a division by zero error if the layout wasn't measured yet.

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://togithub.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy41OS44IiwidXBkYXRlZEluVmVyIjoiMzcuNTkuOCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->
ZacSweers pushed a commit to ZacSweers/CatchUp that referenced this issue Nov 20, 2023
[![Mend Renovate logo
banner](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[me.saket.telephoto:zoomable-image-coil](https://togithub.com/saket/telephoto)
| `0.6.2` -> `0.7.1` |
[![age](https://developer.mend.io/api/mc/badges/age/maven/me.saket.telephoto:zoomable-image-coil/0.7.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/me.saket.telephoto:zoomable-image-coil/0.7.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/me.saket.telephoto:zoomable-image-coil/0.6.2/0.7.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/me.saket.telephoto:zoomable-image-coil/0.6.2/0.7.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[me.saket.telephoto:zoomable-image](https://togithub.com/saket/telephoto)
| `0.6.2` -> `0.7.1` |
[![age](https://developer.mend.io/api/mc/badges/age/maven/me.saket.telephoto:zoomable-image/0.7.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/me.saket.telephoto:zoomable-image/0.7.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/me.saket.telephoto:zoomable-image/0.6.2/0.7.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/me.saket.telephoto:zoomable-image/0.6.2/0.7.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [me.saket.telephoto:zoomable](https://togithub.com/saket/telephoto) |
`0.6.2` -> `0.7.1` |
[![age](https://developer.mend.io/api/mc/badges/age/maven/me.saket.telephoto:zoomable/0.7.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/me.saket.telephoto:zoomable/0.7.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/me.saket.telephoto:zoomable/0.6.2/0.7.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/me.saket.telephoto:zoomable/0.6.2/0.7.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>saket/telephoto
(me.saket.telephoto:zoomable-image-coil)</summary>

### [`v0.7.1`](https://togithub.com/saket/telephoto/releases/tag/0.7.1)

- Migrated all usages of `Modifier.composed()` to the new
[`Modifier.Node`
architecture](https://www.youtube.com/watch?v=BjGX2RftXsU). This should
help with performance, especially if your app uses multiple zoomable
content on the same screen.
-
[saket/telephoto#54:
`ZoomableContentTransformation` now includes additional information
about the content's scale:
[`ScaleMetadata`](https://togithub.com/saket/telephoto/blob/9bf0937333e240832d5ecaad57bf31825f0d76b7/zoomable/src/commonMain/kotlin/me/saket/telephoto/zoomable/ZoomableContentTransformation.kt#L78-L90),

Breaking changes

- Reduced the public API surface by replacing all `data` classes with
plain classes. These classes still implement `equals` and `hashCode`
(thanks to [poko](https://togithub.com/drewhamilton/poko/)), but they no
longer offer any `componentN()` or `copy()` functions.

Bug fixes

-
[saket/telephoto#53:
Prevent crashes when Compose UI reports the velocity of a gesture to be
infinite.
-
[saket/telephoto#41:
Fixed a crash where touch events received after the UI was restored
would cause a division by zero error if the layout wasn't measured yet.

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these
updates again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/ZacSweers/CatchUp).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy41OS44IiwidXBkYXRlZEluVmVyIjoiMzcuNTkuOCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@saket
Copy link
Owner

saket commented Jan 21, 2024

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.

@saket saket closed this as completed Jan 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

6 participants