Skip to content

Deploy safety: builds sweep every minute, a stalled build restarts once nothing holds it, a 60 s hold (build 1069 sat 19 minutes after a deploy) - #202

Merged
ndbroadbent merged 2 commits into
mainfrom
dead-holder-restart
Dec 4, 2026
Merged

ndbroadbent merged 2 commits into
mainfrom
dead-holder-restart

Conversation

@ndbroadbent

@ndbroadbent ndbroadbent commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

Build 1069 sat in processing for about 19 minutes after the 10:07 deploy (the Status check fired at 10:18).

Cause (Loki, from talira infra)

  • The deploy killed a worker in the middle of its builds.process run, while that run held the build's processing lock.
  • The job's second attempt found the lock still held. The dead run's hold was 120 s from its last renewal. The attempt left the "run it again when you're done" note for the holder, and finished. The holder was dead, so nothing ran the build.
  • The only fallback was the sweep. It ran every 5 minutes and restarted a build after 10 minutes with no change, so the build recovered at about 10:25.

Fix

  • The sweep runs every minute.
  • It restarts a build 3 minutes after its last change, as long as nothing holds the build's processing lock. A live run renews its lock, so a build is never run twice.
  • A tighter hold: a run renews its lock every 15 s (was 30) and the lock lapses 60 s after the last renewal (was 120). A 45 s database stall could let another run take over a live one, which is safe because processing resumes from committed work.
  • The job's first retry waits 90 s (was 3 min), past a killed run's hold, so the retry itself usually takes the build.
  • Worst case after a kill: the sweep path is about 1 min for the lock to lapse, plus 3 min, plus 1 min: roughly 4-5 minutes, well below the Status check's 10 minutes.
  • The /status comment, the config docs and .env.example follow.

Tests

  • New: the_sweep_runs_a_stalled_build_again_once_nothing_holds_it. A build idle for 4 minutes whose lock is held isn't restarted; once the lock is released, it is. On main it fails ("nothing holds it now": 0 restarted).
  • The existing sweep test passes. fmt and clippy pass.
  • The whole app suite passes, apart from a test binary that once failed to boot because the build box's Postgres ran out of connections. It passed in other runs.

Not here: graceful worker shutdown on SIGTERM. A run that finishes or hands back its lock on a deploy would be better than this safety net. That needs work in the framework's queue worker, plus a longer grace period from infra; that's a follow-up.

@ndbroadbent ndbroadbent changed the title Builds sweep every minute; a stalled build restarts 3 minutes after its last change once nothing holds it (build 1069 sat 19 minutes after a deploy) Deploy safety: builds sweep every minute, a stalled build restarts once nothing holds it, a 60 s hold (build 1069 sat 19 minutes after a deploy) Dec 4, 2026
@visualci-com

visualci-com Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

VisualCI

docspring/visualci · build #686 · 510 unchanged · no changes

This PR vs base: 14 changed, 86 added since #616, across 2 builds

docspring/visualci · journeys · build #684 · 50 unchanged · no changes

This PR vs base: nothing since #612, across 2 builds

Updated as builds change. Agents can review with VisualCI's MCP tools.

…utes after its last change once nothing holds it (a killed run's next attempt found the dead hold and left; build 1069 sat 19 minutes)
…last renewal; the job's first retry waits 90 s, past a killed run's hold
@ndbroadbent
ndbroadbent merged commit fb76ae4 into main Dec 4, 2026
16 checks passed
@ndbroadbent
ndbroadbent deleted the dead-holder-restart branch December 4, 2026 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant