Skip to content

feat(fetch-content): merge concurrently extracted fetches in a fixed order - #1047

Merged
ahal merged 1 commit into
taskcluster:mainfrom
ahochheiden:fetch-content-staged-extract
Sep 21, 2026
Merged

ahal merged 1 commit into
taskcluster:mainfrom
ahochheiden:fetch-content-staged-extract

Conversation

@ahochheiden

Copy link
Copy Markdown
Contributor

Firefox is moving its test package downloads from mozharness to fetches (bug 2073846). A test task will then fetch several archives into one destination with overlapping contents, such as the test harness binaries that both common and trainhop ship under bin. fetch-content extracts every fetch in parallel, directly into its destination, so two threads write the same tree at once and the outcome depends on thread timing. A path present in two archives ends up as whichever copy was extracted last, and on Windows the race can fail outright when tarfile finds a parent directory another thread just created.

Each fetch now downloads and extracts into its own staging directory, and the staging directories are moved into the destination one at a time in list order. Downloads and extraction remain parallel and the merge consists of renames. When two fetches provide the same path, the later one wins, directory modes included.

The Windows failure alone could be patched around in the tarfile subclass, but the ordering would remain undefined. The overlapping files are identical today, so that would go unnoticed until they differ and could produce an intermittent failure instead of a reproducible one.

@ahochheiden
ahochheiden requested a review from a team as a code owner September 21, 2026 06:15
@ahochheiden
ahochheiden requested a review from ahal September 21, 2026 06:15
…order

Firefox is moving its test package downloads from mozharness to fetches
(bug 2073846). A test task will then fetch several archives into one
destination with overlapping contents, such as the test harness
binaries that both `common` and `trainhop` ship under `bin`.
fetch-content extracts every fetch in parallel, directly into its
destination, so two threads write the same tree at once and the outcome
depends on thread timing. A path present in two archives ends up as
whichever copy was extracted last, and on Windows the race can fail
outright when `tarfile` finds a parent directory another thread just
created.

Each fetch now downloads and extracts into its own staging directory,
and the staging directories are moved into the destination one at a
time in list order. Downloads and extraction remain parallel and the
merge consists of renames. When two fetches provide the same path, the
later one wins, directory modes included.

The Windows failure alone could be patched around in the `tarfile`
subclass, but the ordering would remain undefined. The overlapping
files are identical today, so that would go unnoticed until they differ
and could produce an intermittent failure instead of a reproducible one.
@ahochheiden
ahochheiden force-pushed the fetch-content-staged-extract branch from 08d7bb5 to b41c515 Compare September 21, 2026 15:54

@ahal ahal 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.

Thanks, lgtm!

@ahal
ahal merged commit c53456f into taskcluster:main Sep 21, 2026
26 checks passed
@ahochheiden
ahochheiden deleted the fetch-content-staged-extract branch September 21, 2026 19:41
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.

2 participants