Skip to content

amalgamation testing #1630

Open
Open

Description

@zackees

FastLED/FastLED#4679

We fixed this for soldr

please fix it for zccache and fbuild

Activity

  1. zackees commented on Nov 19, 2026

    @zackees
    MemberAuthor

    Took the fbuild half of this: PR #2093 (agent/signal-kill-diag, head a3db3eb6).

    #1628's cause is already fixed on main — #1631 (db80bbfd) forks every contained child on a process-lifetime thread, so PR_SET_PDEATHSIG no longer fires when a retired Tokio worker exits mid-compile. What stayed missing was #1628's ask 3: when a compiler is killed, the failure said only

    failed to compile …/fl/fx+.cpp in library FastLED (exit code -9):
    (the compiler wrote nothing to stderr)
    

    which reads like a compiler crash or a source error. Nothing in it says a signal ended the process.

    #2093 adds fbuild_core::termination: it recognises both spellings that reach us — -signal (what ToolOutput.exit_code carries on Unix) and 128 + signal, the shell convention a tool that shells out forwards (zccache reports 137 for SIGKILL) — and names the signal when the number is identical on Linux and macOS. SIGBUS/SIGUSR1/SIGUSR2/SIGCONT/SIGSTKFLT disagree between the two, so those print signal N (no portable name) instead of a wrong name, and Windows stays None because it collapses every abnormal exit to -1 and keeps no signal number. The library failure now reads (exit code -9 = SIGKILL (signal 9)) plus a hint that a kill is a host/containment event, not a source error, and the same sentence goes to the daemon log at WARN (log_signal_kill), which is the only place the signal can survive after the fact.

    Receipts: cargo test -p fbuild-core --lib termination 8 passed / 0 failed, including a real sh -c 'kill -9 $$' through run_command arriving as exit_code == -9 with empty stderr and classifying as SIGKILL (signal 9); cargo test -p fbuild-library --lib library_compiler 27 passed / 0 failed / 2 ignored; clippy both crates -D warnings clean; enforce_platform_boundary.py --print-totals 44/43. First CI run failed the 1000-LOC gate (library_compiler_tests.rs 1011) — fixed by moving the two tests to library_compiler_signal_tests.rs in a second commit; the gate now passes.

    Still open here: the zccache half (its own kill attribution) and #1628's ask 2 — a failed build's output being replayed verbatim to the next request, so a retry cannot recover. I did not touch either: #2093 changes only what a kill says, not what kills or what is cached. #1628 stays closed (its cause is fixed); the replay question deserves its own repro.

  2. zackees commented on Nov 19, 2026

    @zackees
    MemberAuthor

    Merged as #2093 (48f10475, 2026-11-19T03:59:52Z) — the diagnostics half of this issue, i.e. the fbuild side of FastLED/FastLED#4679's exit -9 compiler kills.

    What landed: fbuild_core::termination recognises both the -signal convention and the shell 128+signal form (zccache forwards 137 for SIGKILL), names only signals whose numbers agree on Linux and macOS (others degrade to signal N (no portable name)), and returns None on Windows where every abnormal exit is -1. A killed library TU now reports (exit code -9 = SIGKILL (signal 9)) plus a kill hint instead of only (exit code -9) + (the compiler wrote nothing to stderr), and the same sentence goes to daemon.log at WARN via log_signal_kill().

    Receipts: fbuild-core --lib termination 8 pass / 0 fail including a real sh -c 'kill -9 $$' through run_command arriving as exit_code == -9 with empty stderr; fbuild-library --lib library_compiler 27 pass / 0 fail / 2 ignored; clippy -D warnings clean on both crates; fmt clean; boundary 44/43. Post-merge on 48f10475: 17 success / 15 skipped / 0 failure / 13 running.

    This issue stays open. Untouched halves:

    1. The root cause is fix(process): fork contained children on a process-lifetime thread (#1628) #1631 (db80bbfd, process-lifetime fork thread) — already on main; this PR only made the symptom legible.
    2. zccache's side: it still reports 137 rather than the child's true termination, and the embedded holder path has its own attribution gap under fix(daemon): embedded zccache holder watchdog aborts active builds at flush and spawn guards #1866.
    3. ESP32 local-library compiles SIGKILLed (exit -9) since 2.5.30 — not OOM; userland kill of compile children #1628 ask 2 — a failed build is replayed verbatim to the next request, so a retry cannot recover from a kill. That needs a cache-side invalidation rule, not a message.
  3. zackees commented on Nov 19, 2026

    @zackees
    MemberAuthor

    Remaining half 3 (#1628 ask 2 — a failed build replayed verbatim so a retry cannot recover) has an in-repo instance, and it is now fixed in PR #2103 (agent/fwlib-kill-negative-cache).

    fbuild's own negative cache replayed a kill as if it were a verdict about the library. Two memories, both written for any non-zero compile exit and both consulted before compiling:

    • <build>/fw_libs/.<lib>.failed (build dir, flags + source mtimes)
    • framework-library-artifacts/<key>/failed/<lib> — global and cross-project, keyed by fbuild version + profile + flags + libraries tree + project headers

    So one SIGKILL on a loaded host (or the daemon's containment, or the OOM killer) removed a framework library from every future build sharing that key, permanently, with no route back except --clean-all. The compiler never evaluated the source, so that memory was wrong by construction.

    What changed: FbuildError::ProcessTerminated { message, exit_code } (is_signal_kill()) is produced whenever fbuild_core::termination::host_termination recognises the exit code (-9, or the shell form 137 zccache forwards); compile_library_link_inputs_gated now keeps the first FbuildError instead of flattening it to a String (which had erased the kind before any caller saw it); FwLibsPlan::finish writes neither marker for a kill and logs that it did not. Ordinary compiler errors still record both, so nothing about the tolerated-failure policy changes.

    Receipts: fbuild-build-esp --lib esp32::orchestrator 102 passed / 0 failed (new: a -9 backend leaves no marker, leaves has_failed false, and the next build recompiles); fbuild-library --lib 367 / 0 / 9 ignored; fbuild-core --lib 448 / 0 / 2 ignored; clippy -D warnings clean on the three crates; cargo check --workspace --all-targets --exclude fbuild-python clean; boundary 44/43.

    Not covered here: zccache's own failure caching and its 137-instead-of-the-child's-true-signal attribution (that is the upstream half, and #1866 for the embedded holder). This issue stays open for those.

  4. zackees commented on Nov 19, 2026

    @zackees
    MemberAuthor

    Merged as #2103 (441326ba, 2026-11-19T17:13:02Z) — fbuild's own half of ask 2, i.e. its negative cache no longer replays a kill.

    On main: FbuildError::ProcessTerminated { message, exit_code } + is_signal_kill() (crates/fbuild-core/src/lib.rs), built by compile_exit_error in crates/fbuild-library/src/library/library_compiler.rs when fbuild_core::termination::host_termination recognises the exit code (-9, or the shell form 137 zccache forwards); the join in compile_library_link_inputs_gated keeps the first FbuildError instead of a String, and crates/fbuild-build-esp/src/esp32/orchestrator/framework_libs.rs skips both failure markers for a kill (WARN: "was killed before any diagnostic; not remembering the failure so the next build retries").

    Receipts: fbuild-build-esp --lib esp32::orchestrator 102 pass / 0 fail; fbuild-library --lib 367 pass / 0 fail / 9 ignored; fbuild-core --lib 448 pass / 0 fail / 2 ignored; clippy -D warnings clean on the three crates; cargo check --workspace --all-targets --exclude fbuild-python clean. Merge queue: 31 SUCCESS / 9 SKIPPED / 0 failing (40 checks) pre-enqueue, merged in ~11 min.

    Still open here: zccache's own failure caching and its 137-instead-of-the-child's-true-signal attribution (upstream, and #1866 for the embedded holder). This issue stays open for those.

  5. zackees commented on Nov 19, 2026

    @zackees
    MemberAuthor

    Third in-repo half of this issue: PR #2104 (agent/kill-log-reason).

    #1628 ask 1's second sentence is "Every child kill should log a reason and the PID." #1628 ask 3 (the observed kill, -9, nothing on stderr) landed in #2093, and ask 2's replay-verbatim landed in #2103. What was still silent is the kill fbuild itself performs: fbuild_core::subprocess::stop_timed_out_command is on the funnel every external command takes (linkers, objcopy, esptool, arduino-cli, passthrough tools), and on timeout it force-killed the command's whole process tree while writing nothing anywhere — no PID, no argv, no reason. The only record was the caller string command timed out after Ns.

    Three call sites killed through it or through an equivalent inline terminate_tree + child.kill() (wait_and_capture, run_command_passthrough_inner, run_command_reporting_with_limit). Now one helper logs WARN force-killing a timed-out command tree (reason: timeout) pid=<pid> limit_ms=<n> argv=[...] before terminating, and the passthrough path reuses it (gaining the bounded reap the captured path already had).

    Receipts: fbuild-core --lib subprocess 33/33 with two log assertions (a silent kill fails the test), fbuild-core --lib 449/0/2i, clippy -D warnings clean, fmt clean, boundary 44/43, cargo check --workspace --all-targets --exclude fbuild-python exit 0.

    This issue stays OPEN for the zccache half — the compile-child kill itself is upstream (kill_on_drop / stall watchdog, #1866), and the pin is still zccache = "=1.15.8", so nothing to re-verify there yet.

  6. zackees commented on Nov 19, 2026

    @zackees
    MemberAuthor

    Merged as #2104 (ff28d9fb, 2026-11-19T19:59:37Z, ~19 min merge queue).

    On main: stop_timed_out_command (crates/fbuild-core/src/subprocess.rs L637) logs
    WARN force-killing a timed-out command tree (reason: timeout) pid=<pid> limit_ms=<n> argv=[...]
    before terminating the process tree, the passthrough path reuses that helper (drops its own inline
    terminate_tree + child.kill() and gains the bounded reap budget), and
    run_command_reporting_with_limit passes args + timeout through (subprocess_report.rs L130).
    Two #[traced_test] assertions fail the build if a timed-out kill is ever silent again.

    #1630 stays OPEN for the zccache half only — the compile-child killer is zccache's session
    kill_on_drop / stall watchdog (#1866), and the pin is still zccache = "=1.15.8", so there is nothing
    to re-verify on the fbuild side until a zccache release lands.

  7. zackees commented on Nov 19, 2026

    @zackees
    MemberAuthor

    Re-verified the remaining cell; nothing actionable in-repo left, so I am recording this as upstream-blocked (a comment does not unblock it; only an edit to this issue's title/labels/body does, which is the intent).

    What the three landed PRs cover (all on main):

    Remaining halves and why they are not mine:

    1. zccache's kill itself (kill_on_drop / stall watchdog) is upstream, tracked as fix(daemon): embedded zccache holder watchdog aborts active builds at flush and spawn guards #1866 — fbuild cannot log a PID for a kill it does not issue.
    2. zccache reports 137 rather than the child's true signal — upstream; the fbuild side already degrades correctly (137 is classified as SIGKILL).
    3. zccache's own failure caching — upstream.

    Re-verify trigger, checked this run: Cargo.toml L221 is still zccache = "=1.15.8" and Cargo.lock L4953-4955 resolves zccache 1.15.8; crates.io's newest release is 1.15.14 (2026-11-03), i.e. unchanged since the #1866 receipt that showed 1.15.14 byte-identical to 1.15.13 and sync_watchdog.rs identical to 1.15.8. So there is no pin to bump and nothing to re-measure; this reopens when a zccache release changes the watchdog/attribution, or when #1866 closes.

    Also checked and deliberately not changed: the remaining child.kill() sites on main are (a) test helpers, (b) ContainedChild::kill in platform/process.rs (a thin wrapper with no non-test caller), and (c) the emulator handlers in fbuild-daemon/src/handlers/emulator/{shared,avr8js_headless}.rs, where a kill is the normal completion of halt_on_success / halt_on_error / timeout and the reason already travels to the caller as a MonitorOutcome; a WARN there would fire on every successful emulated run.

    #1630 stays open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions