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
SDK 51 Critical dev client bug - dev client with jsEngine: "hermes" loads android app bundle twice in development #17355
Comments
I think this is something we are already aware of - can you clarify what issues you are running into specifically? |
@ajsmth It causes issues with native modules that don't expect to be called twice from the same running app. I think it may also be causing some dev mode app crashes with reanimated. |
That was just added to prevent some JSI race conditions crashes. For me, android isn't running anymore, I had to patch-package the reloads completely out of it. #17282 (comment) Is there really no other way to fix hermes picking up the correct bundle without forced reloads? This feels so dirty. All of this happens cause the dev menu is an own bundle, right? (which would otherwise be picked up by devtools and flipper) |
OK I can confirm that the bug is due to #17282 which forces the app to try to reload while it's already loading. Perhaps #17282 should be reverted until another solution can be found? Double loading the bundle to try to trick hermes/flipper into picking it up doesn't seem like a great solution. I think maybe a patch to hermes debugger or flipper to allow specifying which bundle it should target could possibly work better? I don't know enough about how those systems work to tell for sure though. edit: actually it looks like the double load was introduced all the way back in #13041 Until then here is a patch to disable the double-load bug that can be used with
|
@evelant Thanks for the patch! We're figuring out how to address the issues being caused by reloading, but confirmation whether you see any difference in behavior between expo-dev-client@0.9.3 and 0.9.4 would be helpful. |
# Why Fixes #17355. Remove reload workaround for the Hermes debugger. > Note: if a user needs to inspect the right js bundle in flipper or devtools, they could reload manually.
# Why Fixes #17355. Remove reload workaround for the Hermes debugger. > Note: if a user needs to inspect the right js bundle in flipper or devtools, they could reload manually.
@tcdavis @lukmccall This may still be an issue on 0.10.6 of dev-menu. Not sure where it's coming from but pressing
I also see strange behavior in my app after reloads, things only work consistently upon on a complete force close and reopen of the android development app. Not sure where this is coming from yet but it seems there are deeper issues here with dev-client and hermes on SDK 45. |
Another clue is that "production mode" does nothing, toggling production bundling on/off in the devtools has no effect. The CLI says it's now bundling in production mode but I get a dev bundle anyway. |
A reload with |
Hmm perhaps removing the double load actually uncovered this bug where app code doesn't get updated until 2 refreshes have happened? |
@lukmccall Could this be reopened? It seems like it's still happening. Sometimes the android emulator just won't reload when pressing r in the terminal. Sometimes metro spits out one more |
@ajsmth @tcdavis @lukmccall if anybody could please reopen this issue it would be appreciated. This is not fixed so I think it would be good to reopen so as to not lose context. This is probably related to other issues such a crashes on reloads, debugger not connecting, and sampling profiler picking up the dev menu instead of the app. |
Updating to expo@51.0.7 and friends resolved the iOS DevMenu issue 🙌 |
Summary
On SDK45 beta if you use dev client and hermes then in development mode the app bundle gets loaded and run twice on the device.
This causes all sorts of havoc with development, breaking some native modules, some parts of logging, dev tooling, causing undefined behaviors, etc as well as potentially harming performance.
Managed or bare workflow? If you have
ios/
orandroid/
directories in your project, the answer is bare!managed
What platform(s) does this occur on?
Android
SDK Version (managed workflow only)
"expo": "~45.0.0-beta.4",
Environment
Reproducible demo
https://github.com/evelant/expo_45_android_double_load
Expo SDK 45 with dev client and
jsEngine: "hermes"
loads the app bundle twice at startup in Android development mode. This causes all sorts of problems in anything beyond trivial apps.To reproduce:
following these steps there will be output like
The app bundle is built twice and run twice on the device.
The text was updated successfully, but these errors were encountered: