rive-app / rive-android

A runtime for interactive animations on Android
https://rive.app
MIT License
332 stars 30 forks source link

Crashes in SDK 8.3.0 #306

Closed marcus-hobbs closed 6 months ago

marcus-hobbs commented 9 months ago

Description

In the past 2 weeks our app has reported nearly 700 crashes from unique users via Sentry in the Rive Android 8.3.0 SDK.

Provide a Repro

Top stack-traces:

rive::Shape::draw rive::Stroke::draw rive::Artboard::advance

etc. (see screengrab)

Expected behavior

As few crashes as possible

Screenshots

See attached screenshot of various stack-traces at the point of crash

Device & Versions (please complete the following information)

Multiple devices and OS's.

Additional context

Screenshot of Sentry

Screenshot 2023-09-27 at 3 22 35 PM
umberto-sonnino commented 9 months ago

Hi @marcus-hobbs, this isn't ideal. Could you share your riv file? If you could share it with us, together with a small repro that shows your setup (e.g. in a GitHub repo) we can get to the bottom of this. Also, stack traces and/or tombstones would also be a good to have.

marcus-hobbs commented 9 months ago

Thanks @umberto-sonnino . Will put together a minimal project to share with you, and will also share stack traces.

brianwernick commented 9 months ago

@umberto-sonnino I work with Marcus and he's asked me to put together a simple repro setup which can be found in this Gist. If you need a full project just let me know and I'll get a simple repository setup.

marcus-hobbs commented 9 months ago

@umberto-sonnino what's the best way to dm/email you the .riv animation file used by Brian's gist?

umberto-sonnino commented 9 months ago

@umberto-sonnino what's the best way to dm/email you the .riv animation file used by Brian's gist?

@brianwernick thanks for sending over the gist! @marcus-hobbs you can attach it here in GitHub. If you don't want to share the file publicly, you can send it to hello@rive.app

marcus-hobbs commented 8 months ago

@umberto-sonnino I emailed hello@rive.app with the .riv file, and stack traces. Thanks in advance for the support here!

marcus-hobbs commented 8 months ago

@umberto-sonnino Hi there...just following up. Any luck reproducing the crash?

umberto-sonnino commented 8 months ago

@umberto-sonnino Hi there...just following up. Any luck reproducing the crash?

Hi @marcus-hobbs, sorry about the delay, I had some family troubles last week and I was out. Thanks for sending everything over, we're checking out your repros!

umberto-sonnino commented 8 months ago

Hi @marcus-hobbs, I left a comment in your Gist above - I might be missing a couple of crucial details there, because I can't see the crash. Can you fill in all the gaps?

brianwernick commented 8 months ago

I've been digging into the crash reports this morning trying to associate crashes across our reporting systems (such as Crashlytics and Google Play) and unfortunately haven't been able to get much more information than has previously been provided, however I will consolidate my findings in this message just in case I'm overlooking something important.

Below is a sampling of the most common/recurring error we see, though the crash report doesn't contain much information. These are from the Sentry crashes in the image above.

0 base.apk 0x6ee64defc0 rive::Artboard::draw 1 base.apk 0x6ee64d5340 Java_app_rive_runtime_kotlin_core_Artboard_cppDrawSkiaAligned

We also have a similarly frequent error that seems to get a few levels deeper

0 base.apk 0x7b5c286770 rive::Stroke::draw 1 base.apk 0x7b5c27b27c rive::Shape::draw 2 base.apk 0x7b5c24ee44 rive::Artboard::draw 3 base.apk 0x7b5c247800 Java_app_rive_runtime_kotlin_core_Artboard_cppDrawSkiaAligned

The following is a sampling of what we see in the Google Play Consoles crash reporting, the top two lines are the same between all of the crashes I've reviewed while the 3rd line varies a bit on the trampoline line offset (e.g. +144, +196)

01 pc 0x000000000018ffc0 base.apk!librive-android.so (rive::Artboard::draw(rive::Renderer*, rive::Artboard::DrawOption)+320) (BuildId: 9346768ab612d634ccd6613195e9ff040ef82e58)

02 pc 0x0000000000186340 base.apk!librive-android.so (Java_app_rive_runtime_kotlin_core_Artboard_cppDrawSkiaAligned+248) (BuildId: 9346768ab612d634ccd6613195e9ff040ef82e58)

03 pc 0x000000000031a900 /arm64/base.odex (art_jni_trampoline+144)

04 pc 0x0000000000b29604 /arm64/base.odex (app.rive.runtime.kotlin.RiveArtboardRenderer.draw+228)

05 pc 0x0000000000457d6c /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub+556)

