Skip to content

fix(esp32): retry a framework library whose compiler was killed by a signal - #2103

Merged
zackees merged 1 commit into
mainfrom
agent/fwlib-kill-negative-cache
Nov 19, 2026
Merged

zackees merged 1 commit into
mainfrom
agent/fwlib-kill-negative-cache

Conversation

@zackees

@zackees zackees commented Nov 19, 2026

Copy link
Copy Markdown
Member

A compiler killed by a signal never reaches a verdict about the source — it compiles nothing and writes no diagnostic. fbuild still remembered that failure in both negative caches, so every later build skipped the library and replayed the kill, and a retry could never recover. That is #1630's remaining item 3 (#1628 ask 2) on fbuild's own side: a cache-side invalidation rule.

Two places kept the memory:

where lifetime key
<build>/fw_libs/.<lib>.failed build dir flags + source mtimes
framework-library-artifacts/<key>/failed/<lib> global, cross-project fbuild version, profile, flags, libraries tree, project headers

Both were written for any non-zero compile exit, and FwLibsPlan::new consults both before compiling. So one SIGKILL on a loaded host (or the daemon's containment, or the OOM killer) silently removed a framework library from every future build of every project sharing that key, with no way back except --clean-all.

Change

  1. A kill is its own error kind. FbuildError::ProcessTerminated { message, exit_code } (is_signal_kill()), produced by compile_exit_error when fbuild_core::termination::host_termination recognises the exit code (-9, or the shell form 137 that zccache forwards). An ordinary compiler error stays BuildFailed, so nothing about existing behaviour changes.
  2. The aggregator stops erasing it. compile_library_link_inputs_gated collected the first failure into an Option<String>; the kind was gone before any caller could see it. It now keeps the FbuildError and returns it (its Display is unchanged, so the message is byte-identical).
  3. FwLibsPlan::finish refuses to remember a kill — neither marker is written, and a WARN says the failure was not remembered so the next build retries.

Receipts

  • soldr cargo test -p fbuild-build-esp --lib esp32::orchestrator — 102 passed / 0 failed, including the new signal_killed_framework_lib_is_not_remembered_so_the_next_build_retries: a -9 backend leaves no build-dir marker, leaves cache.has_failed false, and the next build calls the backend again; the existing deterministic-failure test still shows both markers recorded and the second build skipping.
  • soldr cargo test -p fbuild-library --lib — 367 passed / 0 failed / 9 ignored (new: a_signal_kill_is_a_termination_error_and_a_source_error_is_not).
  • soldr cargo test -p fbuild-core --lib — 448 passed / 0 failed / 2 ignored.
  • soldr cargo clippy -p fbuild-core -p fbuild-library -p fbuild-build-esp --all-targets --no-deps -- -D warnings — clean; cargo fmt --check clean; cargo check --workspace --all-targets --exclude fbuild-python — clean (the new enum variant breaks no exhaustive match); ci/enforce_platform_boundary.py --print-totals — 44/43.

Scope: this makes fbuild's own cache stop replaying a kill. It does not change what kills a compiler, and zccache's separate failure caching (and its 137-instead-of-the-child's-signal attribution, #1866) stays upstream.

#1630 stays open (remaining cells: root cause #1631 — already on main; zccache's own kill attribution; the embedded holder's under #1866).

A killed compiler reached no verdict about the library: nothing was
compiled and no diagnostic was written. The failure was still remembered
in both negative caches (the build-dir `.lib.failed` marker and the
persistent global framework-library cache), so every later build skipped
that library and replayed the kill — a retry could never recover
(#1628 ask 2, #1630).

- `FbuildError::ProcessTerminated` carries a signal kill as its own kind
  (`is_signal_kill()`); an ordinary compiler error stays `BuildFailed`.
  The aggregator in `compile_library_link_inputs_gated` keeps the first
  error itself instead of flattening it to a string, which had erased the
  distinction before any caller could see it.
- `FwLibsPlan::finish` records neither marker for a kill and says so in
  the log, so the next build recompiles.
@coderabbitai

coderabbitai Bot commented Nov 19, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@zackees zackees mentioned this pull request Nov 19, 2026
@zackees
zackees added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit 441326b Nov 19, 2026
40 checks passed
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Nov 20, 2026
@zackees
zackees deleted the agent/fwlib-kill-negative-cache branch November 24, 2026 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

1 participant