Repository navigation
test: retry transient WSL2 import failures in Windows smoke setup - #338047
Merged
Dmitriy Vasyura (dmitrivMS) merged 2 commits intoSep 25, 2026
Merged
Conversation
On hosted Windows agents, `wsl --import --version 2` intermittently fails with exit code -1 right after the WSL2 kernel is installed, e.g. "The virtual machine or container with the specified identifier is not running." or 0x80041001, while the Hyper-V worker log shows the utility VM starting and being shut down by the guest seconds later. Keep collecting the existing diagnostics for every failed attempt, then unregister any partial distro, shut WSL down, and retry the import up to three times before failing the job. Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The bounded retry safely preserves existing success and final-failure behavior while addressing the documented transient failures.
Review effort: Balanced
Findings: None
What changed in this PR
Adds bounded retries for transient WSL2 import failures during Windows smoke-test setup.
Changes:
- Retries failed imports up to three times with backoff.
- Preserves per-attempt diagnostics and resets WSL between attempts.
| File | Description |
|---|---|
test/smoke/wslDevContainer.ps1 |
Adds WSL import retry, diagnostics, reset, and backoff logic. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot <[email protected]>
Dmitriy Vasyura (dmitrivMS)
marked this pull request as ready for review
September 25, 2026 20:51
Dmitriy Vasyura (dmitrivMS)
enabled auto-merge (squash)
September 25, 2026 20:51
Joaquín Ruales (jruales)
approved these changes
Sep 25, 2026
Dmitriy Vasyura (dmitrivMS)
deleted the
agents/fix-smoke-wsl-import-retry
branch
September 25, 2026 21:26
Alexandru Dima (alexdima)
added a commit
that referenced
this pull request
Oct 18, 2026
The Windows Server 2022 agents only have the inbox WSL (wsl.exe 10.0.20348). With the 2021 standalone WSL2 kernel (5.10.16), its utility VM intermittently hangs on import, shuts down right after boot, or crashes processes such as apt-get and containerd. Earlier fixes (#337229, #337644, #338047) worked around single symptoms. - Install the WSL release pinned in build/checksums/wsl.txt (3.0.3) from build/azure-pipelines/common/wsl.psm1, verifying its SHA256 and Microsoft signature, and log the host CPU and WSL versions. - Cache the installer by that pin: actions/cache, filled on main by pr-node-modules.yml, and Cache@2 in the product build. This replaces the daily kernel installer cache. - Run every wsl.exe call with a timeout, so a hung import is retried on a fresh utility VM and diagnostics and cleanup can't hang. - Retry downloads on all errors. Co-authored-by: Copilot <[email protected]>
Alexandru Dima (alexdima)
added a commit
that referenced
this pull request
Oct 18, 2026
#342344) * ci: tolerate WSL Dev Container provisioning failures in PR smoke tests The Windows PR smoke step that provisions WSL flaked 16 times between Oct 10 and 17. Every flake happened inside the runner's WSL2 VM, never in a download: either wsl --import hung until the step timed out (9), or apt-get/containerd crashed right after the first boot (7). A re-run on a new VM passes. Provisioning only sets up test infrastructure, so in PR CI a failure no longer fails the job. The WSL suite skips itself at runtime, so the shard split doesn't change. Lower the setup timeout from 15 to 10 minutes, since a healthy setup takes under 2. The Azure DevOps product build still requires the suite. Co-authored-by: Copilot <[email protected]> * ci: install current WSL on Windows smoke agents and bound wsl.exe calls The Windows Server 2022 agents only have the inbox WSL (wsl.exe 10.0.20348). With the 2021 standalone WSL2 kernel (5.10.16), its utility VM intermittently hangs on import, shuts down right after boot, or crashes processes such as apt-get and containerd. Earlier fixes (#337229, #337644, #338047) worked around single symptoms. - Install the WSL release pinned in build/checksums/wsl.txt (3.0.3) from build/azure-pipelines/common/wsl.psm1, verifying its SHA256 and Microsoft signature, and log the host CPU and WSL versions. - Cache the installer by that pin: actions/cache, filled on main by pr-node-modules.yml, and Cache@2 in the product build. This replaces the daily kernel installer cache. - Run every wsl.exe call with a timeout, so a hung import is retried on a fresh utility VM and diagnostics and cleanup can't hang. - Retry downloads on all errors. Co-authored-by: Copilot <[email protected]> * TEMPORARY: probe WSL setup on 20 Windows agents (remove before merge) Co-authored-by: Copilot <[email protected]> * TEMPORARY: diagnose the wsl-desktop sanity launch failure (remove before merge) Co-authored-by: Copilot <[email protected]> * Remove the temporary WSL probe workflow 100 of 100 probe VMs provisioned WSL successfully in 92-124 seconds. Co-authored-by: Copilot <[email protected]> * build: update the WSL step expectations in the test checkpoint template test The kernel cache day and kernel installer cache steps were replaced by a single version-keyed WSL installer cache. Co-authored-by: Copilot <[email protected]> * ci: fail the Windows smoke job again when WSL provisioning fails Skipping the WSL Dev Container suite after a failed setup hid real regressions in the setup or the WSL path behind a green job. It was a stopgap while setup flaked on the inbox WSL; with current WSL installed, a failed setup should fail the PR. Restore the 15-minute step timeout so the bounded import retries have room. Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Problem
Windows / Electron-Smokefails before any smoke test runs, in Prepare WSL Dev Container smoke tests (run 36120855518, job 108025747515):Root cause
This is a transient failure of the inbox WSL on the hosted Windows Server 2022 image (
wsl.exe 10.0.20348, kernel 5.10.16). It is not caused by a code change. The diagnostics added in #337242/#337438 show the sequence:Microsoft-Windows-Hyper-V-Worker-Adminlogs the WSL utility VM asstarted successfullyat 09:59:56 andconnected to virtual networkat 09:59:59.'Virtual Machine' was shut down by the guest operating system.wsl --importthen returns-1with the HCS error above.So the machine is set up correctly; the first utility-VM boot just died. The PR that surfaced this (#337895) only touches chat code.
Frequency
These counts come from the last 400 runs of
pr.yml(about 15 hours; 222 Windows Electron-Smoke jobs that completed as success or failure). 9 of those jobs failed in the WSL setup step:wsl --importexit -1,The virtual machine or container ... is not running.wsl --importexit -1,0x80041001curl: (18)partial download of the pinned serverThis PR targets the first two rows: the import fails fast with -1, which accounts for about 1.8% of Windows smoke jobs. The same class of failure was earlier reported with
The interface is unknown(#337242).Fix
wsl --importup to 3 times.import-<distro>-attempt-<n>.log, so the logs artifact shows whether a retry on the same host helps.wsl --unregisterany partial distro, runwsl --shutdownso the next attempt boots a fresh utility VM, recreate the empty install directory, and back off 10s then 20s.wsl --shutdownstops every distro on the host. That is safe here because CI agents are dedicated to the job and the distro is created by this script. The script is shared by GitHub Actions and Azure Pipelines, so both get the retry. The step normally takes about 80s and has a 15-minute timeout, so there is room for the retries.Not addressed here, since they are different failure modes:
curl: (18)partial downloads: curl's--retrydoes not retry exit code 18 unless--retry-all-errorsis passed.Validation
wsl.cmdthat fails the import N times. With 0 failures it imports on attempt 1. With 2 failures it retries twice (unregister, shutdown, 10s then 20s backoff) and succeeds on attempt 3. With 3 failures it throws after 3 attempts. Each failed attempt writes its own diagnostics log.