Skip to content

profile-hermes throws an error when more than one device is connected #2267

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

Closed
TMisiukiewicz opened this issue Jan 18, 2024 · 1 comment
Closed

Comments

@TMisiukiewicz
Copy link
Collaborator

Environment

System:
  OS: macOS 14.0
  CPU: (8) arm64 Apple M1 Pro
  Memory: 1.60 GB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.9.0
    path: ~/.nvm/versions/node/v20.9.0/bin/node
  Yarn:
    version: 1.22.19
    path: /usr/local/bin/yarn
  npm:
    version: 10.1.0
    path: ~/.nvm/versions/node/v20.9.0/bin/npm
  Watchman:
    version: 2023.05.22.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods: Not Found
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: Hedgehog 2023.1.1 Patch 1 Hedgehog 2023.1.1 Patch 1
  Xcode:
    version: 15.2/15C500b
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.9
    path: /usr/bin/javac
  Ruby:
    version: 2.7.5
    path: /Users/tomaszmisiukiewicz/.rvm/rubies/ruby-2.7.5/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.4
    wanted: 0.72.4
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Description

When adb devices returns more than one device, and I want to download the trace from Hermes using profile-hermes command, the CLI throws an error adb: more than one device/emulator. I'd expect to see a prompt to select the device where to look for the trace or have an ability to pass the device id with a flag.

npx react-native profile-hermes --filename sampling-profiler-trace4256203941362989232.cpuprofile
warn Package react-native-flipper contains invalid configuration: "dependency.platforms.ios.project" is not allowed. Please verify it's properly linked using "react-native config" command and contact the package maintainers about this.
info Downloading a Hermes Sampling Profiler from your Android device...
info File to be pulled: sampling-profiler-trace4256203941362989232.cpuprofile
adb: more than one device/emulator
error Command failed: adb shell run-as com.expensify.chat cat cache/sampling-profiler-trace4256203941362989232.cpuprofile > /var/folders/y_/6mppwknd2kd12kbwdh7c9qv80000gn/T/sampling-profiler-trace4256203941362989232.cpuprofile
adb: more than one device/emulator
.
Error: Command failed: adb shell run-as com.expensify.chat cat cache/sampling-profiler-trace4256203941362989232.cpuprofile > /var/folders/y_/6mppwknd2kd12kbwdh7c9qv80000gn/T/sampling-profiler-trace4256203941362989232.cpuprofile
adb: more than one device/emulator

    at checkExecSyncError (node:child_process:890:11)
    at execSync (node:child_process:962:15)
    at execSyncWithLog (/Users/tomaszmisiukiewicz/Documents/projects/Expensify-App/node_modules/@react-native-community/cli-hermes/build/profileHermes/downloadProfile.js:73:40)
    at downloadProfile (/Users/tomaszmisiukiewicz/Documents/projects/Expensify-App/node_modules/@react-native-community/cli-hermes/build/profileHermes/downloadProfile.js:113:7)
    at Object.profileHermes [as func] (/Users/tomaszmisiukiewicz/Documents/projects/Expensify-App/node_modules/@react-native-community/cli-hermes/build/profileHermes/index.js:21:48)
    at Command.handleAction (/Users/tomaszmisiukiewicz/Documents/projects/Expensify-App/node_modules/@react-native-community/cli/build/index.js:111:23)
    at Command.listener [as _actionHandler] (/Users/tomaszmisiukiewicz/Documents/projects/Expensify-App/node_modules/@react-native-community/cli/node_modules/commander/lib/command.js:482:17)
    at /Users/tomaszmisiukiewicz/Documents/projects/Expensify-App/node_modules/@react-native-community/cli/node_modules/commander/lib/command.js:1283:65
    at Command._chainOrCall (/Users/tomaszmisiukiewicz/Documents/projects/Expensify-App/node_modules/@react-native-community/cli/node_modules/commander/lib/command.js:1177:12)
info Run CLI with --verbose flag for more details.

Reproducible Demo

  1. Run two Android emulators and verify adb devices displays both on the list
  2. Open any app on one of the simulators
  3. Open devtools and select "Enable sampling profiler"
  4. Open devtools again and select "Disable sampling profiler"
  5. Get the trace file name from alert
  6. Run npx react-native profile-hermes --filename <name_of_the_file.cpuprofile>
  7. It should throw an error with adb: more than one device/emulator
@TMisiukiewicz
Copy link
Collaborator Author

Closing since command was removed in #2316

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

1 participant