Repository navigation
fix(daemon): don't self-evict while operations are in flight - #2144
Merged
Merged
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
…ain lacks #2143 landed the core self-eviction fix on main (busy_reason counts the drain counter, self-eviction commits with try_begin_shutdown), so this branch's overlapping rewrite conflicted with it. Resolution keeps main's busy_reason and adds what main still lacked: - the eviction window predicate moves into entry/self_eviction.rs as try_self_evict(ctx, &mut empty_since, now, timeout), unit-tested with explicit instants instead of sleeping; mod.rs was at exactly the 1000-LOC gate, so the predicate cannot stay inline; - the 12-hour fallback now requires is_empty() and closes operation admission (try_begin_shutdown) before signalling shutdown, so the fallback cannot kill a daemon that is still building; - a busy tick calls touch_activity(), so the fallback idle clock follows real work rather than wall time. Verified: soldr cargo test -p fbuild-daemon --lib -> 339 passed, 0 failed, 3 ignored (includes the two self-eviction tests through the real loop helper); soldr cargo clippy -p fbuild-daemon --lib --tests -D warnings -> exit 0; cargo fmt --check clean; enforce_platform_boundary rows=0 rc 0. mod.rs 995 LOC, self_eviction.rs 141 LOC.
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.
A running build can lose its daemon connection when another operation clears the legacy
operation_in_progressboolean. Self-eviction now checks the same admitted-request and active-operation counters as shutdown, restarts its idle window after activity, and atomically closes operation admission before signaling shutdown. The 12-hour idle fallback also respects active work; explicit stop/SIGTERM behavior is unchanged.Focused regression tests cover overlapping operation guards (one completes while another is still building), admitted requests before guard creation, a fresh idle window after completion, and refusal of new operations once self-eviction commits to shutdown. The timer uses explicit instants so these tests do not sleep.
Merged up to main after #2143 ("tell slow-under-load apart from hung; queue
deploys for a busy port") landed the same core fix independently — it also
counts the drain counter in
busy_reason()and commits self-eviction throughtry_begin_shutdown. The merge therefore keeps main'sbusy_reason()andkeeps only the delta main lacked:
entry/self_eviction.rsastry_self_evict(ctx, &mut empty_since, now, timeout)and unit-tested withexplicit instants (no sleeps).
entry/mod.rssits at exactly the 1000-LOCgate on main, so the predicate cannot stay inline; it is 995 LOC now.
is_empty()and closes operation admission(
try_begin_shutdown) before signalling shutdown, so it can no longer kill adaemon that is still building.
ctx.touch_activity(), so the fallback idle clock followsreal work rather than wall time.
Validation (in a worktree at the merge commit, all Rust through globally
installed soldr):
soldr cargo test -p fbuild-daemon --lib: 339 passed, 0 failed, 3 ignored,including
entry::self_eviction::tests::self_eviction_waits_for_in_flight_operations_and_a_fresh_idle_windowand
..._waits_for_admitted_operation_requests(the former drops one of twooverlapping
OperationGuards and asserts no eviction, then asserts the windowre-arms from the first quiet tick and that admission is closed once it fires).
soldr cargo clippy -p fbuild-daemon --lib --tests -- -D warnings: exit 0.soldr cargo fmt --check -p fbuild-daemon: clean.uv run --no-project python ci/enforce_platform_boundary.py --print-totals:rows=0; dylint_rows=0, rc 0.Not covered by a test: the 12-hour branch itself needs a 12-hour clock, so only
its gate (
is_empty+try_begin_shutdown) is exercised by review, not a unittest. The integration suites were not re-run this round (the local
--libsuiteplus hosted
ci-minimalcover this change); 13 integration tests were green onthe pre-merge commit.