{AKS}: fix BlockingIOError by setting stdout to non-blocking#9473
{AKS}: fix BlockingIOError by setting stdout to non-blocking#9473yanzhudd merged 4 commits intoAzure:mainfrom
Conversation
️✔️Azure CLI Extensions Breaking Change Test
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
|
There was a problem hiding this comment.
Pull request overview
This PR fixes a BlockingIOError that occurs when writing to a full pipe buffer on macOS, and improves connection error handling for the AKS agent extension. The version is bumped from 1.0.0b13 to 1.0.0b14.
Key Changes:
- Implemented chunked writing for stdout with retry logic to handle BlockingIOError when pipe buffers are full
- Added helper functions for terminal mode management, error detection, and proper cleanup
- Enhanced signal handling and resource cleanup with a centralized cleanup function
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 14 comments.
| File | Description |
|---|---|
| src/aks-agent/setup.py | Version bump to 1.0.0b14 |
| src/aks-agent/HISTORY.rst | Added release notes for version 1.0.0b14 documenting the fixes |
| src/aks-agent/azext_aks_agent/agent/k8s/pod_exec.py | Major refactoring: added terminal mode helpers, centralized cleanup, chunked stdout writing with BlockingIOError handling, improved error detection, and Windows console UTF-8 configuration |
Comments suppressed due to low confidence (1)
src/aks-agent/azext_aks_agent/agent/k8s/pod_exec.py:453
- stderr handling uses sys.stderr.write() which can also encounter BlockingIOError on full pipe buffers, but it lacks the chunking and error handling that stdout has (lines 429-447). For consistency and to prevent similar blocking issues, stderr should use the same chunked writing approach with os.write().
# Handle stderr
if resp.peek_stderr():
stderr_data = resp.read_stderr()
sys.stderr.write(stderr_data)
sys.stderr.flush()
8469721 to
52983ab
Compare
52983ab to
3698da4
Compare
3698da4 to
d1ff865
Compare
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
[Release] Update index.json for extension [ aks-agent-1.0.0b14 ] : https://dev.azure.com/msazure/One/_build/results?buildId=147198073&view=results |
This checklist is used to make sure that common guidelines for a pull request are followed.
Related command
General Guidelines
azdev style <YOUR_EXT>locally? (pip install azdevrequired)python scripts/ci/test_index.py -qlocally? (pip install wheel==0.30.0required)For new extensions:
About Extension Publish
There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update
src/index.jsonautomatically.You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify
src/index.json.