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

RN event loop stuck when using realm with an expo development build #6770

Closed
jayshah123 opened this issue Jun 28, 2024 · 9 comments
Closed

Comments

@jayshah123
Copy link

How frequently does the bug occur?

Always

Description

I use an expo development build with realm "@realm/react": "0.6.2", and "realm": "12.6.2"
along with RN version: "react-native": "0.72.7"
When ever I tried to load the JS bundle via expo development client, the bundle is stuck at "Downloading 100%".

On diving deeper, the following code in ReactRealm.mm seems to be stuck in a infinite loop causing JS event loop/thread to block indefinitely:

          while (s_currentJSThread && !s_currentJSThread.finished) {
            [NSThread sleepForTimeInterval:0.1];
          }

Is there a known workaround or fix for this issue?

Stacktrace & log output

No response

Can you reproduce the bug?

Always

Reproduction Steps

  1. Create an expo app repo with developmentClient: true for expo development build.
  2. Add realm with following versions: "@realm/react": "0.6.2", and "realm": "12.6.2"
    along with RN version: "react-native": "0.72.7"
  3. Try to load a JS bundle via development client.
  4. Bundle is stuck at "Downloading 100%"

Version

0.6.2

What services are you using?

Local Database only

Are you using encryption?

No

Platform OS and version(s)

iOS 17

Build environment

System:
OS: macOS 14.5
CPU: (10) arm64 Apple M1 Max
Memory: 103.30 MB / 32.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 18.13.0
path: ~/.nvm/versions/node/v18.13.0/bin/node
Yarn:
version: 1.18.0
path: ~/.nvm/versions/node/v18.13.0/bin/yarn
npm:
version: 8.19.3
path: ~/.nvm/versions/node/v18.13.0/bin/npm
Watchman:
version: 2024.01.22.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.14.3
path: /Users/jshah/.rbenv/shims/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 23.2
- iOS 17.2
- macOS 14.2
- tvOS 17.2
- visionOS 1.0
- watchOS 10.2
Android SDK: Not Found
IDEs:
Android Studio: 2022.3 AI-223.8836.35.2231.10811636
Xcode:
version: 15.2/15C500b
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.11
path: /usr/bin/javac
Ruby:
version: 3.3.0
path: /Users/jshah/.rbenv/shims/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.72.7
wanted: 0.72.7
react-native-macos: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: true
newArchEnabled: false

Cocoapods version

1.14.3

Copy link

sync-by-unito bot commented Jun 28, 2024

➤ PM Bot commented:

Jira ticket: RJS-2853

@kraenhansen
Copy link
Member

kraenhansen commented Jun 28, 2024

Realm JS v12.11.0 deleted the code you're referring to and might very well resolve this issue as well 🤞 Please update to the latest version of our SDK and report back 👍

@kraenhansen kraenhansen self-assigned this Jun 28, 2024
@kraenhansen kraenhansen added the Waiting-For-Reporter Waiting for more information from the reporter before we can proceed label Jun 28, 2024
@jayshah123
Copy link
Author

Thanks, will check and re-open if issue persists.

@github-actions github-actions bot added Needs-Attention Reporter has responded. Review comment. and removed Waiting-For-Reporter Waiting for more information from the reporter before we can proceed labels Jun 28, 2024
@elle-j
Copy link
Member

elle-j commented Jun 28, 2024

May also be due to an older expo-dev-client/expo-dev-launcher used where you may be experiencing this issue that should be fixed.

@jayshah123
Copy link
Author

jayshah123 commented Jul 2, 2024

For expo, I will have to do a full RN upgrade from 72 to 73 or 74 probably.
On the realm side I can go for "realm": "12.6.2" -> "12.11.0" as mentioned earlier.
What about "@realm/react" version?
How are they related? Is there any compatibility table needed between @realm/react and realm packages?

@elle-j
Copy link
Member

elle-j commented Jul 2, 2024

Currently, for using realm v12 you need @realm/react v0.5.0 or later, but we recommend using the latest @realm/react 👍

@jayshah123
Copy link
Author

Upgrading realm did not help, had to patch expo-dev-client/launcher.

@kraenhansen
Copy link
Member

kraenhansen commented Jul 3, 2024

had to patch expo-dev-client/launcher.

How? What did you have to do? Could you open another issue here or on the expo repo, with a description of what you're seeing and instructions on how to reproduce this?

@jayshah123
Copy link
Author

jayshah123 commented Jul 3, 2024

Technically the fix is in this PR - https://github.com/expo/expo/blob/main/packages/expo-dev-launcher/CHANGELOG.md#362---2024-01-10 which is available in 3.x and 4.x versions of expo-dev-launcher/client.

But I cannot upgrade to RN73 + Expo50 at the moment (which is the requirement to use 3.x versions of expo-dev-launcher/expo-dev-client). I've asked them to see if they can do patch releases on 2.x versions of expo-dev-client which is what I use with RN 72.

But for now, I have picked the fix present in expo/expo@54108e2 by using patch-package https://www.npmjs.com/package/patch-package which creates a local patch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants