Azure / azure-cli

Azure Command-Line Interface
MIT License
3.97k stars 2.95k forks source link

Add short timeout to version check HTTP requests #24577

Open invidian opened 1 year ago

invidian commented 1 year ago

Related command az vmss reimage --debug --help

Is your feature request related to a problem? Please describe.

In case of low transfer speed to raw.githubusercontent.com, commands with --help argument hangs for a long time. This seem largely suspicious and unhelpful when dealing with --help commands.

Describe the solution you'd like IIUC this HTTP requests are related to checking version of CLI. If that's the case, I think those requests should have some fixed deadline/timeout which when hit, may produce a warning message. Taking general slowness of Azure CLI, perhaps timeout of 500-1000 ms should not be that bad, comparing to my which was 80 seconds.

Additional context


$ az vmss reimage --debug --help
...
To search AI knowledge base for examples, use: az find "az vmss reimage"

urllib3.connectionpool: Starting new HTTPS connection (1): azure.microsoft.com:443
urllib3.connectionpool: https://azure.microsoft.com:443 "HEAD / HTTP/1.1" 301 0
cli.azure.cli.core.util: Connectivity check: 1.255078981999759 sec
urllib3.connectionpool: Starting new HTTPS connection (1): raw.githubusercontent.com:443
urllib3.connectionpool: https://raw.githubusercontent.com:443 "GET /Azure/azure-cli/main/src/azure-cli-core/setup.py HTTP/1.1" 200 1246
urllib3.connectionpool: Starting new HTTPS connection (1): raw.githubusercontent.com:443
urllib3.connectionpool: https://raw.githubusercontent.com:443 "GET /Azure/azure-cli/main/src/azure-cli-telemetry/setup.py HTTP/1.1" 200 679
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7f9a4f64aa70>]
az_command_data_logger: exit code: 0
cli.__main__: Command ran in 82.614 seconds (init: 0.256, invoke: 82.358)
0 ✓ (1m23s) 15:37:57 invidian@dellxps15mateusz ~/repos/kinvolk/aksiknife-copy (⎇  master)$ az version
Azure-cli    Azure-cli-core    Azure-cli-telemetry
-----------  ----------------  ---------------------
2.42.0       2.42.0            1.0.8
yonzhan commented 1 year ago

@zhoxing-ms for awareness

zhoxing-ms commented 1 year ago

The best solution may be to make the REST service to support the timeout parameter first: if the request times out, the service will directly return the error message of timeout, so I transferred it to the service team.

ghost commented 1 year ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Drewm3, @avirishuv, @vaibhav-agar, @amjads1.

Issue Details
**Related command** `az vmss reimage --debug --help` **Is your feature request related to a problem? Please describe.** In case of low transfer speed to `raw.githubusercontent.com`, commands with `--help` argument hangs for a long time. This seem largely suspicious and unhelpful when dealing with `--help` commands. **Describe the solution you'd like** IIUC this HTTP requests are related to checking version of CLI. If that's the case, I think those requests should have some fixed deadline/timeout which when hit, may produce a warning message. Taking general slowness of Azure CLI, perhaps timeout of 500-1000 ms should not be that bad, comparing to my which was 80 seconds. **Additional context** ``` $ az vmss reimage --debug --help ... To search AI knowledge base for examples, use: az find "az vmss reimage" urllib3.connectionpool: Starting new HTTPS connection (1): azure.microsoft.com:443 urllib3.connectionpool: https://azure.microsoft.com:443 "HEAD / HTTP/1.1" 301 0 cli.azure.cli.core.util: Connectivity check: 1.255078981999759 sec urllib3.connectionpool: Starting new HTTPS connection (1): raw.githubusercontent.com:443 urllib3.connectionpool: https://raw.githubusercontent.com:443 "GET /Azure/azure-cli/main/src/azure-cli-core/setup.py HTTP/1.1" 200 1246 urllib3.connectionpool: Starting new HTTPS connection (1): raw.githubusercontent.com:443 urllib3.connectionpool: https://raw.githubusercontent.com:443 "GET /Azure/azure-cli/main/src/azure-cli-telemetry/setup.py HTTP/1.1" 200 679 cli.knack.cli: Event: Cli.PostExecute [] az_command_data_logger: exit code: 0 cli.__main__: Command ran in 82.614 seconds (init: 0.256, invoke: 82.358) 0 ✓ (1m23s) 15:37:57 invidian@dellxps15mateusz ~/repos/kinvolk/aksiknife-copy (⎇ master)$ az version Azure-cli Azure-cli-core Azure-cli-telemetry ----------- ---------------- --------------------- 2.42.0 2.42.0 1.0.8
Author: invidian
Assignees: zhoxing-ms
Labels: `Compute`, `Service Attention`, `customer-reported`, `feature-request`, `Auto-Assign`, `Azure CLI Team`
Milestone: Backlog
sandeepraichura commented 1 year ago

Thank you @invidian for reporting the issue, We are currently looking into the issue.

fitzgeraldsteele commented 1 year ago

@yonzhan , @zhoxing-ms Passing back to you. VMSS REST API doesn't have calls/dependencies to github. This ticket is referring to calls to github, looks like to get CLI setup scripts:

urllib3.connectionpool: https://raw.githubusercontent.com:443 "GET /Azure/azure-cli/main/src/azure-cli-core/setup.py HTTP/1.1" 200 1246
urllib3.connectionpool: Starting new HTTPS connection (1): raw.githubusercontent.com:443
urllib3.connectionpool: https://raw.githubusercontent.com:443 "GET /Azure/azure-cli/main/src/azure-cli-telemetry/setup.py HTTP/1.1" 200 679
jaylabell commented 1 year ago

@zhoxing-ms Does this item still need compute service attention?

Drewm3 commented 1 year ago

CLI Team, the help for the CLI is not part of a VM compute API. So service attention for compute is not appropriate for this issue.

zhoxing-ms commented 1 year ago

Does this item still need compute service attention? CLI Team, the help for the CLI is not part of a VM compute API. So service attention for compute is not appropriate for this issue.

Yes, thank you for helping clarify

Drewm3 commented 1 year ago

@zhoxing-ms, could you please clarify what is needed from the VM service for this issue? The text for the issue seems to imply that this is something that should be handled 100% by the CLI application without any change to the Azure service API.

zhoxing-ms commented 1 year ago

@Drewm3 Yes, it seems that this is a performance issue in accessing raw.githubusercontent.com, so Compute service team is not needed to do anything

jaylabell commented 1 year ago

Thank you for updating @zhoxing-ms