forcedotcom / cli

Salesforce CLI
https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/
BSD 3-Clause "New" or "Revised" License
494 stars 78 forks source link

Every command takes 10+ seconds (including help) #2552

Closed habl closed 1 year ago

habl commented 1 year ago

I just installed the latest version of sf cli and every command I run takes at least 10 seconds. For example:

$ time sf help
** snip**

real    0m11.270s
user    0m1.649s
sys     0m0.251s

Also when entering a menu there is a timeout of 10000 ms, which almost assumes there is a wait for 10 sec on every command or something?

$ sf data
? Which of these commands do you mean 
  data get record            Retrieve and display a single record of a Salesforce or Tooling API object. 
  data import tree           Import data from one or more JSON files into an org. 
  data query                 Execute a SOQL query. 
❯ data query resume          View the status of a bulk query. 
  data resume                View the status of a bulk data load job or batch. 
  data update record         Updates a single record of a Salesforce or Tooling API object. 
  data upsert bulk           Bulk upsert records to an org from a CSV file. Uses Bulk API 2.0. 
(Move up and down to reveal more choices)
    Error: Timed out after 10000 ms.

Steps To Reproduce

Run any command.

Expected result

Getting my cli back immediately after command is finished.

Actual result

Getting my cli back after 10+ secs.

System Information

$ neofetch
       _,met$$$$$gg.          hans@inw-nb-0205 
    ,g$$$$$$$$$$$$$$$P.       ---------------- 
  ,g$$P"     """Y$$.".        OS: Debian GNU/Linux 12 (bookworm) x86_64 
 ,$$P'              `$$$.     Host: HP ProBook 635 Aero G7 Notebook PC 
',$$P       ,ggs.     `$$b:   Kernel: 6.1.0-13-amd64 
`d$$'     ,$P"'   .    $$$    Uptime: 3 hours, 44 mins 
 $$P      d$'     ,    $$P    Packages: 2506 (dpkg) 
 $$:      $$.   -    ,d$$'    Shell: bash 5.2.15 
 $$;      Y$b._   _,d$P'      Resolution: 1920x1080 
 Y$$.    `.`"Y$$$$P"'         DE: Plasma 5.27.5 
 `$$b      "-.__              WM: kwin 
  `Y$$                        Theme: [Plasma], Breeze [GTK2/3] 
   `Y$$.                      Icons: [Plasma], breeze-dark [GTK2/3] 
     `$$b.                    Terminal: yakuake 
       `Y$$b.                 CPU: AMD Ryzen 7 PRO 4750U with Radeon Graphics (16) @ 1.700GHz 
          `"Y$b._             GPU: AMD ATI 03:00.0 Renoir 
              `"""            Memory: 16094MiB / 31417MiB 
{
  "architecture": "linux-x64",
  "cliVersion": "@salesforce/cli/2.15.9",
  "nodeVersion": "node-v18.13.0",
  "osVersion": "Linux 6.1.0-13-amd64",
  "rootPath": "/usr/local/lib/node_modules/@salesforce/cli",
  "shell": "bash",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 2.3.10 (core)",
    "@oclif/plugin-commands 3.0.4 (core)",
    "@oclif/plugin-help 6.0.4 (core)",
    "@oclif/plugin-not-found 3.0.2 (core)",
    "@oclif/plugin-plugins 3.9.4 (core)",
    "@oclif/plugin-search 1.0.4 (core)",
    "@oclif/plugin-update 4.1.3 (core)",
    "@oclif/plugin-version 2.0.3 (core)",
    "@oclif/plugin-warn-if-update-available 3.0.2 (core)",
    "@oclif/plugin-which 3.0.6 (core)",
    "@salesforce/cli 2.15.9 (core)",
    "apex 2.3.20 (core)",
    "auth 2.8.25 (core)",
    "data 2.6.1 (core)",
    "deploy-retrieve 1.19.2 (core)",
    "functions 1.22.9 (user)",
    "info 2.6.51 (core)",
    "limits 2.3.41 (core)",
    "login 1.2.39 (core)",
    "marketplace 0.3.1 (core)",
    "org 2.11.5 (core)",
    "schema 2.3.31 (core)",
    "settings 1.4.36 (core)",
    "sobject 0.2.14 (core)",
    "source 2.10.45 (core)",
    "telemetry 2.3.8 (core)",
    "templates 55.5.17 (core)",
    "trust 2.6.22 (core)",
    "user 2.3.39 (core)"
  ]
}

Additional information

github-actions[bot] commented 1 year ago

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

habl commented 1 year ago

Interestingly I had to go back all the way to version 2.4.4 to get a fast version. Starting from 2.4.5 every command has a delay of at least 10 sec, sometimes a multiple of that. Hopefully that rings a bell for some dev? :)

Edit: Only the sf help command became faster in 2.4.4, but soql queries are still slow. To make sf data query faster I had to go back to 2.4.2.

shetzel commented 1 year ago

I would suspect the node version first. Try with the latest LTS version (20.9.0) of node (for an npm install) or use the CLI tarballs, which include the LTS version of node.

You can run commands with debug output (append --dev-debug) and that will include high precision timings of command load and run time. Look for oclif-perf debug topics.

Also when entering a menu there is a timeout of 10000 ms, which almost assumes there is a wait for 10 sec on every command or something?

It means that interactive commands need a timeout value or they could run forever (or until ctrl+c). In the case of partial command matching there is a timeout of 10s defined.

habl commented 1 year ago

Indeed, updating node solved it, thanks!