[machinelearningservices] Add retry logic to az ml ssh client websocket connection - #10259
Draft
lavakumarrepala wants to merge 1 commit into
Draft
[machinelearningservices] Add retry logic to az ml ssh client websocket connection#10259lavakumarrepala wants to merge 1 commit into
lavakumarrepala wants to merge 1 commit into
Conversation
The az ml job connect-ssh / connect-ssh-compute proxy (_ssh_connector.py) would immediately fail if the initial websocket handshake to the NBIP proxy/broker was refused or timed out, with no retry. SRE Agent investigation of SSH connection instability found this to be a remaining gap versus SSH clients such as VS Code Remote-SSH, which do retry the initial connection and see meaningfully better long-duration connection stats. Add _connect_with_retry(), an async context manager that retries the initial websocket connection with exponential backoff + jitter (configurable via AZUREML_SSH_CONNECT_MAX_RETRIES, AZUREML_SSH_CONNECT_RETRY_BASE_DELAY_SECONDS, AZUREML_SSH_CONNECT_RETRY_MAX_DELAY_SECONDS env vars) on transient failures (OSError, TimeoutError, websocket handshake/connection-closed errors), then re-raises once retries are exhausted. Once the tunnel is open and actively relaying SSH bytes we do not attempt a silent reconnect: this tunnel carries the raw SSH transport, so a new websocket connection cannot resume an in-flight SSH session. Recovering from mid-session drops requires server-side session continuity, tracked separately (NBIP rearchitecture work item).
|
Hi lavakumarrepala, |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
microsoft-github-policy-service
Bot
requested review from
ZelinWang (wangzelin007) and
Yong Zhang (yonzhan)
August 26, 2026 21:23
Member
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 PR Validation — ️✔️ All clear
Summary
�z ml job connect-ssh (and connect-ssh for compute instances) proxies SSH traffic over a websocket tunnel via _ssh_connector.py. Today, if the initial websocket handshake to the NBIP proxy/broker is refused or times out, the client fails immediately with no retry.
SRE Agent investigation of SSH connection instability (ADO work item https://msdata.visualstudio.com/Vienna/_workitems/edit/5533560/) identified this as a remaining client-side gap: backend forwarder/broker stability fixes already improved connection duration stats, but the az ml SSH client still lacks the retry behavior that SSH clients such as VS Code Remote-SSH have (which show meaningfully better long-duration connection stats as a result).
Change
Testing
Opening as draft for review/discussion before merge.