06 pc 0x00000000004ed728 /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeVirtualOrInterfaceWithVarArgs<art::ArtMethod>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject, art::ArtMethod*, std::__va_list)+856)

07 pc 0x00000000005ecfc8 /apex/com.android.art/lib64/libart.so (art::JNI::CallVoidMethodV(_JNIEnv, _jobject, _jmethodID*, std::__va_list)+184)

And finally a sample of the related crash reports from Crashlytics are

Fatal Exception: app.rive.runtime.kotlin.core.errors.RiveException: C++ object for app.rive.runtime.kotlin.core.Artboard@180384306 does not exist. See MEMORY_MANAGEMENT.md for more information. at app.rive.runtime.kotlin.core.NativeObject.getCppPointer(NativeObject.kt:38) at app.rive.runtime.kotlin.core.Artboard.advance(Artboard.kt:184) at app.rive.runtime.kotlin.controllers.RiveFileController.advance(RiveFileController.kt:232) at app.rive.runtime.kotlin.RiveArtboardRenderer.advance(RiveArtboardRenderer.kt:105)

and

Fatal Exception: app.rive.runtime.kotlin.core.errors.RiveException: C++ object for app.rive.runtime.kotlin.core.LinearAnimationInstance@67640712 does not exist. See MEMORY_MANAGEMENT.md for more information. at app.rive.runtime.kotlin.core.NativeObject.getCppPointer(NativeObject.kt:38) at app.rive.runtime.kotlin.core.LinearAnimationInstance.apply(LinearAnimationInstance.kt:49) at app.rive.runtime.kotlin.controllers.RiveFileController.advance(RiveFileController.kt:212) at app.rive.runtime.kotlin.RiveArtboardRenderer.advance(RiveArtboardRenderer.kt:105)

These crashes are all using the default (Skia) renderer in 8.3.0 and we will be trying the new rive renderer with the latest (8.6.2 at the time of writing this) sdk to see if that resolves the issue.

Additionally, I'm working on finding a more reproducible crash example in the demo app and will link that if I'm successful.

umberto-sonnino commented 8 months ago

Hi @marcus-hobbs and @brianwernick We released version 8.7.0 earlier this week addressing some concerns that might solve this issue. Unfortunately, without a repro, we can't say for sure whether this will solve it, but if you could try it out and let us know that'd be greatly appreciated!

brianwernick commented 8 months ago

We'll get that updated (or to 9.0.0 since that was released today) and check back in when we have data.

umberto-sonnino commented 8 months ago

We'll get that updated (or to 9.0.0 since that was released today) and check back in when we have data.

We've been trying to release 9.0.0 today but Maven/Sonatype OSSRH is currently down, so we haven't been able to publish that just yet. It'll be out as soon as it's back up again

umberto-sonnino commented 7 months ago

We'll get that updated (or to 9.0.0 since that was released today) and check back in when we have data.

We've been trying to release 9.0.0 today but Maven/Sonatype OSSRH is currently down, so we haven't been able to publish that just yet. It'll be out as soon as it's back up again

@brianwernick We were finally able to push our update to Maven and version 9.0.4 is up! It's a major bump because we removed some older deprecated APIs and we did a general cleanup pass. Another breaking change, state machine inputs will now be applied on the next frame as opposed to immediately

brianwernick commented 7 months ago

Awesome, thanks for the update!

umberto-sonnino commented 7 months ago

Hi @brianwernick @marcus-hobbs, we just released 9.0.5 with a few minor cleanups, although we're still unable to reproduce the crash from above. Has either 8.7.0 or 9.0.4 solved your issues?

brianwernick commented 7 months ago

Thanks for the update on versions.

Due to other priorities we haven't been able to test 9.0.4 (we skipped 8.7.0) yet to determine if it has had any impact on our crash rate. We should be able to perform some testing in the coming weeks and will provide any additional information we can. This is a much slower process than I think either of us would like due to the inability to consistently reproduce the crashes locally so we appreciate your attentiveness and patience

umberto-sonnino commented 6 months ago

Hi @brianwernick, just wanted to check in if this is still happening for you. Other customers that were seeing this issue intermittently have reported it's now been solved for them. Can you confirm that too?

brianwernick commented 6 months ago

@umberto-sonnino Thanks for checking in. We are just wrapping up an extended and phased test and we are seeing a drastic improvement in the crashes with 9.0.4 compared to the 8.x versions. As far as we are concerned this issue can be treated as resolved.

umberto-sonnino commented 6 months ago

@umberto-sonnino Thanks for checking in. We are just wrapping up an extended and phased test and we are seeing a drastic improvement in the crashes with 9.0.4 compared to the 8.x versions. As far as we are concerned this issue can be treated as resolved.

That's great news, thanks for confirming!