gilzoide / unity-lottie-player

Player for Lottie animations, powered by rlottie, multithread/Job System-friendly
The Unlicense
18 stars 1 forks source link

Crashes on iOS #9

Open TonSharp opened 2 weeks ago

TonSharp commented 2 weeks ago

I'm observing a several iOS crashes

This one is reproducible on iOS 15. Devices: iPhone 6s, 7, 7 Plus

Crashed: Job.Worker 0
0  libsystem_platform.dylib       0x1c2c __bzero + 28
1  UnityFramework                 0x5db3a94 rlottie::internal::renderer::Composition::render(rlottie::Surface const&) + 924
2  UnityFramework                 0x5de3420 lottie_animation_render_aspect + 136
3  UnityFramework                 0x4d6d2e8 ExecuteJob(ManagedJobData*, void (*)(void*, void*, void*, void*, int), int, unsigned char*) + 1156 (JobsBindings.cpp:1156)
4  UnityFramework                 0x4d6c8fc ForwardJobToManaged(ManagedJobData*) + 1440 (JobsBindings.cpp:1440)
5  UnityFramework                 0x4d6a8b8 ujob_execute_job(ujob_control_t*, ujob_lane_t*, ujob_job_t*, ujob_handle_t, unsigned int) + 972 (ujobs.cpp:972)
6  UnityFramework                 0x4d6ab74 lane_guts(ujob_control_t*, ujob_lane_t*, int, int) + 1146 (ujobs.cpp:1146)
7  UnityFramework                 0x4d6b62c worker_thread_routine(void*) + 1157 (ujobs.cpp:1157)
8  UnityFramework                 0x4e3a0c8 Thread::RunThreadWrapper(void*) + 112 (Thread.cpp:112)
9  libsystem_pthread.dylib        0x3338 _pthread_start + 116
10 libsystem_pthread.dylib        0x1938 thread_start + 8

And this one reproducible on iOS 14, 15 and iPadOS 16. Devices: iPhone 6s, 7, 7 Plus, iPad Pro

Crashed: Job.Worker 0
0  UnityFramework                 0x5de33c0 lottie_animation_render_aspect + 40
1  UnityFramework                 0x4d6d2e8 ExecuteJob(ManagedJobData*, void (*)(void*, void*, void*, void*, int), int, unsigned char*) + 1156 (JobsBindings.cpp:1156)
2  UnityFramework                 0x4d6d2e8 ExecuteJob(ManagedJobData*, void (*)(void*, void*, void*, void*, int), int, unsigned char*) + 1156 (JobsBindings.cpp:1156)
3  UnityFramework                 0x4d6c8fc ForwardJobToManaged(ManagedJobData*) + 1440 (JobsBindings.cpp:1440)
4  UnityFramework                 0x4d6a8b8 ujob_execute_job(ujob_control_t*, ujob_lane_t*, ujob_job_t*, ujob_handle_t, unsigned int) + 972 (ujobs.cpp:972)
5  UnityFramework                 0x4d6ab74 lane_guts(ujob_control_t*, ujob_lane_t*, int, int) + 1146 (ujobs.cpp:1146)
6  UnityFramework                 0x4d6b62c worker_thread_routine(void*) + 1157 (ujobs.cpp:1157)
7  UnityFramework                 0x4e3a0c8 Thread::RunThreadWrapper(void*) + 112 (Thread.cpp:112)
8  libsystem_pthread.dylib        0x3338 _pthread_start + 116
9  libsystem_pthread.dylib        0x1938 thread_start + 8
gilzoide commented 2 weeks ago

Hey @TonSharp, thanks for reporting this in a brand new issue. Say, can you reproduce it yourself? Does it happen always or only some times? Any more information other than this stack trace and iOS versions?

TonSharp commented 2 weeks ago

Unfortunately I don't have an iOS device handy and can't reproduce this crash right now. I will ask the testers in my team to look at the build on a 7 iPhone and I will write you back soon

TonSharp commented 1 week ago

@gilzoide Hello again! I have been researching app crashes on iPhone 7 with my team for some time. I can say that they happen periodically. One of the steps that leads to a 100% crash is to start playing the lottie animation right after launch. If you wait about 5-7 seconds after startup, then everything as far as I can see works stably

gilzoide commented 1 week ago

One of the steps that leads to a 100% crash is to start playing the lottie animation right after launch.

Hmm, weird huh. But 100% reproductivity is good, makes it easier to debug. Maybe there's some race condition in the code 🤔 I can see in ImageLottiePlayer some places that should definitely complete the _renderJobHandle just to make sure nothing is running concurrently.

Maybe there's some issue on low memory as well, if your app loads too much stuff right away and only releases afterwards in these 5~7s, I don't know. Did you see if you are receiving low memory messages in these devices?

By the way, are using the ImageLottiePlayer component or running animations manually?

TonSharp commented 1 week ago

I don't receive the low memory message. I am using ImageLottiePlayerwith Auto Play turned off, and at the right time through the code I call the Unpause() method