broker: Release's DO-teardown retry budget (3×5s) too thin for a sustained DigitalOcean outage — orphaned droplet survives a red drive up to the 24h TTL #756
Labels
No labels
agent-blocked
agent-working
autopilot
bug
deferred
deploy-pending
enhancement
landing-pr
model-haiku
model-opus
model-sonnet
needs-design
needs-info
needs-triage
no-triage
out-of-scope
priority
ready-for-agent
ready-for-human
ready-for-session
rehearsal-183
snapshot-pending
standing-drive
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Blocks
Reference
Matou/idss#756
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Failure
Rehearsal drive
20260824T203650Zreds at thereleaseleg. The broker'sPOST /v1/gateways/releaseforrehearsal-c.idss.nzreturned 502:(
tests/e2e/journey.rented.spec.ts:692, leg timing inartifacts/legs.json—releaseran 13731ms before failing.)Root cause
Rentals.Release(broker/internal/broker/rentals.go:362-388) callsDigitalOcean.Destroy(broker/internal/broker/provider_do.go:200-215), which already rides out transient DO 5xx blips viadoRetryTransient(provider_do.go:481-499):transientRetries = 3(provider_do.go:77) spaced byPollInterval(5s,provider_do.go:100) — a ~10-15s budget. The leg's 13731ms runtime matches that budget being exhausted, not a single blip: DigitalOcean's/v2/droplets/{id}DELETE was returning 503 ("unable to process request, please try again") for longer than ~15s. A failedReleasenever setsrental.Released = true(rentals.go:381), so the droplet is left live and un-torn-down.http.go:260-261turns anyReleaseerror straight into a 502 to the caller — there is no background retry path; the only other teardown mechanism isReap(rentals.go:390-419), which only fires after the lease's TTL lapses. Default TTL is 24h (broker/cmd/broker/main.go:96,IDSS_GATEWAY_TTL), and this rental's heartbeat had just renewed it (legheartbeat-repointran green immediately beforerelease). So a release-time DO outage leaves an orphaned, billed droplet for up to 24h before the reaper would even attempt it again — and Reap uses the same thin retry budget, so it isn't guaranteed to succeed either if DO is still down.Evidence this is live right now
droplet-do-forensics.txtin the run dir shows the box answering ping/ssh 2 minutes after the failed release. I confirmed directly viadoctl compute droplet get 594866531at filing time: droplet594866531/idss-gateway-rehearsal-c-8544(168.144.165.255,rehearsal-c.idss.nz) is stillactiveon the account. This needs a manualdoctl compute droplet delete 594866531(and DNS/broker-ledger cleanup) now — it is outside what this healer touches (infra state outside the checkout).Suspected layer
broker/internal/broker/provider_do.go(retry budget/backoff for the teardown path) andbroker/internal/broker/rentals.go(Release/Reap— no async reconciliation for a release that fails after the HTTP response budget is exhausted).What plugging this needs
A design call, not a mechanical fix — options include: a longer/backed-off retry budget specifically on the release-teardown DELETE (bounded so the HTTP handler doesn't hang the caller indefinitely — maybe retry synchronously for a few seconds then hand off to an async retry loop that keeps trying until DO recovers, independent of
Reap's TTL-gated sweep), and/or an operational alert when aReleaseexhausts its retries so a stray-billed-droplet isn't sitting silent for up to 24h. Also worth checking whetherscripts/rental-reap.sh/ the reap cron runs frequently enough that even the current design would catch this sooner than 24h in practice.Signature:
cd27eeace366.drive
20260824T203650Zred atrelease:broker refused the release of rehearsal-c.idss.nz: 502 {"error":"broker: DigitalOcean refused: Service Unavailable: {\"error\":\"unable to process request, please try again\"}"}evidence:
test-results/…/20260824T203650Z/on matou-workstation (legs.json, droplet-journal.txt, trace) — a representative screenshot is attached here if one was captured (#596)Close report — the design call is made, shipped, and proven offline
Ruled by agent under ADR 0174 — veto anytime. Two-way door: one revertible
commit in the broker's own ledger logic, proven by seam tests, nothing on the
one-way-door list. Commit
b9a3adfd.The ruling
The ticket asked for a design call between "a longer/backed-off retry budget" and
"an async retry loop independent of
Reap". I ruled neither, and both — theretry budget stays exactly where it is, and the async retry loop already exists.
The budget (
transientRetries= 3 × the 5s poll, ~15s) is correct: a persistentrefusal must surface fast rather than hang the caller, which is why it was written
small on purpose (#749/#751). Growing it only moves the cliff. The real defect is
that giving the lease up and completing its teardown are two different facts, and
only the second was ever recorded — so when the budget was exhausted,
Releasereturned its error and nothing was left holding the teardown.
And IDSS already runs a standing teardown loop:
RunReaper, every 5 minutes(
broker/cmd/broker/main.go:70). The only reason it could not help is that itreaped on one clock — the lease deadline — which was 24h out and being pushed
further out by the surviving box's own heartbeat (GOTCHAS #76). So the fix is to
record the owed teardown and let the reaper carry it, rather than bolt on a second
retry mechanism with its own lifecycle.
Shipped (
broker/internal/broker/rentals.go):Destroymarks the rentalReleaseOwedand persists it — anadditive
omitemptyfield, so the v1 ledger schema is unchanged and an olderbinary simply degrades to today's behaviour (no version bump, no migration).
It logs the still-live droplet's id and IP at ERROR: that is the
"operational alert" the ticket asked for — a stray billed box is never silent.
Reapreaps on either clock — lapsed lease OR owed teardown — so the5-minute pass is the retry loop and its interval is the backoff. What bounds
the orphan is now the length of the outage, not the length of the lease.
Renewrefuses a release-owed lease (ErrReleasing, 409 on the wire).Without this the fix would not hold: the control-plane runs ON the rented box,
so a box that survives its own release renews its own lease forever (#741) and
no deadline-based reaper ever fires.
The caller still gets its honest 502 (ADR 0100) — the release did not land —
now naming who is carrying the retry.
Proof
Red-before-green in
broker/internal/broker/rentals_release_owed_test.go(6 cases:owed on refusal + durable across a restart; reaped without waiting for the TTL;
still owed across three passes while the provider is down; renew refused and the
deadline unmoved; a hand-retry converges once DO answers; a clean release owes
nothing) plus the wire case in
http_rent_test.go(502 says "the teardown isowed", renew 409, 204 once DO answers). First run failed to build on the missing
field/error; the HTTP case then failed on
renew … = 502, want 409before themapping was wired.
go test ./...green,go vetclean,gofmtclean.b9a3adfd:seam✅,publish✅,publish-broker✅.Docs: ADR 0189 amended (third amendment, "a REFUSED teardown is owed, not
forgotten"), GOTCHAS #81,
broker/README.md,STATUS.md(lead + milestone log).The live orphan — destroyed
Droplet
594866531(idss-gateway-rehearsal-c-8544,168.144.165.255) wasstill
activewhen this session started. Destroyed;doctl compute droplet getnow 404s and
doctl compute droplet list --tag-name idss-rentalis empty.Ruled two-way: it is an
idss-gateway-rehearsal-*drive box — precisely theclass
scripts/rental-reap.shdestroys unattended, and its 8h drive wall wouldhave destroyed this one at ~04:47Z regardless. Bringing that decision forward
claims no authority the hourly sweep does not already hold, and destroying a
member-facing gateway (the actual one-way door) was never in play. No ledger or
DNS surgery was needed:
Rent's live-server probe (#652) and the reservation TTL(#754) both self-heal a stale
rehearsal-cbinding.On "does the sweep catch it sooner than 24h in practice?"
Checked, and the answer is yes but only by luck, and not during the outage that
matters:
47 * * * *, matou-workstation), and its 8hdrive wall — not the lease — is what would have caught this box, at ~04:47Z.
idss-rental-expires-<epoch>tag at all, confirming thedeployed broker still predates #741. So in production today the wall is the
only machine-side clock on a rented gateway.
rental-reap.logshows the 21:47Z sweep itself dying:CANNOT REAP — doctl could not list idss-rental droplets: … 504. During exactlythe window that mints the orphan, the machine-side backstop is down too. That is
why the fix had to land in the broker's own ledger rather than lean on the sweep.
Left open (named, not silently dropped)
idss-rental-expires-<epoch>tag still reads the pre-releasedeadline after a refused release, because re-stamping it needs the very provider
call that is failing. So the broker-independent sweep still judges such a box by
its 8h wall, not by an owed teardown it cannot see. Recorded in the ADR
amendment and GOTCHAS #81; deliberately not fixed by adding a second failing call
to an error path.
publish-broker✅ put theb9a3adfdbinary in theregistry, but no
broker-deployjob fired in the ~5 minutes after it, and theinstall leg is still gated on #690 (
ready-for-human: the droplet one-timesetup +
BROKER_DEPLOY_SSH_KEY). Pre-existing gate, Ben's hands, not opened here.rehearsal-c.idss.nz+ its wildcard resolve to a droplet DigitalOcean has taken back #758idss-rental-expires-tag on a LIVE rental once the broker actually deploys (#741's broker half is merged but not installed) #745idss-rental-expires-tag on a LIVE rental once the broker actually deploys (#741's broker half is merged but not installed) #745