Skip to content

app/: a killed run frees its build within 2 minutes (processing lock renewed while a run works; builds.process retries) - #124

Open
ndbroadbent wants to merge 1 commit into
mainfrom
app-processing-lock-heartbeat
Open

ndbroadbent wants to merge 1 commit into
mainfrom
app-processing-lock-heartbeat

Conversation

@ndbroadbent

@ndbroadbent ndbroadbent commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

On production, a deploy (ba6ede4) killed a builds.process run while it held its build's processing lock. That build, docspring/visualci #29 (PR #115's VisualCI build), stayed in processing for 20 minutes:

  • app/: processing holds no long transaction and no blob locks; ProcessBuild timeout fits big builds #118 holds the lock for 20 minutes, the job's whole timeout plus margin, and a killed worker never releases it;
  • the job's retry was refused, because builds.process allowed one try ("attempted more than its 1 tries allow");
  • every later run found the lock taken, left a note to run again and stepped aside, but only the dead run could have acted on that note;
  • nothing moved until the lock expired and the sweep picked the build up.

Changes

  • The lock is short and renewed. processing::exclusive holds the build for 2 minutes and renews the hold every 30 s while the run works. A live run keeps the build for as long as it needs; a killed one stops renewing, so its build is free within 2 minutes. If renewing fails or the hold lapses, that's logged as a warning.
  • builds.process gets 3 tries, with retries after 3 and then 5 minutes. The first retry waits out a killed run's 2-minute hold. A run that fails part-way still marks the build failed itself, so only a run that was cut off (killed, or timed out) comes back. The sweep stays as a backstop.
  • exclusive_with takes the hold's timing, so tests can use short ones. docs/design-storage.md describes the renewed lock.

Tests (app/tests/processing_lock.rs, with a 2 s hold renewed every 0.4 s):

  • a run that works for 4 s still holds the build at 3 s, so another run is refused, and the build is free once the run ends;
  • a dead run's hold, taken and never renewed, refuses others until it lapses, and then the build is free.

Checks: on agents-build-1, cargo fmt --check, cargo clippy --locked --all-targets -- -D warnings and the full cargo test --locked pass.


Prove it works
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…ock is renewed while a run works; builds.process gets 3 tries

A deploy killed a run holding its build's 20-minute processing lock, and its one try was spent, so the build sat in processing until the lock expired. The lock is now held for 2 minutes and renewed every 30 s; retries come after 3 and 5 minutes.
@ndbroadbent
ndbroadbent force-pushed the app-processing-lock-heartbeat branch from 6db8817 to f35b485 Compare December 3, 2026 07:55

This branch has not been deployed

No deployments
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