Description
Hey everyone, following up on a specific crash pattern with @reactvision/react-viro on Android. The app crashes with a Fatal signal 11 (SIGSEGV) specifically when the AR camera is active and the app is moved to the background for an extended period (approximately 5+ minutes). The crash will only happen when the 3dModel in ARScene is rendered from a url.
The Stack Trace
#00 pc 00000000004ef650 ... libviro_renderer.so (VROPlatformRunTask)
#01 pc 00000000003a5f60 ... libviro_renderer.so (VROPlatformRunTask(int)+428)
Environment
- Development OS: macOS
- Device OS & Version: Android 15 & 16
- Version: @reactvision/react-viro 2.52.1, React Native 0.81.5
- Device(s): Samsung and Pixel devices
Current (failing) Attempt
I am currently using AppState to conditionally hide/unmount ViroARSceneNavigator when the app goes inactive/background.
However, it seems that the native cleanup is not deep enough to survive a long background stay, and the renderer still attempts to access a stale GL context on resume.
Questions
- Is there a way to completely deallocate the Viro native bridge when the app hits the background, rather than simply unmounting the component?
- Has anyone successfully handled onPause/onResume at the native Android level to prevent the renderer from accessing a reclaimed OpenGL context?
- Is there a recommended lifecycle handling pattern for long background AR sessions?
Reproducible Demo
- Launch the app and navigate to a screen with ViroARSceneNavigator active.
- Keep the AR camera running.
- Move the app to the background.
- Wait approximately 5+ minutes.
- Resume the app.
- Observe crash with Fatal signal 11 (SIGSEGV) in libviro_renderer.so.
The issue is consistently reproducible under these conditions.
Here is the link for my repo as well: https://github.com/yahyafahim/Viro-AR
Description
Hey everyone, following up on a specific crash pattern with @reactvision/react-viro on Android. The app crashes with a Fatal signal 11 (SIGSEGV) specifically when the AR camera is active and the app is moved to the background for an extended period (approximately 5+ minutes). The crash will only happen when the 3dModel in ARScene is rendered from a url.
The Stack Trace
Environment
Current (failing) Attempt
I am currently using AppState to conditionally hide/unmount ViroARSceneNavigator when the app goes inactive/background.
However, it seems that the native cleanup is not deep enough to survive a long background stay, and the renderer still attempts to access a stale GL context on resume.
Questions
Reproducible Demo
The issue is consistently reproducible under these conditions.
Here is the link for my repo as well: https://github.com/yahyafahim/Viro-AR