Skip to content

test: resume and parallelize the WSL smoke host package downloads - #347436

Merged
Bryan Chen (bryanchen-d) merged 1 commit into
mainfrom
copilot/vscode/wsl-deb-download-resume
Nov 11, 2026
Merged

Bryan Chen (bryanchen-d) merged 1 commit into
mainfrom
copilot/vscode/wsl-deb-download-resume

Conversation

@bryanchen-d

@bryanchen-d Bryan Chen (bryanchen-d) commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

The Windows x64 smoke step Prepare WSL Dev Container smoke tests timed out in three product builds today while the Azure Ubuntu mirror was degraded (494568, which passed on a job retry, 494570 and 494706). It gates every Windows x64 artifact of an official build.

Mechanism

wslDevContainer.ps1 downloads the apt packages on the host before apt installs them in the distribution (#345873). While the mirror is degraded it serves some package files at under 100 KB/s, or stalls on them, while its index files stay fast. The host loop then:

  1. tried each package one after another, so the stalls added up;
  2. gave each package two fresh attempts at 1 MB/s for 15 s, each starting from byte 0, so a slow connection lost everything it had fetched;
  3. used archive.ubuntu.com as the third attempt, which answers 403 to the build agents in every failing log;
  4. stopped after 4 minutes and left what it didn't get to apt, which has no minimum speed and keeps a slow connection until the step's 15-minute timeout.

In 494706 the host got 32 packages, but containerd (28 MB) and docker.io (36 MB) failed all three attempts. apt in the distribution then fetched containerd at about 86 KB/s (5.5 min), and docker.io was still downloading when the step timed out.

Change

Save-DebPackages replaces the inline loop:

  • Packages download in parallel (6 at a time), so stalls overlap.
  • A transfer that stays below 256 KB/s for 20 s is stopped and continued from where it stopped (--continue-at -) on a fresh connection, so reconnecting costs no bytes.
  • Retries back off (1–16 s) only after an attempt that got no bytes.
  • The Azure mirror is the only source, since archive.ubuntu.com is a dead fallback on the agents.
  • A file with the wrong hash is downloaded again once, then left to apt.
  • The host has until 10 minutes after the script started, which leaves at least 5 minutes of the Azure DevOps step's 15-minute timeout for installing. A passing run needs about 1.5 minutes after the downloads.

Relation to #347367

#347367 caches the prepared distribution in the Azure Pipelines Windows x64 smoke job, so this download now runs only on a cache miss. On a miss it runs in -Operation Prepare (20-minute step), and again in Setup if Prepare fails. Misses happen on the first jobs of each UTC day before the first save, on every branch whose script differs, and after any change to this script. This change makes both attempts resumable and parallel, and its 10-minute host deadline fits inside the Prepare step.

Validation

A local harness serves 25 packages from a server that replays the failure modes in the logs: a 6 MB file at about 150 KB/s on every connection, a first connection cut halfway, a first-request 502, a first connection that stalls, and a first response with corrupt bytes. It loads Save-DebPackages from the script itself.

Loop Result
Before (main) 24/25. The slow 6 MB file restarts from byte 0 three times and is left to apt, the 494706 mechanism.
After 25/25 in 43 s. The truncated file resumes from 1 MiB, the stalled one from 1 KiB, the slow one from 3.0 MB and then 6.0 MB, the 502 succeeds on its retry and the corrupt file is downloaded again.
After, 25 s deadline Leaves the two unfinished packages to apt with their partial files removed, within the deadline.

On the real mirror, def 111 run 494890 (Windows x64 only) used a PROOF ONLY commit, since dropped, that cut every package's first fetch short after 3 s at 32 KB/s. On #347367's cache-miss path, 19 packages stopped partway and resumed, the host downloaded all 34 packages, and apt reported Need to get 0 B/85.9 MB. Prepare took 123 s, and Setup then imported the prepared distribution in 12 s.

Authored with Copilot

Copilot AI balanced review requested due to automatic review settings November 10, 2026 18:33

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.

🟢 Approval recommended

No active review issues are reported for the WSL package-download resilience changes.

No open issues 🎉

What changed in this PR

This PR makes host-side package downloads for WSL smoke-test provisioning more resilient to slow or stalled Ubuntu mirror connections, including when rebuilding a cached distribution.

Changes:

  • Extracts Save-DebPackages to download six packages concurrently, resume interrupted transfers, and back off when no progress is made.
  • Retains size and hash validation, removes the alternate-mirror fallback, and uses a deadline ten minutes after script startup before leaving unfinished packages to apt.
  • Includes temporary proof-only throttling to exercise resumed downloads in CI, planned for removal before readiness.
File Description
test/​smoke/​wslDevContainer.ps1 Replaces sequential package downloads with a parallel, resumable helper and a script-relative deadline.

Review effort: Balanced

@bryanchen-d

Copy link
Copy Markdown
Collaborator Author

Linux / Electron-Smoke (shard 3/3) failed on Chat Sessions › Test Local session (job 130040854202). That's the flake #347394 fixes, and it's unrelated to this Windows-only script change. I've rerun the failed jobs.

Co-authored with Copilot

@bryanchen-d

Copy link
Copy Markdown
Collaborator Author

Proof: def 111 494890 (Windows x64 only, CI, Publish off) with the PROOF ONLY commit, which cuts every package's first fetch short after 3 s at 32 KB/s.

  • Build WSL distribution if not cached (build: cache the prepared WSL distribution in the Windows smoke job #347367's cache-miss path) ran the new downloader. 19 packages stopped partway (curl: (28) … with 103669 out of 355538 bytes) and resumed. The host downloaded all 34 packages, and apt reported Need to get 0 B/85.9 MB. No package was left to apt, and no hash mismatched. Prepare took 123 s.
  • Prepare WSL Dev Container smoke tests then imported the prepared distribution in 12 s.

The PROOF ONLY commit is now dropped. The head is the single change commit.

Co-authored with Copilot

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.

🟢 Approval recommended

There are no active review issues for the WSL package-download changes.

No open issues 🎉

Review effort: Balanced

The Azure Ubuntu mirror at times serves package files at under 100 KB/s
or stalls on them. The host download gave each package three fresh
attempts at 1 MB/s from byte 0, with archive.ubuntu.com as the last one,
which answers 403 to the build agents. It then left large packages such
as containerd and docker.io to apt, which kept the slow connection until
the step's 15-minute timeout (494570, 494706).

Download the packages in parallel, continue a stopped transfer from
where it stopped on a fresh connection, back off only after an attempt
that got no bytes, and give the host until 10 minutes after the script
started.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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.

🟢 Approval recommended

No active review issues block the WSL package-download changes.

No open issues 🎉

Review effort: Balanced

@bryanchen-d
Bryan Chen (bryanchen-d) marked this pull request as ready for review November 11, 2026 00:42
@bryanchen-d
Bryan Chen (bryanchen-d) merged commit 375756a into main Nov 11, 2026
53 of 54 checks passed
@bryanchen-d
Bryan Chen (bryanchen-d) deleted the copilot/vscode/wsl-deb-download-resume branch November 11, 2026 00:45
@vs-code-engineering vs-code-engineering Bot added this to the 1.147.0 milestone Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants