Skip to content

fix(pool): leases of cut-off starts stay noted until let go; a start waiting for its slot is not gone - #572

Merged
7schmiede merged 1 commit into
mainfrom
fix/lease-review
Nov 18, 2026
Merged

7schmiede merged 1 commit into
mainfrom
fix/lease-review

Conversation

@7schmiede

Copy link
Copy Markdown
Member

What and why

A code review before 0.49.4 (documented internally) found four flaws in the two pool fixes merged today, #565 (#567) and #563 (#566). Neither is released yet, so no changelog entry of its own.

  • A start waiting for its slot was ended as gone (node). start() sets the lease's stack file and then waits up to 120 s for the lane's last lease to take its containers down, before the lease is in starting. Two rounds without a container ended it. A lease whose slot is busy is no longer judged (gone_leases).
  • leasing.json holds a list. A new start wrote over the note of a lease whose release had not got through (its node did not answer), and that lease was forgotten.
  • A failed start keeps its lease's note when the release failed. Only a release or a 404 drops it, so the next daemon or start tries again.
  • A daemon releases only the leases noted when it started, read in lib.rs before the take-up thread and before a start through the API can note its own. Before, the take-up thread read the file after the (possibly slow) remote take-ups and could release the lease of an up begun meanwhile.

A note written by the first builds (one object, not a list) is still read.

Verification

Cause Lease state judged from part of it: a busy slot, a release that did not get through and a note read too late were not considered.
Bug class stale-state
Red node::tests::a_start_waiting_for_its_slot_is_not_gone (ended as gone), remote::tests::a_lease_whose_release_failed_stays_noted_beside_a_new_one (["l2"] instead of ["l1","l2"]), a_failed_start_keeps_its_note_until_its_lease_is_let_go (note gone), the_leases_left_by_an_earlier_daemon_are_the_only_ones_released (the new lease tried); all failed at their assertions before the fix.
Green cargo test -p devstack-node --lib 119, -p devstack-daemon --lib 223, clippy clean.
Siblings The node client's start waits for the start handler, which returns after the slot wait: no early "not running" there. followed.json stays one note (a lane follows one lease).

Refs #563, #565

🤖 Generated with Claude Code

…waiting for its slot is not gone

Review of #565 and #563 before 0.49.4:

- The node ended a lease as `gone` while its start waited (up to 120 s)
  for the lane's last lease to take its containers down: its stack file
  was set, its container not there yet and it not yet in `starting`. A
  lease whose slot is busy is no longer judged.
- `leasing.json` holds a list: a new start no longer writes over the
  note of a lease whose release did not get through (its node did not
  answer).
- A start that failed keeps its lease's note when the release did not
  get through (only a release or a 404 drops it), so the next daemon or
  start tries again.
- A daemon releases only the leases noted when it started, read before
  its API serves, not the note of a start begun through it since.

Bug-Class: stale-state

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@7schmiede
7schmiede merged commit 0d0da84 into main Nov 18, 2026
14 checks passed
@7schmiede
7schmiede deleted the fix/lease-review branch November 18, 2026 14:07
@7schmiede 7schmiede mentioned this pull request Nov 18, 2026
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