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

PLSRenderContext Crash! #300

Open
y-daniel-1113 opened this issue Apr 6, 2024 · 11 comments
Open

PLSRenderContext Crash! #300

y-daniel-1113 opened this issue Apr 6, 2024 · 11 comments

Comments

@y-daniel-1113
Copy link

y-daniel-1113 commented Apr 6, 2024

A crash occurs when using Rive animation on the splash screen after starting the app.

Rive Version : 5.10.0

Renderer : Rive Renderer

  • case1

#0 (null) in __pthread_kill ()
#1 (null) in pthread_kill ()
#2 (null) in __abort ()
#3 (null) in abort ()
#4 (null) in abort_message ()
#5 (null) in demangling_terminate_handler() ()
#6 (null) in _objc_terminate() ()
#7 0x0000000104e4e9b4 in FIRCLSTerminateHandler() #8 (null) in std::__terminate(void ()()) ()
#9 (null) in __cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception
) ()
#10 (null) in __cxa_throw ()
#11 (null) in std::__1::__throw_system_error(int, char const*) ()
#12 (null) in std::__1::thread::join() ()
#13 (null) in rive::pls::BackgroundShaderCompiler::~BackgroundShaderCompiler() ()
#14 (null) in rive::pls::PLSRenderContextMetalImpl::~PLSRenderContextMetalImpl() ()
#15 (null) in make_pls_context_native(id)::PLSRenderContextNativeImpl::~PLSRenderContextNativeImpl() ()
#16 (null) in rive::pls::PLSRenderContext::~PLSRenderContext() ()
#17 (null) in rive::pls::PLSRenderContext::~PLSRenderContext() ()
#18 (null) in std::__1::unique_ptr<rive::pls::PLSRenderContext, std::__1::default_deleterive::pls::PLSRenderContext >::~unique_ptrabi:v160006 ()
#19 (null) in __cxa_finalize_ranges ()
#20 (null) in exit ()
#21 (null) in rive::pls::BackgroundShaderCompiler::threadMain() ()
#22 (null) in void* std::__1::__thread_proxy[abi:v160006]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_deletestd::__1::__thread_struct >, void (rive::pls::BackgroundShaderC... ()
#23 (null) in _pthread_start ()
#24 (null) in thread_start ()

-case2

#0 (null) in rive::pls::PLSRenderContext::beginFrame(rive::pls::PLSRenderContext::FrameDescriptor const&) ()
#1 (null) in -[RiveRendererContext beginFrame:] ()
#2 (null) in -[RiveRendererView drawRect:] ()
#3 (null) in -[MTKView draw] ()
#4 (null) in CA::Layer::layout_and_display_if_needed(CA::Transaction*) ()
#5 (null) in CA::Context::commit_transaction(CA::Transaction*, double, double*) ()
#6 (null) in CA::Transaction::commit() ()
#7 (null) in CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) ()
#8 (null) in CA::Display::DisplayLink::callback(_CADisplayTimer*, unsigned long long, unsigned long long, unsigned long long, bool, void*) ()
#9 (null) in display_timer_callback(__CFMachPort*, void*, long, void*) ()
#10 (null) in __CFMachPortPerform ()
#11 (null) in CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION ()
#12 (null) in __CFRunLoopDoSource1 ()
#13 (null) in __CFRunLoopRun ()
#14 (null) in CFRunLoopRunSpecific ()
#15 (null) in GSEventRunModal ()
#16 (null) in -[UIApplication _run] ()
#17 (null) in UIApplicationMain ()
#18 0x0000000104f490c4
#19 (null) in start ()

-case3

