You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
extract stages into .<first 16 hex of sha256>.<attempt>.staging next to the
destination and removes it on every ordinary error path, but a process killed
outright (SIGKILL, OOM killer, reboot) cannot run that cleanup — so each kill
leaves a directory holding up to MAX_EXTRACTED_BYTES (16 GiB) forever.
This unit reaps exactly those directories and nothing else.
name must be exactly .<16 lowercase hex>.<decimal attempt>.staging; a destination tree, a marker, a .bak, an uppercase or wrong-width digest, a non-numeric attempt and a same-shaped file are all left alone
type
only a real directory is removed — symlink_metadata first, so a symlink with a candidate name is never followed and never unlinked (its target survives)
age
a candidate younger than MIN_AGE (1 h) is kept; an unreadable or future mtime is also kept, because guessing "old" is the unsafe direction
marker
a candidate holding .prebuilt-tree.json is kept and reported — a verified tree that was never committed is the caller's decision to discard, not a sweep's
bound
one sweep removes at most MAX_REMOVALS (32) directories, so a cache with many abandoned attempts cannot turn one call into an unbounded delete
report
SweepReport { removed, freed_bytes, kept_live, kept_marked }; a removal error is returned with its path, never swallowed
async
sweep_staging_async runs the blocking pass on its own thread for daemon callers
Opt-in only: no extraction calls it implicitly, so a live attempt in another
process is never at risk (that separation is also what makes the grace period
testable without touching file times — the tests drive an explicit clock).
Verification (head as pushed)
soldr cargo test -p fbuild-packages-fetch --lib → 360 passed / 0 failed / 2 ignored (10 of them new, all in prebuilt::gc).
RED proven by mutation, each restored afterwards:
grace period disabled → a_fresh_staging_directory_is_kept_for_a_live_extraction FAIL (9/1);
No wiring change: the daemon call site (sweep at startup) is the follow-up cell,
alongside the disk-cache LRU and the bucket key. #1882 stays open (remaining
cells: disk-cache LRU, the per-request BuildRequest field, the bucket key,
daemon-wide single-flight, and the --prebuilt-core consumer in the esp32
orchestrator).
Attempt 2 (gh run rerun --failed on 45563505699, run attempt 2) died in the same step as attempt 1: linux / Check → Test, 5m31s, on dell-fsx3mn2-fastled-1, exit 101 at [email protected] after soldr: lost the connection to the soldr daemon (route soldr-daemon-7f93f978…) after 5.2s: Connection reset by peer (0 HIT / 25 MISS). Nothing in this diff is involved: every other check on this PR is green at 307e13d5.
The gate is infra, and there is now hard evidence it is load-driven, not a dead daemon — a green 21-minute linux / Check ran on the same host at load ≈ 5 five minutes earlier, while this one died at load 18.1. Details in #2178 comment 6. No further reruns from the steward on this class; the PR needs one green linux / Check once the Dell lane is healthy or unloaded.
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
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.
Unit 9 of #1882 — staging/partial GC
extractstages into.<first 16 hex of sha256>.<attempt>.stagingnext to thedestination and removes it on every ordinary error path, but a process killed
outright (SIGKILL, OOM killer, reboot) cannot run that cleanup — so each kill
leaves a directory holding up to
MAX_EXTRACTED_BYTES(16 GiB) forever.This unit reaps exactly those directories and nothing else.
crates/fbuild-packages-fetch/src/prebuilt/gc.rs+gc_tests.rs:.<16 lowercase hex>.<decimal attempt>.staging; a destination tree, a marker, a.bak, an uppercase or wrong-width digest, a non-numeric attempt and a same-shaped file are all left alonesymlink_metadatafirst, so a symlink with a candidate name is never followed and never unlinked (its target survives)MIN_AGE(1 h) is kept; an unreadable or future mtime is also kept, because guessing "old" is the unsafe direction.prebuilt-tree.jsonis kept and reported — a verified tree that was never committed is the caller's decision to discard, not a sweep'sMAX_REMOVALS(32) directories, so a cache with many abandoned attempts cannot turn one call into an unbounded deleteSweepReport { removed, freed_bytes, kept_live, kept_marked }; a removal error is returned with its path, never swallowedsweep_staging_asyncruns the blocking pass on its own thread for daemon callersOpt-in only: no extraction calls it implicitly, so a live attempt in another
process is never at risk (that separation is also what makes the grace period
testable without touching file times — the tests drive an explicit clock).
Verification (head as pushed)
soldr cargo test -p fbuild-packages-fetch --lib→ 360 passed / 0 failed / 2 ignored (10 of them new, all inprebuilt::gc).a_fresh_staging_directory_is_kept_for_a_live_extractionFAIL (9/1);a_staging_directory_holding_a_marker_is_kept_and_reportedFAIL (9/1);a_completed_tree_and_foreign_names_are_never_touched+a_symlink_named_like_staging_is_not_followed_or_unlinkedFAIL (8/2).soldr cargo clippy -p fbuild-packages-fetch --all-targets -- -D warningsexit 0.soldr cargo fmt --all -- --checkexit 0.ci/enforce_platform_boundary.py --print-totalsrc 0 (rows=0; dylint_rows=0, identical toorigin/main),ci.test_enforce_platform_boundary14 tests OK,ci/platform_boundary_research.py --checkrc 0,ci/check_test_layout.pyrc 0.No wiring change: the daemon call site (sweep at startup) is the follow-up cell,
alongside the disk-cache LRU and the bucket key. #1882 stays open (remaining
cells: disk-cache LRU, the per-request
BuildRequestfield, the bucket key,daemon-wide single-flight, and the
--prebuilt-coreconsumer in the esp32orchestrator).