Azure / Azure/azure-cli

az command sometimes freeze

Open
#14,215 1 comment 0 reactions 1 assignee Claimed by @jiasli View on GitHub
Account act-identity-squad customer-reported feature-request
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

> ### `az feedback` auto-generates most of the information requested below, as of CLI version 2.0.62

**Describe the bug**

az command sometimes freeze forever because socket timeout is not set to adal.AuthenticationContext.
When that occurs, the process will have to be killed.

**To Reproduce**

It is difficult to let this occur naturally, as it appears to be a network problem.
So I prepared an https server that does not return HTTP layer responses and rewrote /etc/hosts.

```bash
# start dummy https server as 127.0.0.1
bash -c "echo \"127.0.0.1 login.microsoftonline.com\" >> /etc/hosts"
export AZURE_CLI_DISABLE_CONNECTION_VERIFICATION=1
az login --debug --verbose --service-principal -u xxx -p xxx --tenant xxx
```

After establishing a TCP session, the az command waits forever for a response.

**Expected behavior**

It should be a timeout error at the appropriate time.
Because the az command can be a time-consuming process, it is difficult to kill at the right time.

**Environment summary**
Simply install by rpm.

**Additional context**

I've confirmed that I can fix this by setting a timeout in this code.
Does the appropriate timeout time depend on the server?
https://github.com/Azure/azure-cli/blob/dev/src/azure-cli-core/azure/cli/core/_profile.py#L103

adal.AuthenticationContext(timeout=30 ...

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.