Skip to content

Error loading command modules 'containerapp' and 'cdn' due to msrest import deadlock under Python 3.14 (pipx install) #32980

@pillarsdotnet

Description

@pillarsdotnet

Describe the bug

When running any az command (e.g. az login), two errors are printed to stderr on startup:

Error loading command module 'containerapp': 'msrest'
Error loading command module 'cdn': deadlock detected by _ModuleLock('msrest.http_logger') at <address>

Despite these errors, the affected commands (az containerapp, az cdn) still appear to load successfully and are usable. The errors are non-fatal but appear on every invocation.

Environment

azure-cli version 2.84.0
Python version 3.14.3
Installation method pipx
OS macOS 15.7.4 (Sequoia), arm64

Steps to reproduce

  1. Install azure-cli via pipx on macOS arm64 with Python 3.14:
    pipx install azure-cli
    
  2. Run any az command:
    az login
    

Expected behavior

No errors printed to stderr on startup. Command modules load silently.

Actual behavior

Two errors appear every invocation (address will vary):

Error loading command module 'containerapp': 'msrest'
Error loading command module 'cdn': deadlock detected by _ModuleLock('msrest.http_logger') at 4711984592

Root cause analysis

This appears to be a recurrence of the Python import-lock race condition fixed in PR #26287 (which addressed requests.models deadlocks in Python 3.10.10). The same multi-threaded command module loading in azure.cli.core triggers a _ModuleLock deadlock on msrest.http_logger when running under Python 3.14, and a KeyError: 'msrest' in the containerapp module (likely due to msrest being only partially initialized in one thread when another accesses it).

msrest is present and importable in the venv — single-threaded imports of both modules succeed without error. The failures are specific to the concurrent loading path.

References

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions