Skip to content

fix(node, daemon): a lane on a node outlives a short absence of its requester (#379) - #380

Merged
7schmiede merged 2 commits into
mainfrom
fix/lease-grace
Oct 30, 2026
Merged

7schmiede merged 2 commits into
mainfrom
fix/lease-grace

Conversation

@fen89

@fen89 fen89 commented Oct 30, 2026

Copy link
Copy Markdown
Member

Fixes #379.

A node ended a lease 120 s after its last renewal, the client gave a lane up after 150 s without one, and a daemon starting after an unclean end released any lease it found in a lane's followed.json. So a reboot or sleep of the requester's machine lost every lane it had on nodes, along with the work running in them.

Review card (ADR-0070)

Approved by the owner in the conversation on 2026-10-30: points 1–4, with the defaults as proposed.

# Category Point What it beats What reversing it costs
1 contract A lease on a node lasts a grace period without renewal instead of 2 minutes: 60 min on a dedicated node, 15 min on one that isn't. A node policy key lease_grace_minutes changes it, and the strictest policy wins. Every reboot, sleep or network change kills all of a client's lanes on nodes. Low: one additive key, and setting it to 2 brings back today's behaviour.
2 concept A daemon that starts after an unclean end first renews a lane's lease. If the node still holds it, the daemon takes the lane up again (adopt), and releases the lease only if renewing fails. Amends ADR-0052 point 6. Point 6 would end a lane that is still running even with a long grace. Low: today's release path is still there.
3 contract The client gives a lane up only once the grace the node granted (expires in the renew answer) has run out, not after a fixed 150 s. A laptop waking from sleep would drop a lane the node still keeps. Low.
4 trust A client that disappears keeps its lanes' CPU, memory and disk admitted on the node for up to the grace. An admin's "end lease" still frees them at once. docs/pool.md says so. It also fixes the side effect in the issue: the lease keeps its room, so the lanes can't be refused after the reboot. Same as point 1.

Decided on my own:

  • No --detached mode: it would only be an unlimited grace.
  • No change to what a node keeps (ADR-0038 already keeps the data).
  • The followed.json note doesn't record the lane's profile or workers, so a re-attached lane doesn't get the main slot back.
  • The dashboard's policy form doesn't show the new key, just as it doesn't show keep_lanes_*.

Changes

  • devstack-node: lease_grace_minutes in NodePolicy (strictest takes the smaller), and Node::grace() used in admit and renew instead of TTL.
  • devstack-daemon: follow_renew waits as long as the node's grace, with 150 s as the minimum (nodes before this release). Lanes::unfollowed goes through take_up_remote, the same path a restart uses.
  • Docs: docs/pool.md, amendment notes in ADR-0026 and ADR-0052, the ADR index, CHANGELOG.

Tests

  • cargo clippy --workspace --all-targets -D warnings is clean.
  • cargo test -p devstack-node and cargo test -p devstack-daemon pass.
  • a_lane_is_leased_admitted_and_synced now asserts that a dedicated node grants about an hour.
  • Not tested end to end: rebooting a client while it has a lane on a real node.

fen89 and others added 2 commits October 30, 2026 09:54
…equester (#379)

A lease lived two minutes without renewals, so a reboot or sleep of the
requester's machine lost every lane it had on nodes. A lease now lives a
grace: an hour on a dedicated node, 15 minutes on another, or the node
policy's `lease_grace_minutes`. The daemon gives a lane up only after the
grace the node grants, and one starting after an unclean end follows its
lanes again while their leases run instead of releasing them.

Amends ADR-0026 point 5 and ADR-0052 point 6.
#379)

The lane's lease outlives the daemon's crash by the node's grace now, so
the next daemon follows the lane again instead of saying it is gone; the
test stops it afterwards to leave the node clear for the steps that follow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@7schmiede
7schmiede merged commit 0f0efc2 into main Oct 30, 2026
13 checks passed
@7schmiede
7schmiede deleted the fix/lease-grace branch October 30, 2026 10:37
@7schmiede 7schmiede mentioned this pull request Oct 30, 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.

Remote lanes are torn down when the client is offline for a few minutes (reboot), running work lost

2 participants