airbnb / lottie-android

Render After Effects animations natively on Android and iOS, Web, and React Native
http://airbnb.io/lottie/
Apache License 2.0
34.95k stars 5.4k forks source link

App Freeze When Enabling AsynUpdates #2521

Open gipartha opened 1 month ago

gipartha commented 1 month ago

Describe the bug App is freezing frequently and causing ANR wen started using async updates for Lottie rendering. We use Lottie heavily for our loading and chat animations. And multiple users stated reporting app freeze issue once we started rolling it out to our internal developers.

Lottie ver: 6.4.0

Steps To Reproduce

Steps to reproduce the behavior:

Lottie-ANR(ext).txt (Full Stack trace attached)

Main Thread Trace: "main" prio=5 tid=1 Runnable | group="main" sCount=0 ucsCount=0 flags=0 obj=0x73371638 self=0xb400007c30e10800 | sysTid=18760 nice=0 cgrp=default sched=0/0 handle=0x7ce5a13500 | state=R schedstat=( 8127128323 3797255225 16712 ) utm=643 stm=168 core=3 HZ=100 | stack=0x7fc5b73000-0x7fc5b75000 stackSize=8188KB | held mutexes= "mutator lock"(shared held) at com.airbnb.lottie.L.beginSection(unavailable:0) at com.airbnb.lottie.model.layer.BaseLayer.draw(unavailable:8) at com.airbnb.lottie.model.layer.CompositionLayer.drawLayer(unavailable:99) at com.airbnb.lottie.model.layer.BaseLayer.draw(unavailable:137) at com.airbnb.lottie.LottieDrawable.drawDirectlyToCanvas(unavailable:64) at com.airbnb.lottie.LottieDrawable.draw(unavailable:111) at android.widget.ImageView.onDraw(ImageView.java:1466) at android.view.View.draw(View.java:24218)

gpeal commented 1 month ago

What's surprising about your stack trace is that it's going through beginSection which suggests that it might be a lock in systrace. Do you call enableSystraceMarkers on Lottie anywhere?

https://github.com/airbnb/lottie-android/blob/master/lottie/src/main/java/com/airbnb/lottie/Lottie.java#L21

gipartha commented 1 month ago

@gpeal : No, we are not calling enableSystraceMarkers anywhere. I have pasted the configuration that we use in the issue description itself. Hope the default value is false(that's what we could see from the code). Is there some way to debug this and print the actual configuration being used?

gipartha commented 4 weeks ago

@gpeal : Kindly assist in this to debug this issue further.

gpeal commented 4 weeks ago

@gipartha Can you reproduce this in a sample project?