#0 (null) in rive::pls::PLSRenderContext::mapResourceBuffers(rive::pls::PLSRenderContext::ResourceAllocationCounts const&) ()
#1 (null) in rive::pls::PLSRenderContext::mapResourceBuffers(rive::pls::PLSRenderContext::ResourceAllocationCounts const&) ()
#2 (null) in rive::pls::PLSRenderContext::flush(rive::pls::PLSRenderContext::FlushResources const&) ()
#3 (null) in -[RiveRendererContext endFrame] ()
#4 (null) in -[RiveRendererView drawRect:] ()
#5 (null) in -[MTKView draw] ()
#6 (null) in CA::Layer::layout_and_display_if_needed(CA::Transaction*) ()
#7 (null) in CA::Context::commit_transaction(CA::Transaction*, double, double*) ()
#8 (null) in CA::Transaction::commit() ()
#9 (null) in CA::Transaction::flush_as_runloop_observer(bool) ()
#10 (null) in _UIApplicationFlushCATransaction ()
#11 (null) in _UIUpdateSequenceRun ()
#12 (null) in schedulerStepScheduledMainSection ()
#13 (null) in runloopSourceCallback ()
#14 (null) in CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION ()
#15 (null) in __CFRunLoopDoSource0 ()
#16 (null) in __CFRunLoopDoSources0 ()
#17 (null) in __CFRunLoopRun ()
#18 (null) in CFRunLoopRunSpecific ()
#19 (null) in GSEventRunModal ()
#20 (null) in -[UIApplication _run] ()
#21 (null) in UIApplicationMain ()
#22 0x00000001027590c4
#23 (null) in start ()

스크린샷 2024-04-06 오전 10 35 29
  • Firebase Crash Log
    Fatal Exception: std::__1::system_error
    thread::join failed: Resource deadlock avoided

Device & Versions (please complete the following information)

  • Device: iPhone 12, iPhone13 , iPhone13 ,iPhone13 Pro
  • iOS version : iOS 17.2 , 17.3 , 17.4

Additional context

Libraries added to the new version: Google Admob & Mediation

@HayesGordon
Copy link
Contributor

Hi @y-daniel-1113, can you share a reproducible sample with us so we can more quickly investigate this issue?

@y-daniel-1113
Copy link
Author

@HayesGordon
We can only check for this issue through Firebase Crashlytics.
I am using version 5.11.6, but this problem (BackgroundShaderCompiler) still occurs.

There have been over 8700 crashes in the last month and we are considering returning to Lottie.

@HayesGordon
Copy link
Contributor

Hi @y-daniel-1113, we'll take a look into this.

The crash seems to be related to the Rive renderer. While we work on a fix, a temporary solution is switching from the Rive renderer to one of the others. Skia is currently the default renderer if none is configured manually. In your code where you're specifying the renderer, you can choose skiaRenderer (or you can remove the code to override the default):

RenderContextManager.shared().defaultRenderer = RendererType.skiaRenderer

More information can be found here: https://rive.app/community/doc/overview/docD20dU9Rod#specifying-a-renderer

@csmartdalton
Copy link
Contributor

csmartdalton commented May 28, 2024

Hi @y-daniel-1113 , thank you for the crash logs. Based on what we see, I have high confidence that the root issue here has been fixed in version 5.12.0. Are you by chance using image meshes in any of your assets? And did this crash only start happening recently?

We are currently in the process of deploying device farm testing in order to make sure regressions like this don't happen in the future once we release the Rive renderer by default.

@y-daniel-1113
Copy link
Author

@csmartdalton We checked the logs for this issue from versions 5.10.0 to 5.11.6.
Because Rive Animation was used when starting the app in version 5.10.0, the exact starting point is unknown.
The designer said he used Shapes rather than images
After updating to version 5.12.0, we plan to check whether the issue is recorded in Firebase.

@y-daniel-1113
Copy link
Author

@csmartdalton

During testing, we again confirmed that the app crashed as soon as it was launched.
Rive 5.12.0

  Crashed: com.google.firebase.crashlytics.ios.exception

