fix(remote): back off a failing host instead of retrying forever - #226
Merged
Merged
Conversation
… fixed cadence A dead host previously reran the ssh inventory every fixed interval forever; one field log carries 226 identical "transport disposed" warnings, one every 300.0 s, over ~19 h with nothing ever slowing it down or surfacing it. refreshNow() now tracks consecutive failures per alias and delays the next attempt by min(intervalMs * 2^(failures-1), 30 min): base equals the host's own configured cadence so an isolated blip costs nothing extra, and 30 min was chosen as a ceiling short enough that a recovered host is picked back up without anyone restarting the app. A host past its next-attempt instant is skipped for that cycle only, no ssh call, no log line, while its peers still run on schedule. One success resets the counter and delay to nominal immediately. Decision: a permanently failing host is only slowed to the 30 min ceiling, never disabled, disabling would need the same enabled flag Settings owns, turning a transient network problem into a silent, permanent loss of mirroring with no UI to notice or undo it, whereas one capped attempt per 30 min is cheap enough to just keep paying. Failure logging is throttled to the first failure and each change of tier, not every attempt. Per-host state (consecutive failures, last error, next attempt instant) is readable via getRemoteHostState(alias). Refs #215
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.
Closes #215.
A live install logged 226 consecutive identical failed cycles over ~19 hours,
at exactly 300.0 s apart, with nothing slowing down, giving up, or surfacing.
Only restarting the app ended it. That particular cause is fixed; the absence of
a circuit breaker was not.
Per-host exponential backoff:
intervalMs * 2^(failures-1), capped at 30minutes. The cap stays short so a host that comes back is picked up without any
intervention. The first success resets the counter and the delay immediately.
A failing host is slowed, never disabled. Disabling would mean touching the
enabled flag the UI owns, turning a transient network problem into a silent and
permanent loss of mirroring — the same failure class this issue is about.
Logging is no longer uniform: a line is written on the first failure and at each
tier change, plus one on recovery. Known trade-off: once the delay reaches the
cap it stops changing, so a permanently failing host goes quiet. The state stays
queryable through the new accessor and #218 will surface it.
State is exposed per host — consecutive failures, last error, next attempt — in
the same spirit as the existing session accessor. No UI change here.
Verification
Three mutations, each with the changed line printed before the run and the file
restored from an md5-verified copy:
fails, the healthy host refreshing once instead of twice.
Clock and transport are injected; no network, no real ssh.
task check: 1123 tests, 1115 passed, 0 failed, 8 pre-existing skips. Lint 0errors.