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

React Native 0.74.1 and new architecture + bridgeless results in a soft crash SurfaceRegistryBinding::startSurface failed. Global was not installed. #2015

Closed
2 of 6 tasks
kraenhansen opened this issue May 3, 2024 · 9 comments · Fixed by #2026
Labels
bug Something isn't working platform: iOS This affects iOS

Comments

@kraenhansen
Copy link

kraenhansen commented May 3, 2024

What happened?

Simulator Screenshot

Version

3.7.0

What platforms are you seeing this issue on?

  • Android
  • iOS
  • macOS
  • visionOS
  • Windows

System Information

System:
  OS: macOS 14.4.1
  CPU: (14) arm64 Apple M3 Max
  Memory: 147.72 MB / 36.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.12.0
    path: ~/Library/Caches/fnm_multishells/75556_1714746688416/bin/node
  Yarn: Not Found
  npm:
    version: 10.5.0
    path: ~/Library/Caches/fnm_multishells/75556_1714746688416/bin/npm
  Watchman:
    version: 2024.04.29.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.4
      - iOS 17.4
      - macOS 14.4
      - tvOS 17.4
      - visionOS 1.1
      - watchOS 10.4
  Android SDK: Not Found
IDEs:
  Android Studio: 2023.2 AI-232.10300.40.2321.11567975
  Xcode:
    version: 15.3/15E204a
    path: /usr/bin/xcodebuild
Languages:
  Java: Not Found
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.74.1
    wanted: 0.74.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: false
  newArchEnabled: true
iOS:
  hermesEnabled: false
  newArchEnabled: true

Steps to Reproduce

  1. npx --package react-native-test-app@latest init --platform ios --platform android --name Sanity --destination sanity
  2. cd sanity
  3. npm install
  4. cd ios && RCT_NEW_ARCH_ENABLED=1 pod install && cd -
  5. In one terminal, start the dev server (npm start in sanity)
  6. npm run ios to build and start the app
  7. Observe "(NOBRIDGE) LOG Bridgeless mode is enabled" in the log of the Metro bundler and see soft crash (attached as screenshot).

Code of Conduct

  • I agree to follow this project's Code of Conduct
@kraenhansen kraenhansen added the bug Something isn't working label May 3, 2024
@kelset kelset added the platform: iOS This affects iOS label May 3, 2024
@kraenhansen kraenhansen changed the title React Native 0.74.1 and new architecture results in a soft crash SurfaceRegistryBinding::startSurface failed. Global was not installed. React Native 0.74.1 and new architecture + bridgeless results in a soft crash SurfaceRegistryBinding::startSurface failed. Global was not installed. May 3, 2024
@tido64
Copy link
Member

tido64 commented May 4, 2024

Hi @kraenhansen, I was not able to reproduce this:

image

I also stepped through the code and it looks like this is something that would happen if bundling failed:

image

On line 47, if RN$AppRegistry is not an object, it would to into the else block on line 56 and throw the exception you see there.

Did you create a bundle or start a dev server? I don't see it in your repro steps.

@kraenhansen
Copy link
Author

I start a dev server, will update the steps and run though them once again on Monday 👍

@kraenhansen
Copy link
Author

kraenhansen commented May 6, 2024

I just re-ran the steps from the top with a different app name and directory to prune any implicit build caches, but I'm still reproducing it. I see your screenshot is running Metro 0.80.4, mine is 0.80.9, what does your npm ls yield?

❯ npm ls
Sanity2@0.0.1 /Users/kraen.hansen/Repositories/sanity2
├── @babel/core@7.24.5
├── @babel/preset-env@7.24.5
├── @babel/runtime@7.24.5
├── @react-native/babel-preset@0.74.83
├── @react-native/eslint-config@0.74.83
├── @react-native/metro-config@0.74.83
├── @react-native/typescript-config@0.74.83
├── @rnx-kit/metro-config@1.3.15
├── @types/react-test-renderer@18.3.0
├── @types/react@18.3.1
├── babel-jest@29.7.0
├── eslint@8.57.0
├── jest@29.7.0
├── prettier@2.8.8
├── react-native-test-app@3.7.0
├── react-native@0.74.1
├── react-test-renderer@18.2.0
├── react@18.2.0
└── typescript@5.0.4

Also, what's your Xcode version? (I have no clue if that could influence this - but I'm on 15.3).

From your screenshot, it looks like you're testing with the example app of your repository instead of generating a new app via the steps I provided.

@kraenhansen
Copy link
Author

kraenhansen commented May 6, 2024

For reference, I tried but failed to reproduce it with the example app.

@tido64
Copy link
Member

tido64 commented May 6, 2024

You're right. It looks like there's a race condition. If you dismiss the red box, navigate back, then reopen the view, it will render just fine. It looks like a core bug to me, but I can take a closer look later. Maybe @cipolleschi has more ideas?

@tido64
Copy link
Member

tido64 commented May 6, 2024

Confirmed to be a bug in @rnx-kit/react-native-host. We will hopefully get this addressed within the day or so.

@kelset
Copy link
Member

kelset commented May 7, 2024

Hey Kraen sorry for the delay, had a bunch of issues with my local Xcode / Simulator setup and yesterday was bank holiday here in UK - I was able to repro thanks to your detailed steps:

broken

And also able to verify that the fix Tommy made in the PR microsoft/rnx-kit#3130 addresses this:

fixed

@tido64 tido64 linked a pull request May 7, 2024 that will close this issue
1 task
@tido64
Copy link
Member

tido64 commented May 7, 2024

This fix is now published. You can either manually bump @rnx-kit/react-native-host to 0.4.9, or wait for 3.7.2. It should be out within the hour.

@kraenhansen
Copy link
Author

Awesome! Thanks for the quick turnaround (again) 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working platform: iOS This affects iOS
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants