Skip to content

{Core} Fix #33996: Intermittent _DeadlockError in AAZ long-running operation - #34201

Open
Ethan Yang (necusjz) wants to merge 1 commit into
Azure:devfrom
necusjz:fix-deadlock-py314
Open

Ethan Yang (necusjz) wants to merge 1 commit into
Azure:devfrom
necusjz:fix-deadlock-py314

Conversation

@necusjz

Copy link
Copy Markdown
Member

Related command

Description

Fix: #33996

Testing Guide

History Notes

[Component Name 1] BREAKING CHANGE: az command a: Make some customer-facing breaking change
[Component Name 2] az command b: Add some customer-facing feature


This checklist is used to make sure that common guidelines for a pull request are followed.

@yonzhan

Copy link
Copy Markdown
Collaborator

Core

@necusjz
Ethan Yang (necusjz) marked this pull request as ready for review October 9, 2026 06:47
Copilot AI balanced review requested due to automatic review settings October 9, 2026 06:47
@necusjz
Ethan Yang (necusjz) requested review from a team as code owners October 9, 2026 06:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The regression test does not currently verify that the import occurs before the polling thread starts.

1 open finding
What changed in this PR

Fixes intermittent AAZ polling deadlocks by eagerly importing requests before starting the polling thread.

Changes:

  • Preloads requests before worker-thread creation.
  • Adds regression coverage for import timing.
File Description
aaz/​_poller.py Moves lazy dependency loading onto the main thread.
tests/​test_aaz_poller.py Adds polling-thread import regression coverage.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +14 to +26
def test_requests_imported_before_polling_thread(self):
loaded = []

def polling_generator():
loaded.append("requests" in sys.modules)
yield from ()

with mock.patch.dict(sys.modules):
for name in [n for n in sys.modules if n == "requests" or n.startswith("requests.")]:
del sys.modules[name]
AAZLROPoller(polling_generator=polling_generator(), result_callback=None).wait()

self.assertEqual(loaded, [True])

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

act-platform-engineering-squad Auto-Assign Auto assign by bot Core CLI core infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

az network vnet create intermittently fails with Python 3.14 _ModuleLock deadlock while importing requests.structures

4 participants