Repository navigation
ci(nix): fail stalled Nix downloads fast so the setup retry runs - #5422
Draft
matthewgrossman wants to merge 1 commit into
Draft
matthewgrossman wants to merge 1 commit into
matthewgrossman wants to merge 1 commit into
Conversation
#5421) Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
matthewgrossman
requested review from
a team,
derekwaynecarr,
mrunalp and
sjenning
as code owners
November 9, 2026 21:45
Member
Author
|
/ok to test 39552a8 |
matthewgrossman
marked this pull request as draft
November 10, 2026 05:37
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
This branch has not been deployed
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.
Summary
Stalled Nix store downloads held CI jobs until the job timeout, because Nix waits 300 s with no data before it retries a file. This PR makes Nix give up on a stalled download after 60 s. It also limits the first
nix developtry insetup-nixto 15 minutes, so the existing retry runs in a fresh process.Related Issue
Closes #5421
Changes
setup-nixpassesextra-confto the Determinate installer:stalled-download-timeout = 60(default 300).connect-timeout = 15. This is the current Determinate default. Setting it here keeps it from changing under us.nix developtry runs under a 900 s watchdog. If the watchdog fires, it stops Nix with SIGTERM and the existing single retry runs. The retry has no limit of its own; the job timeout still applies. A small bash watchdog is used because macOS runners have notimeout/gtimeout, and their bash is 3.2.Evidence and chosen values
What a stall looks like. In job 122735958171, NAR downloads from
openshell.cachix.orgretried exactly every 300 s ("Less than 1 bytes/sec transferred the last 300 seconds"). Two files stalled on every attempt until the job was cancelled at 45 minutes. The flake census for 2026-10-21 to 2026-11-04 found 4 such stalls: 2 on macOS, held for 45 min, and 2 on tmachine, held for 90 min. That is about 5.7 runner hours. It also found 5 fast Nix download failures, which the existing retry already handles.Why 60 s only cuts true stalls. Nix implements
stalled-download-timeoutwith curl's low-speed limit of 1 byte/s. A transfer is aborted only if it receives less than 1 byte/s for the whole window. Slow but working downloads are not affected. With 5 attempts, a stuck file now fails in about 5 minutes instead of 25.Why 900 s for the first try. These are times for the whole
Run ./.github/actions/setup-nixstep (install, Cachix and shell). They come from about 3,270 successful jobs in the last 25 successful runs each of Branch Checks, Branch E2E Checks and Release Dev:900 s is about 2.4 times the slowest successful run. If a slow but healthy cold build hits the limit, the paths it already fetched or built stay in the store, and the retry continues from there. So a false trigger costs only the in-progress work. On macOS (45-minute job timeout), a stall now leaves at least 30 minutes for the retry.
Settings must be in
nix.conf. The Nix daemon performs substitutions, and it does not read a client'sNIX_CONFIG.extra-confwrites the settings into/etc/nix/nix.custom.confbefore the daemon starts.Other Nix callers
Every other Nix call in CI runs after
setup-nixon the same runner and uses the same daemon, so all of them get the new download settings:nix build X || nix build Xinintegration-runner.yml(tmachine),e2e-suites.yml,prepare-integration-inputs.yml,build-vm-driver.ymlandcheck-protobuf-compatibility.shell: nix develop ...steps across the workflows and inbuild-rust-binary.Both tmachine stalls in the census were in
nix build .#tmachine || .... With the 60 s stall timeout, the firstnix buildnow fails within minutes, so its||retry can run. Those call sites do not get the 15-minute wall-clock limit. That limit is only insetup-nix.Testing
/bin/bash3.2 (macOS) and bash 5.3 with-eo pipefailand a fakenix, with a 3 s limit. A passing first try exits at once. A failing first try retries. A hung first try is stopped at the limit and the retry succeeds. Nosleepprocesses are left behind.shellcheckon the step script, andzizmoron the action: no findings.setup-nixlog showsextra-confapplied.Checklist