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

[0.74.0] stress reloading leads to broken state on android bridgeless #44241

Open
Kudo opened this issue Apr 24, 2024 · 2 comments
Open

[0.74.0] stress reloading leads to broken state on android bridgeless #44241

Kudo opened this issue Apr 24, 2024 · 2 comments
Labels
Contributor A React Native contributor. Needs: Triage 🔍 p: Expo Partner: Expo Partner Platform: Android Android applications. Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)

Comments

@Kudo
Copy link
Contributor

Kudo commented Apr 24, 2024

Description

On bridgeless mode, we have some sort of race condition from reloading.

so we will see two BUNDLE ./index.js from the cli terminal for each reload.

However, in some stress reload, the app will be in broken state. reloading is then broken and the app has an empty screen.
not sure if that is coming from the second reload introduced in #42917. i think there is some race condition inside.

Steps to reproduce

  1. git clone https://github.com/Kudo/repro-RN074-android-reload
  2. cd repro-RN074-android-reload
  3. yarn android
  4. keep pressing "r" in terminal cli then the app will have the problem.

React Native Version

0.74.0

Affected Platforms

Runtime - Android, Build - MacOS

Areas

Bridgeless - The New Initialization Flow

Output of npx react-native info

info Fetching system and libraries information...
System:
  OS: macOS 14.4.1
  CPU: (8) arm64 Apple M1 Pro
  Memory: 99.13 MB / 32.00 GB
  Shell:
    version: 3.7.1
    path: /opt/homebrew/bin/fish
Binaries:
  Node:
    version: 20.12.2
    path: ~/.volta/tools/image/node/20.12.2/bin/node
  Yarn:
    version: 1.22.22
    path: ~/.volta/tools/image/yarn/1.22.22/bin/yarn
  npm:
    version: 10.5.0
    path: ~/.volta/tools/image/node/20.12.2/bin/npm
  Watchman:
    version: 2024.04.08.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /Users/kudo/.rbenv/shims/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:
    API Levels:
      - "29"
      - "30"
      - "31"
      - "33"
      - "34"
    Build Tools:
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 33.0.0
      - 33.0.1
      - 34.0.0
    System Images:
      - android-31 | Google Play ARM 64 v8a
      - android-33 | Google APIs ARM 64 v8a
      - android-33 | Google Play ARM 64 v8a
      - android-34 | Google Play ARM 64 v8a
    Android NDK: 23.1.7779620
IDEs:
  Android Studio: 2023.2 AI-232.10300.40.2321.11668458
  Xcode:
    version: 15.3/15E204a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.9
    path: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/javac
  Ruby:
    version: 2.7.4
    path: /Users/kudo/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.74.0
    wanted: 0.74.0
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: false


### Stacktrace or Logs

```text
okhttp.OkHttpClient  W  A connection to http://10.0.2.2:8081/ was leaked. Did you forget to close a response body? To see where this was allocated, set the OkHttpClient logger level to FINE: Logger.getLogger(OkHttpClient.class.getName()).setLevel(Level.FINE);
                         W  A connection to http://10.0.2.2:8081/ was leaked. Did you forget to close a response body? To see where this was allocated, set the OkHttpClient logger level to FINE: Logger.getLogger(OkHttpClient.class.getName()).setLevel(Level.FINE);
                         W  A connection to http://10.0.2.2:8081/ was leaked. Did you forget to close a response body? To see where this was allocated, set the OkHttpClient logger level to FINE: Logger.getLogger(OkHttpClient.class.getName()).setLevel(Level.FINE);
                         W  A connection to http://10.0.2.2:8081/ was leaked. Did you forget to close a response body? To see where this was allocated, set the OkHttpClient logger level to FINE: Logger.getLogger(OkHttpClient.class.getName()).setLevel(Level.FINE);

Reproducer

https://github.com/Kudo/repro-RN074-android-reload

Screenshots and Videos

repro-android-reload.mp4
@Kudo Kudo added Needs: Triage 🔍 Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules) labels Apr 24, 2024
@facebook-github-bot facebook-github-bot added the Contributor A React Native contributor. label Apr 24, 2024
@github-actions github-actions bot added the Platform: Android Android applications. label Apr 24, 2024
@Iuriy-Budnikov
Copy link

Ios has the same issue

brentvatne pushed a commit to expo/expo that referenced this issue May 4, 2024
# Why

Closes ENG-12058

Similar to the issue reported by @Kudo on core
(facebook/react-native#44241), triggering two
immediate reloads when running an app using the new arch in bridgeless
mode will cause the app to crash on iOS as well.

# How

Instead of registering the "r" hotkey for the DevMenu `reloadAction` we
can just rely on the default react-native reload action (which also uses
the "r" hotkey)

# Test Plan

Test dev-client through BareExpo and FabricTester

# Checklist

<!--
Please check the appropriate items below if they apply to your diff.
This is required for changes to Expo modules.
-->

- [ ] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
@javache
Copy link
Member

javache commented May 13, 2024

I believe #44554 will fix this for Android

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Contributor A React Native contributor. Needs: Triage 🔍 p: Expo Partner: Expo Partner Platform: Android Android applications. Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)
Projects
None yet
Development

No branches or pull requests

4 participants