react-native icon indicating copy to clipboard operation
react-native copied to clipboard

[iOS] Seeing Hermes Inspecter Threads in release app

Open jayshah123 opened this issue 1 year ago • 15 comments

Description

We see Hermes Inspector threads to be present in release/production version of the app.

Ideally anything related to dev tooling should not be present in release/production version of the app.

React Native Version

0.70.7

Output of npx react-native info

System: OS: macOS 13.5.2 CPU: (10) arm64 Apple M1 Pro Memory: 315.55 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 18.13.0 - ~/.nvm/versions/node/v18.13.0/bin/node Yarn: 1.18.0 - /opt/homebrew/bin/yarn npm: 8.15.1 - ~/Documents/my-app/node_modules/.bin/npm Watchman: 2023.08.28.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.11.3 - /Users/jayshah/.rbenv/shims/pod SDKs: iOS SDK: Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1 Android SDK: Not Found IDEs: Android Studio: 2022.2 AI-222.4459.24.2221.10121639 Xcode: 14.2/14C18 - /usr/bin/xcodebuild Languages: Java: 17.0.7 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.1.0 => 18.1.0 react-native: 0.70.7 => 0.70.7 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Steps to reproduce

Just run a release version of the app.

Setup Sentry or any other error analytics tool.

See the threads present in the crash report.

We should not have "hermes inspector connection" and related threads.

Snack, screenshot, or link to a repository

Screenshot 2023-09-20 at 4 12 39 PM

jayshah123 avatar Sep 20 '23 10:09 jayshah123

:warning: Unsupported Version of React Native
:information_source: It looks like your issue or the example you provided uses an unsupported version of React Native.

Due to the number of issues we receive, we're currently only accepting new issues against one of the supported versions. Please upgrade to latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If you cannot upgrade, please open your issue on StackOverflow to get further community support.

github-actions[bot] avatar Sep 20 '23 10:09 github-actions[bot]

:warning: Missing Reproducible Example
:information_source: We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.

github-actions[bot] avatar Sep 20 '23 10:09 github-actions[bot]

Can you provide a stronger evidence that this is actually happening in any release version of React Native and is not just a misconfiguration on your end? Specifically, I can't set up Sentry to reproduce this

cortinico avatar Sep 22 '23 22:09 cortinico

It is a release version of the app. I will reproduce it in a sample react native app which is packaged for release to the stores(https://reactnative.dev/docs/publishing-to-app-store#3-build-app-for-release). Also will take a look at tooling to inspect/enumerate threads in the running app.

jayshah123 avatar Sep 28 '23 04:09 jayshah123

Unsubscribe

William Pope Jr

On Wed, Sep 20, 2023, 6:47 AM jay shah @.***> wrote:

Description

We see Hermes Inspector threads to be present in release/production version of the app.

Ideally anything related to dev tooling should not be present in release/production version of the app. React Native Version

0.68.2 Output of npx react-native info

System: OS: macOS 13.5.2 CPU: (10) arm64 Apple M1 Pro Memory: 315.55 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 18.13.0 - ~/.nvm/versions/node/v18.13.0/bin/node Yarn: 1.18.0 - /opt/homebrew/bin/yarn npm: 8.15.1 - ~/Documents/my-app/node_modules/.bin/npm Watchman: 2023.08.28.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.11.3 - /Users/jayshah/.rbenv/shims/pod SDKs: iOS SDK: Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1 Android SDK: Not Found IDEs: Android Studio: 2022.2 AI-222.4459.24.2221.10121639 Xcode: 14.2/14C18 - /usr/bin/xcodebuild Languages: Java: 17.0.7 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.2 => 17.0.2 react-native: 0.68.2 => 0.68.2 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found Steps to reproduce

Just run a release version of the app.

Setup Sentry or any other error analytics tool.

See the threads present in the crash report.

We should not have "hermes inspector connection" and related threads. Snack, screenshot, or link to a repository [image: Screenshot 2023-09-20 at 4 12 39 PM] https://user-images.githubusercontent.com/659202/269257017-0f0fe2c1-1f55-4de4-9c79-8ed297ab2045.png

— Reply to this email directly, view it on GitHub https://github.com/facebook/react-native/issues/39556, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALNSC3C4CQMX37LKVSIFA5TX3LCVNANCNFSM6AAAAAA47WOECY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

popejrh19 avatar Sep 28 '23 08:09 popejrh19

Same for RN 0.72.5

hermes-inspector, hermes-chrome-inspector-conn in production build

They appeared after updating from version RN 0.70.6

Cirych avatar Oct 11 '23 14:10 Cirych

Workaround for RN 0.72.5

export PRODUCTION=1
export NO_FLIPPER=1

Added before bundle exec pod install, for prod build environment, ios/.xcode.env file, Fastlane, everywhere...

Cirych avatar Oct 12 '23 09:10 Cirych

@cortinico should these flags mentioned be added in the docs after appropriate review of core team members? It would be a huge win for existing and new apps.

jayshah123 avatar Oct 13 '23 02:10 jayshah123

@cortinico should these flags mentioned be added in the docs after appropriate review of core team members? It would be a huge win for existing and new apps.

Nope we should not document this as it's a workaround. @cipolleschi can help further in triaging this problem, but normally you should not need to set those variables in your environment before the build.

cortinico avatar Oct 13 '23 15:10 cortinico

Actually, it is expected. To build your app for production in 0.72, you have to use those flags to build the app. That's not a workaround but the proper way to do it in 0.72 and lower. We had to introduce those flags as, before, Release builds will not build due to an issue with flipper missing some symbols in Release mode.

@jayshah123 It is a good idea to add a section of the docs for 0.72 and lower explaining this. Would you mind open a PR on the website? :D

cipolleschi avatar Oct 16 '23 12:10 cipolleschi

Actually, it is expected. To build your app for production in 0.72, you have to use those flags to build the app. That's not a workaround but the proper way to do it in 0.72 and lower. We had to introduce those flags as, before, Release builds will not build due to an issue with flipper missing some symbols in Release mode.

@jayshah123 It is a good idea to add a section of the docs for 0.72 and lower explaining this. Would you mind open a PR on the website? :D

What is the earliest version of RN where these flags need to be set during build? I think the flags are needed all the way till latest version.

jayshah123 avatar Oct 16 '23 12:10 jayshah123

So far we are maintaining 0.70 -> 0.73.rc. From 0.70 to 0.72: they need both flags. For 0.73, you'll only need export NO_FLIPPER=1, as we fixed the reason why we needed PRODUCTION=1. From 0.74 onward, you'll need no flag at all. 😄

cipolleschi avatar Oct 16 '23 12:10 cipolleschi

I have added both flags: but to no avail, I am on 0.70.13.

Could you point me to files, commits that start these threads so I can understand this better?

jayshah123 avatar Nov 15 '23 05:11 jayshah123

Everything goes back to this discussion of 1 year and a half ago: https://github.com/facebook/react-native/issues/33764

cipolleschi avatar Nov 17 '23 11:11 cipolleschi

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar May 16 '24 05:05 github-actions[bot]