0 APP 0x25da9c FIRCLSProcessRecordAllThreads + 392 (FIRCLSProcess.c:392)
1 APP 0x25de7c FIRCLSProcessRecordAllThreads + 423 (FIRCLSProcess.c:423)
2 APP 0x26bee8 FIRCLSHandler + 34 (FIRCLSHandler.m:34)
3 APP 0x26bcec __FIRCLSExceptionRecord_block_invoke + 240 (FIRCLSException.mm:240)
4 libdispatch.dylib 0x3dd4 _dispatch_client_callout + 20
5 libdispatch.dylib 0x132c4 _dispatch_lane_barrier_sync_invoke_and_complete + 56
6 APP 0x26ac68 FIRCLSExceptionRecord + 242 (FIRCLSException.mm:242)
7 APP 0x26a934 FIRCLSTerminateHandler() + 413 (FIRCLSException.mm:413)
8 libc++abi.dylib 0x14090 std::__terminate(void ()()) + 16
9 libc++abi.dylib 0x172e4 __cxa_get_exception_ptr + 86
10 libc++abi.dylib 0x17228 __cxxabiv1::exception_cleanup_func(_Unwind_Reason_Code, _Unwind_Exception
) + 306
11 libc++.1.dylib 0x1f448 std::__1::__throw_system_error(int, char const*) + 100
12 libc++.1.dylib 0x1f4ec std::__1::thread::detach() + 70
13 RiveRuntime 0x477764 rive::pls::BackgroundShaderCompiler::~BackgroundShaderCompiler() + 60
14 RiveRuntime 0x48e01c rive::pls::PLSRenderContextMetalImpl::~PLSRenderContextMetalImpl() + 204
15 RiveRuntime 0xb748 make_pls_context_native(id)::PLSRenderContextNativeImpl::~PLSRenderContextNativeImpl() + 12
16 RiveRuntime 0x485e18 rive::pls::PLSRenderContext::~PLSRenderContext() + 776
17 RiveRuntime 0x4859a4 rive::pls::PLSRenderContext::~PLSRenderContext() + 12
18 RiveRuntime 0xa4b8 std::__1::unique_ptr<rive::pls::PLSRenderContext, std::__1::default_deleterive::pls::PLSRenderContext>::~unique_ptrabi:v15006 + 40
19 libsystem_c.dylib 0x18cfc __cxa_finalize_ranges + 476
20 libsystem_c.dylib 0x18acc exit + 32
21 RiveRuntime 0x478324 rive::pls::BackgroundShaderCompiler::threadMain() + 1800
22 RiveRuntime 0x478c14 void* std::__1::__thread_proxy[abi:v15006]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_deletestd::__1::__thread_struct>, void (rive::pls::BackgroundShaderCompiler::)(), rive::pls::BackgroundShaderCompiler>>(void*) + 72
23 libsystem_pthread.dylib 0x2a90 _pthread_start + 136
24 libsystem_pthread.dylib 0x1fcc thread_start + 8

@csmartdalton
Copy link
Contributor

Thanks for checking @y-daniel-1113 !

Are you able to provide a .riv file that reproduces the crash? Does Firebase tell you device information that the crash came from?

This is currently P0 and I'll keep you posted on our end as we go.

@y-daniel-1113
Copy link
Author

logo_splash.riv.zip
@csmartdalton These are Rive Animation files and Firebase screenshots.
temp

@csmartdalton
Copy link
Contributor

csmartdalton commented Jun 24, 2024

@y-daniel-1113 -- we have now finished deploying our device farm golden testing for iOS and I have verified that I am able to render logo_splash.riv on an iPhone 15 running iOS 17.5.1.

Could you please check Rive 5.14.1 and see if it works for you now? If it does not, would you be open to sharing a compilable code sample that reproduces the issue so we can track it down?

@y-daniel-1113
Copy link
Author

@csmartdalton We are going to update the app soon
We are going to change back from skia to rive renderer and will leave the results after using version 5.14.1

@dskuza
Copy link
Collaborator

dskuza commented Jul 25, 2024

@y-daniel-1113 Have you seen fewer crash reports with our latest releases?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants