Repository navigation
ADFA-5146 fix(env): a killed download no longer locks every deep operation - #423
Merged
Merged
Conversation
State-spine finding 2 (release blocker). A content-download service killed before a terminal state left EnvironmentLock.isBusyNow() true for the life of the process, so every deep operation refused with "An install is already running" while nothing ran — the only exit was force-stopping the app. - Freshness (pure) + a per-poll last-progress heartbeat on the three content sources (ZIM, Books, Courses). isBusyNow() now counts them via isActiveNow() (hasSession && !isComplete && fresh), so a dead session ages out after ~30s while a live-but-slow download stays fresh and keeps blocking; a finished one never blocks. The module queue is unchanged — its stuck case belongs to the durable install guard (ADFA-5147-adjacent), not this flag. - EnvironmentLock.currentHolder(ctx) + util/BusyMessage: the six deep-op gates now name the real holder (copy / backup / restore / install / download) instead of always "an install". Five strings, base + 33 locales. - Remove the dead InstallJobs.isBusy() delegate. - FreshnessTest (JVM). Design + plan: controller/docs/ADFA-5146-busy-expiry-design.md. Known limit (documented): a module runrole killed within one session; covered cross-session by the install guard + ADFA-5147.
…/ADFA-5146-busy-flag-expiry
…rflowing the stack ensureHotspot() runs on every render and re-launched ACCESS_FINE_LOCATION whenever it wasn't granted; the permission callback then re-renders. On OEMs that return the denied result synchronously this recursed with no async gap (render -> ensureHotspot -> launch -> deny -> callback -> render …) until the 8 MB stack overflowed when opening Clone > Send. A locationAsked latch requests the permission at most once per attempt; setMode() clears it so a Hotspot/Wi-Fi switch is a natural retry.
Reproduces the stale-heartbeat case deterministically (a content download whose poll loop died with the process alive) — otherwise hard to trigger by hand, and NOT the same as "download + Wi-Fi off" (that keeps the poll loop, so the flag stays fresh by design). The receiver lives in src/debug, so it never ships in release; remove it with debugSeedStaleCandidate() before merge.
Drops the src/debug broadcast receiver, its manifest entry and the debugSeedStaleCandidate() seeder used to verify the stale-flag expiry on device. The rule stays covered by FreshnessTest; the one-time end-to-end check is done.
… of truth) isHeld() re-listed the same lock sources as currentHolder(), so a source added to one and not the other would block while naming the wrong holder (or defaulting to "an install") — a silent drift nobody would notice until it bit. isHeld now returns currentHolder(ctx) != NONE, so currentHolder is the single place that enumerates the sources. Behavior is unchanged today.
…on the left state-spine.svg: S13 "stale busy" and finding 2 (the release blocker) move to resolved — the busy flag expires in ~30s and the refusal names the holder; the findings summary drops to one open (6). operation-model-roadmap.svg: DELIVERED becomes two columns holding every DONE card — the state-spine arc (5143/5137/5147/5146) and 5119 move out of NEXT / IN FLIGHT, which shift right and now carry only open work, so a card's column matches its status. The isBusyNow ledger row and the 5146 card flip to done, and the inter-column arrows are redrawn to the new positions.
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.
State-spine finding 2, the release blocker. When a content-download service was
killed before a terminal state, EnvironmentLock.isBusyNow() stayed true for the
life of the process, so clone / backup / restore / install / rebuild / maps all
refused with "An install is already running" while nothing ran — the only exit
was force-stopping the app.
What this changes
Courses). isBusyNow() now counts each via isActiveNow() = hasSession &&
!isComplete && Freshness.fresh(...). A dead session ages out after ~30s; a
live-but-slow download refreshes every poll and keeps blocking; a finished one
never blocks. Freshness is pure (unit-tested).
now name the real holder (a copy / backup / restore / install / download)
instead of always "an install". Five strings, base + 33 locales.
Deliberately not here
by the durable install guard, whose lifecycle is ADFA-5147-adjacent, not this
flag. Known limit: a module runrole killed within one session — covered
cross-session by the guard + ADFA-5147. Design + rationale in
controller/docs/ADFA-5146-busy-expiry-design.md.
Verification
refusal names it; a finished one does not.
Coordination
ADFA-5158 branch (renderPrepare/renderCopy), so no real conflict expected.