Repository navigation
ADFA-5365 fix(server-lifecycle): judge a boot on movement, not on the flap grace - #514
Merged
Merged
Conversation
… flap grace A boot and a flap are both "alive, not answering", and one 20s threshold was answering both. A boot has been down since its proot started, so its downtime IS its boot time: a device-measured 37s boot was killed at ~24s and relaunched forever, never finishing. The missing fact is whether this proot has ever answered. ServerLiveness now carries it from the observations it already makes, so a boot can be judged on whether it is still moving -- the guest keeps talking while it comes up, and the longest quiet step (13s measured) does not grow with content the way total boot time does. The flap path is untouched. Also removes ServerController's copy of the service-down grace, which sat beside an EnvironmentEnsure javadoc claiming to be the single source. Device-verified: boot reaches UP in 39.9s with zero kills; a killed dash-node is still relaunched at 21s.
…e environment Reading the progress stamp off "my engine" meant a boot started by the foreground actuator and then backgrounded looked silent to the reconciler, which fell back to the downtime rule and killed it at 20s -- the very bug this ticket removes. There are two launch paths holding two different engines, so the fact cannot live on either one. EnvironmentProgress holds it once, app-scoped like ServerStateRepository, and is written only by the environment launches' own listeners so a module install streaming through the same engine class cannot make a stalled environment look alive. PRootEngine's per-instance copy is removed rather than kept alongside it. Clearing lives in EnvironmentControl.stop, symmetric with the launch stamp: three call sites stop the environment, and an invariant only one of them upholds rots. Device-verified: a boot backgrounded 12s in reaches UP with zero kills.
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.
What
Stop killing a healthy environment mid-boot. One 20 s threshold was answering two different
questions, and on a slow device the boot lost.
Why
Device-measured: the box reaches
/k2go-apiin ~40 s. The service-down grace is 20 s plus a 3 stick, so
KILL_AND_RELAUNCHfired at ~24 s — forever, 24.02 s apart. The device was capable; ourown timer stopped it.
The cause is a conflation: during a boot the services have been down since the proot started, so
servicesDownMsis the boot time; during a flap it is the time since the drop. Same number, twomeanings, one threshold.
The fix
The missing fact is whether this proot has ever answered since it appeared — a boot never has,
a flap has.
ServerLivenessnow carries it from observations it already makes, threaded and resetlike the downtime clock. Nothing else in the app knew it.
A boot is then judged on whether it is still moving, not on how long it has taken. Measured on a
real boot: 37 s total, longest gap between two guest lines 13 s. Total boot time grows with the
content installed; the longest quiet step does not — which is why a bigger number would just be
outgrown again. The silence grace is 60 s, 4.6x the worst gap measured.
The progress fact lives in
EnvironmentProgress, app-scoped, because the two launch paths hold twodifferent engines: reading it off "my engine" made a boot started in the foreground and then
backgrounded look silent to the reconciler. Only the environment launches' listeners write it, so a
module install cannot make a stalled environment look alive. Clearing lives in
EnvironmentControl.stop— three call sites stop the environment, and an invariant only one ofthem upholds rots.
Reduction
ServerControllerheld a private copy beside anEnvironmentEnsurejavadoc claiming to be the single source)Device verification — all four paths, build under test, driven through the app
dash-nodekilled)The last one is the user-visible one: turning the server off and on used to drop the device back
into the loop, because the restart outlives the old grace.
Worth knowing
20 s). Deliberate — the same trade ADR-5343a §12 accepted for the rebuild. No known instance.
life. After a gap we cannot honestly claim it never served, so the fallback is sticky by design.
EnvironmentProgressis shared mutable static state, whichCLAUDE.mddiscourages. Theenvironment outlives every Activity so a fact about it must too;
ServerStateRepositoryis theexisting precedent. Flagged rather than slipped in.
launched()is called from both launch paths because there still are two. Clearing could becentralised, stamping cannot until the launch paths are unified — a third one would forget.
Tests
EnvironmentEnsureTestpins both clocks, including the case that fails onmain(a 37 s bootstill talking is not killed) and the one that must never change (a mature environment is never
judged on silence — it produces no output at all).
ServerLivenessTestcovers the new fact acrossa full startup, the moment it answers, a replacement proot, and the gap fallback.
Pairing
ADFA-5362 closed the capability half; this is the lifecycle half. Together they are what makes an
affected device reach its services and stay up.
No server change, no new strings, no UI change.