rive-android icon indicating copy to clipboard operation
rive-android copied to clipboard

Rive crashes the app randomly on lowend devices.

Open dawidpodolak opened this issue 11 months ago • 2 comments

We have noticed crashes reported in Google Play and Sentry that appear to be caused by Rive. Here is the stack trace. We weren’t able to reproduce these crashes in our debug build. We also observed that they mainly occur on low-end devices.

Rive version: 10.5.1 (we are about to release version with 10.5.3). It occurs for earlier versions too. Android version: from 7 to 16

FORTIFY: pthread_mutex_lock called on a destroyed mutex (0x<sanitized>)

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
pid: 0, tid: 12269 >>> com.zen.application <<<

backtrace:
  #00  pc 0x00000000000530f4  /apex/com.android.runtime/lib64/bionic/libc.so (abort+164)
  #01  pc 0x0000000000054f7c  /apex/com.android.runtime/lib64/bionic/libc.so (__fortify_fatal(char const*, ...)+124)
  #02  pc 0x00000000000c29dc  /apex/com.android.runtime/lib64/bionic/libc.so (HandleUsingDestroyedMutex(pthread_mutex_t*, char const*)+60)
  #03  pc 0x00000000000c2870  /apex/com.android.runtime/lib64/bionic/libc.so (pthread_mutex_lock+208)
  #04  pc 0x00000000017dd044  /vendor/lib64/egl/libGLES_mali.so
  #05  pc 0x00000000017dd51c  /vendor/lib64/egl/libGLES_mali.so
  #06  pc 0x00000000008987c8  /vendor/lib64/egl/libGLES_mali.so
  #07  pc 0x00000000008993fc  /vendor/lib64/egl/libGLES_mali.so
  #08  pc 0x00000000007d88bc  /vendor/lib64/egl/libGLES_mali.so
  #09  pc 0x00000000007f2540  /vendor/lib64/egl/libGLES_mali.so
  #10  pc 0x00000000007f2f84  /vendor/lib64/egl/libGLES_mali.so
  #11  pc 0x00000000007e4874  /vendor/lib64/egl/libGLES_mali.so
  #12  pc 0x0000000000792e28  /vendor/lib64/egl/libGLES_mali.so (glTexSubImage2D+88)
  #13  pc 0x000000000035329c  /data/app/~~NjEMQmaIW_4JInzlXZnFcA==/com.zen.application-X0uDAQreOJip39hS7AEtGg==/split_config.arm64_v8a.apk!librive-android.so (BuildId: d5c158c73dcd67af197045cfbf6b7f6220fd429f)
  #14  pc 0x0000000000350f18  /data/app/~~NjEMQmaIW_4JInzlXZnFcA==/com.zen.application-X0uDAQreOJip39hS7AEtGg==/split_config.arm64_v8a.apk!librive-android.so (rive::gpu::RenderContextGLImpl::flush(rive::gpu::FlushDescriptor const&)+140) (BuildId: d5c158c73dcd67af197045cfbf6b7f6220fd429f)
  #15  pc 0x000000000035d684  /data/app/~~NjEMQmaIW_4JInzlXZnFcA==/com.zen.application-X0uDAQreOJip39hS7AEtGg==/split_config.arm64_v8a.apk!librive-android.so (rive::gpu::RenderContext::flush(rive::gpu::RenderContext::FlushResources const&)+2752) (BuildId: d5c158c73dcd67af197045cfbf6b7f6220fd429f)
  #16  pc 0x00000000001b1c98  /data/app/~~NjEMQmaIW_4JInzlXZnFcA==/com.zen.application-X0uDAQreOJip39hS7AEtGg==/split_config.arm64_v8a.apk!librive-android.so (BuildId: d5c158c73dcd67af197045cfbf6b7f6220fd429f)
  #17  pc 0x0000000000213f10  /data/app/~~NjEMQmaIW_4JInzlXZnFcA==/com.zen.application-X0uDAQreOJip39hS7AEtGg==/split_config.arm64_v8a.apk!librive-android.so (rive::CommandServer::processCommands()+40692) (BuildId: d5c158c73dcd67af197045cfbf6b7f6220fd429f)
  #18  pc 0x0000000000209fa4  /data/app/~~NjEMQmaIW_4JInzlXZnFcA==/com.zen.application-X0uDAQreOJip39hS7AEtGg==/split_config.arm64_v8a.apk!librive-android.so (rive::CommandServer::serveUntilDisconnect()+56) (BuildId: d5c158c73dcd67af197045cfbf6b7f6220fd429f)
  #19  pc 0x00000000001b1760  /data/app/~~NjEMQmaIW_4JInzlXZnFcA==/com.zen.application-X0uDAQreOJip39hS7AEtGg==/split_config.arm64_v8a.apk!librive-android.so (BuildId: d5c158c73dcd67af197045cfbf6b7f6220fd429f)
  #20  pc 0x00000000000c163c  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+204)
  #21  pc 0x0000000000054930  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64)

