IOS app crashes on rendering rive - EXC_BAD_ACCESS
Description
<-- A clear and concise description of what the problem is. --> We are rendering a rive file in our app that makes it crash c. 3% of the time. We only have the bug on IOS. We are on an expo managed project. Here is more info on the crash, captured through Sentry:
EXC_BAD_ACCESS contents > KERN_INVALID_ADDRESS at 0x18.
rive::gpu::RenderContextMetalImpl::makeRenderPassForDraws
Stack trace: -[RiveRendererView drawRect:] -[RiveRendererView drawInRect:withCompletion:] -[RiveRendererContext endFrame:withCompletion:] -rive::gpu::RenderContext::flush rive::gpu::RenderContextMetalImpl::flush rive::gpu::RenderContextMetalImpl::makeRenderPassForDraws
Source .riv/.rev file
https://unlearn-test.s3.eu-west-3.amazonaws.com/app-assets/rive-animations/rive_home_screen.riv
Hi @anatoleblanc can you provide additional information on the devices you're seeing the crash on?
Have you been able to reproduce this locally?
Can you also specify which version of the Rive React Native package you're using?
Hi @anatoleblanc can you provide additional information on the devices you're seeing the crash on?
Have you been able to reproduce this locally?
Can you also specify which version of the Rive React Native package you're using?
Hello, we use "rive-react-native": "^8.4.0".
Here is the package-lock info.
"node_modules/rive-react-native": {
"version": "8.4.0",
"resolved": "https://registry.npmjs.org/rive-react-native/-/rive-react-native-8.4.0.tgz",
"integrity": "sha512-4PIxRU/Zf1NJ9pkDR/Pk8YIkh4VJjQ4HyvGtJt8XXg0B23CYF3GnblfJlcwvajo965FjK7+jndqN4tTWlQEtJQ==",
"engines": {
"node": ">=16"
},
"peerDependencies": {
"react": "*",
"react-native": "*"
}
},
The device distribution seems to be all iphones.
We are unable to reproduce locally.
The crash happens on app startup, this rive is rendered on the initial screen.
This issue might relate to this one https://github.com/rive-app/rive-ios/issues/350.
I am also able to see few similar crashes on some iOS devices only. Here is the stacktrace
EXC_BREAKPOINT (crashed)
KERN_INVALID_ADDRESS
RiveRuntime 0x1030dbb80 keypath_setTm + 31372
RiveRuntime 0x1030dba18 keypath_setTm + 31012
RiveRuntime 0x1030db2b0 keypath_setTm + 29116
cars24CustomerApp 0x101478428 void absl::lts_20240116::internal_any_invocable::LocalManagerNontrivial<grpc_core::XdsClient::XdsChannel::RetryableCall<grpc_core::XdsClient::XdsChannel::LrsCall>::StartRetryTimerLocked()::'lambda'()>(absl::lts_20240116::internal_any_invocable::FunctionToCall, absl::lts_20240116::internal_any_invocable::TypeErasedState*, absl::lts_20240116::internal_any_invocable::TypeErasedState*) + 1905644
cars24CustomerApp 0x10147aa8c void absl::lts_20240116::internal_any_invocable::LocalManagerNontrivial<grpc_core::XdsClient::XdsChannel::RetryableCall<grpc_core::XdsClient::XdsChannel::LrsCall>::StartRetryTimerLocked()::'lambda'()>(absl::lts_20240116::internal_any_invocable::FunctionToCall, absl::lts_20240116::internal_any_invocable::TypeErasedState*, absl::lts_20240116::internal_any_invocable::TypeErasedState*) + 1915472
cars24CustomerApp 0x1001b1a44 0x1001a0000 + 72260
libdispatch.dylib 0x2244 _dispatch_call_block_and_release + 28
libdispatch.dylib 0x3fa4 _dispatch_client_callout + 16
libdispatch.dylib 0x12a30 _dispatch_main_queue_drain + 980
libdispatch.dylib 0x12648 _dispatch_main_queue_callback_4CF + 40
CoreFoundation 0x79bc8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
CoreFoundation 0x761bc __CFRunLoopRun + 1992
CoreFoundation 0xc8280 CFRunLoopRunSpecific + 584
GraphicsServices 0x14bc GSEventRunModal + 160
UIKitCore 0x3ee670 -[UIApplication _run] + 812
UIKitCore 0x14e84 UIApplicationMain + 336
cars24CustomerApp 0x1001afd00 0x1001a0000 + 64768
0x1c5045de8 0x0 + 7600365032
Using "rive-react-native": "8.4.0"
Hi all, we definitely recommend updating to the latest, 9.2.1, to see if that resolves the issue for you.
If it's still occurring in the latest and if there are any additional information you can share around the crash that will be helpful.
I am getting similar issues with crashes on iOS only with rive 8.4.0
RCTFatalException: non-std C++ exception
non-std C++ exception
I am going to try to update to 9+ but last time I checked I had weird artefacts on android
Same issue com.facebook.react.runtime.JavaScript (11): EXC_BAD_ACCESS (code=1, address=0x17) 402: runtime_->unstable_initializeOnJsThread();
Similar Issue EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x2940c6.
Currently fetching the Rive asset from an S3 bucket, it's possible that in our case it's a race condition for users with poor connection and Rive doesn't handle a malformed or missing asset gracefully.
Expo 52 rive-react-native 9.3.4