Android app crashing with Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR)

I’m implementing BabylonJS on react-native android app. And I got stuck at when I made a small update to my gltf file:
My GLTF file is about 22MB of size now. It was 13MB before, and the moment I tried to load that I started getting this error:

F libc    : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x4e6e6f6c79626152 in tid 14793 (mqt_js), pid 14724

I also see this if I try to run the same app on an android device:

E  channel 'f45c53 com.myapp.name/com.myapp.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
2024-07-24 23:14:08.105  1492-2897  WindowManager           system_server                        E  win=Window{f45c53 u0 com.myapp.name/com.myapp.MainActivity EXITING} destroySurfaces: appStopped=false win.mWindowRemovalAllowed=true win.mRemoveOnExit=true

I tried a project from scratch and loaded the same gltf in it and it seems to work fine, but it only crashes in that app. I didn’t change anything other than the URL of the GLTF file.

It crashes whenever I land on the screen where I have BabylonJS, otherwise the app works fine.

That will be tricky to debug. can it be a memory limitation? Can you try on a device with more memory?

@Deltakosh
I thought so too, but then I loaded a simple 3MB gltf file it also crashes. I then tried creating a new tsx file and as I added:

    useEffect(() => {
        if (engine) {
            renderGLTF();
        }
    }, [engine]);

Where the renderGLTF is:

 const renderGLTF = () => {
        SceneLoader.LoadAsync(mainCharGltfURL, undefined, engine)
            .then(loadedScene => {
                if (loadedScene) {
                    setScene(loadedScene);

As soon as this was added it started to crash again.

The only thing that I am thinking to try next is to read the gltf file locally. I have installed @dr.pogodin/react-native-fs so that I can load the GLTF file locally which is in src/assets folder. I haven’t worked with RNFS before, can you tell me how to load a GLTF file using RNFS? I have found links but for some reason I am not able to figure out what is react-native/Libraries/Image/resolveAssetSource and where to import/install it from.

UPDATE: If I comment out everything it still crashes. It only doesn’t crash if I comment const engine = useEngine(); in my code.

I won’t be able to help but let me summon @srzerbetto

I will try to create a repro.

@srzerbetto I’ve created a repro here BabylonReactNative Error Repro · GitHub you can see the tsx and the info.md for more info.

I have a public project babylonjspoc/App.tsx at main · thechaudharysab/babylonjspoc · GitHub in which if I enter that URL of the GLTF it’ll render. The only difference here would be that I have a release build for the project it’s crashing on and the babylonjspoc is just an example project I did while learning it.

@Deltakosh do you know how to load a GLTF file locally? I have react-native-fs package installed in my project.

1 Like

If you are able to use react-native-fs to load the glb file content into a ArrayBufferView view you give that to the SceneLoader.LoadAsync function call. ( SceneLoader | Babylon.js Documentation (babylonjs.com))