dawidpodolak avatar Dec 04 '25 11:12 dawidpodolak

We're experiencing a similar crash that appears to have the same root cause - a race condition in CommandServer during cleanup.

Our Stack Trace

Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x10 in tid (Rive CmdServer)

#00 pc 00000000003422c0  librive-android.so
#01 pc 000000000033da64  librive-android.so  rive::gpu::RenderContextGLImpl::flush(rive::gpu::FlushDescriptor const&)+2972
#02 pc 0000000000348f30  librive-android.so  rive::gpu::RenderContext::flush(rive::gpu::RenderContext::FlushResources const&)+1776
#03 pc 00000000001a66a4  librive-android.so
#04 pc 0000000000205fa4  librive-android.so  rive::CommandServer::processCommands()+39368
#05 pc 00000000001fc564  librive-android.so  rive::CommandServer::serveUntilDisconnect()+56

Key Difference

  • Your crash: pthread_mutex_lock on destroyed mutex → FORTIFY abort (Mali GPU)
  • Our crash: SIGSEGV at address 0x10 → null pointer dereference (various GPUs)

Both crashes occur in the same code path: CommandServer::processCommands() → RenderContext::flush()

Environment

  • rive-android version: 10.4.4
  • OS distribution:
    • Android 16: 52%
    • Android 15: 34%
    • Android 14: 7%
  • Devices: Samsung Galaxy S24 Ultra, Pixel, Xiaomi, Infinix (80% high-end)
  • Device class: 80% high-end (opposite of your low-end pattern)

Reproduction

The crash occurs when users navigate away from a screen containing a Rive animation (using Compose RiveUI). It's rare and we cannot reproduce it in development - only captured via Sentry from production users.

Conclusion

This suggests the race condition affects both low-end (Mali) and high-end devices, just manifesting differently depending on GPU driver behavior. The underlying issue appears to be improper synchronization during resource cleanup in CommandServer.

We have exactly the same issue as @nikolai-krasilnikov-perplexity

Rive runtime version is 10.5.3, ComposeUI. So the issue exists in the latest version as well

OlehHavryshV avatar Dec 08 '25 13:12 OlehHavryshV

@ErikUggeldahl does anyone can take into look on this?

dawidpodolak avatar Jan 07 '26 07:01 dawidpodolak

Hello, thanks for the report. The team is aware of this and are actively working on resolving it. Thank you for your patience.

tylernij avatar Feb 13 '26 20:02 tylernij

Hello, just gathering additional info from those who are affected: does this occur with the latest version of the runtime? Checking to see if we've fixed this in a later version or not. Thanks!

tylernij avatar Mar 02 '26 20:03 tylernij

@tylernij We've updated Rive Android from 10.5.3 to 11.2.1.

We're now waiting for the release to roll out to production. I'll provide an update on the crash status in about a week once we have sufficient data from the release.

@tylernij It looks like the update did the trick! Everything is working perfectly now — we haven't seen a single crash in the new release. Thank you so much for the fix!

Excellent @nikolai-krasilnikov-perplexity! Thanks for the update!

tylernij avatar Mar 10 '26 17:03 tylernij