Skip to content

TurboModule which uses JSI crashes with this memory address 0x1 #13925

Open
@jihoobyeon

Description

@jihoobyeon

Problem Description

I'm trying to port BabylonReactNative to TurboModules,
but when I made codegen and run the app, it crashes with memory address of this(at facebook::jsi::Object) is 0x1 - absolutely abnormal address value.

I've also questioned it at Babylon.js forum, but there is no abnormal address value in BabylonNative part, so I guess JSI of RNW seems to be problematic, thus asking here.

This is the call stack:

BabylonModule.dll!facebook::jsi::Runtime::getPointerValue(const facebook::jsi::Pointer & pointer) line 81
BabylonModule.dll!winrt::Microsoft::ReactNative::JsiAbiRuntime::AsJsiObjectRef(const facebook::jsi::Object & obj) line 817
BabylonModule.dll!winrt::Microsoft::ReactNative::JsiAbiRuntime::getProperty(const facebook::jsi::Object & obj, const facebook::jsi::String & name) line 515
BabylonModule.dll!facebook::jsi::Object::getProperty(facebook::jsi::Runtime & runtime, const facebook::jsi::String & name) line 94
BabylonModule.dll!facebook::jsi::Object::getProperty(facebook::jsi::Runtime & runtime, const char * name) line 90
BabylonModule.dll!facebook::jsi::Object::getPropertyAsObject(facebook::jsi::Runtime & runtime, const char * name) line 174
BabylonModule.dll!facebook::jsi::Object::getPropertyAsFunction(facebook::jsi::Runtime & runtime, const char * name) line 188
BabylonModule.dll!napi_env__::napi_env__(facebook::jsi::Runtime & rt) line 51
BabylonModule.dll!Napi::Attach(facebook::jsi::Runtime & rt) line 7
BabylonModule.dll!BabylonNative::ReactNativeModule::ReactNativeModule(facebook::jsi::Runtime & jsiRuntime, std::function<void __cdecl(std::function<void __cdecl(void)>)> jsDispatcher) line 42

Steps To Reproduce

  1. Make a new arch RNW app.
  2. Add modules described below and run yarn react-native autolink-windows.
  3. Change App.tsx as below and run the app.
import { JSX, useEffect, useState } from 'react';
import { View } from 'react-native';
import { Camera, Scene } from '@babylonjs/core';
import { EngineView, useEngine } from '@babylonjs/react-native';

export default function App(): JSX.Element {
  const engine = useEngine();
  const [camera, setCamera] = useState<Camera>(null);

  useEffect(() => {
    if (engine) {
      const scene = new Scene(engine);
      scene.createDefaultCamera(true);
      setCamera(scene.activeCamera!);
    }
  }, [engine]);

  return (
    <View style={{ flex: 1 }}>
      <EngineView style={{ flex: 1 }} camera={ camera } />
    </View>
  );
}

Expected Results

Just run without error.

CLI version

14.1.0

Environment

System:
  OS: Windows 10 10.0.19045
  CPU: "(4) x64 AMD Ryzen 3 2200U with Radeon Vega Mobile Gfx  "
  Memory: 25.14 GB / 31.63 GB
Binaries:
  Node:
    version: 20.10.0
    path: C:\Program Files\nodejs\node.EXE
  Yarn:
    version: 3.6.4
    path: ~\AppData\Roaming\npm\yarn.CMD
  npm:
    version: 10.8.2
    path: C:\Program Files\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK: Not Found
  Windows SDK:
    AllowDevelopmentWithoutDevLicense: Enabled
    AllowAllTrustedApps: Enabled
    Versions:
      - 10.0.18362.0
      - 10.0.19041.0
      - 10.0.22000.0
      - 10.0.22621.0
IDEs:
  Android Studio: Not Found
  Visual Studio:
    - 17.11.35312.102 (Visual Studio Community 2022)
Languages:
  Java: 21.0.3
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.75.4
    wanted: 0.75.4
  react-native-windows:
    installed: 0.75.4
    wanted: ^0.75.4
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Community Modules

"@babylonjs/core": "^7.28.0",
"@babylonjs/react-native": "https://github.com/jihoobyeon/BRN-windows.git",
"@babylonjs/react-native-windows-module": "https://github.com/jihoobyeon/BRN-windows-module.git",
"@babylonjs/react-native-windows-view": "https://github.com/jihoobyeon/BRN-windows-view.git"

Target Platform Version

10.0.22621

Target Device(s)

Desktop

Visual Studio Version

Visual Studio 2022

Build Configuration

Debug

Snack, code example, screenshot, or link to a repository

No response

Metadata

Metadata

Assignees

Labels

Area: JSIArea: Turbo ModulesNew ArchitectureBroad category for issues that apply to the RN "new" architecture of Turbo Modules + FabricWorkstream: Module SupportModule developers have the requisite tooling and clear path for adding windows support to modules.bug

Type

Projects

Status

No status

Relationships

None yet

Development

No branches or pull requests

Issue actions