Skip to content
docs
type to search↑↓ move↵ openesc close
v0.3.2github

Object-store execution lease

6 min readv0.3.2this page as markdown

The object-store execution lease lets control displace a copy of a sandbox without an operator’s fence. A node runs a placement only while it holds a lease object in the object store. This page is for operators who turn it on: what the host and control need, how authority and fencing work, its fault model and its request volume. It is an opt-in prototype, off on both host and control by default.

Nodes with the feature off keep the existing execution lease. There, a control outage prevents unasked restarts but does not stop sandboxes, and an operator supplies the fence before declaring a host lost. This object-store lease is separate.

Host and control setup

A lease host requires:

  • Linux cgroup v2 with cgroup.kill;
  • rootful Docker’s cgroupfs driver;
  • writable cgroup controls;
  • a host or hypervisor that does not suspend leased execution.

Drain or rest (archive) existing sandboxes before turning it on. The daemon refuses to start unless it can prepare the cgroups and start and fence a protected watchdog.

Install deploy/hermitboxd-store-lease.conf as the documented systemd drop-in and reload systemd. Configure Docker’s native.cgroupdriver=cgroupfs deliberately, on a drained host. The ordinary unit retains ProtectControlGroups=yes.

toml
[store_lease]
enabled = true
non_suspending_host = true
max_seconds = 60

On control, set HERMITBOX_STORE_LEASE=on. HERMITBOX_STORE_LEASE_SECONDS defaults to 30 and HERMITBOX_STORE_LEASE_RENEW_SECONDS to 10. The host enforces its maximum, and a renewal interval below half of the usable term.

Control uses its configured S3 store/runtime endpoint. At startup it probes conditional create, rejected duplicate create, conditional update, and rejected stale update. An incompatible store refuses enabled startup. Nodes must advertise store-lease in their accepted heartbeat before control sends POST /v1/workloads/{id}/store-lease with that epoch.

The new request/object schemas come from Rust and are generated into the node contract. No spec, label, original record field, public API field, or format-v1 name is renamed. Grants contain presigned read/write URLs held only in memory; their Debug output omits credentials.

URLs live for one day, and upkeep refreshes them. A longer control outage eventually expires them, and stops leased placements even if the store is reachable. Preserve the lease objects and disable bucket lifecycle rules for this prefix. Make sure no operator or external program overwrites or deletes them.

Authority and fencing

Each placement has a versioned object under deployment/store-leases/v1/workload.json, containing its node, fresh daemon session, epoch, generation and store-time expiry. Control conditionally creates/updates it before granting a node permission to run.

A feature-gated GET on the same endpoint supplies the current in-memory daemon session; a restart or disk clone cannot share the prior session’s live authority. The node GETs it, checks every identity field, and renews with If-Match from that GET. Failed or stale writes grant no time. A late reply cannot revive authority.

HTTP Date supplies store time; CLOCK_BOOTTIME supplies local deadlines anchored before the request. The node also checks the PUT response’s Date, refuses cached authority, and fences two seconds early for whole-second Date rounding and watchdog scheduling. The presigner leaves the changing If-Match header unsigned; transport and store conditional-write guarantees remain required.

A protected process outside hermitboxd’s service cgroup watches a stdin pipe and the boot clock. On EOF, invalid input or expiry, it freezes (cgroup.freeze) the placement’s parent cgroup and writes cgroup.kill, independently of Docker’s API and Tokio.

A root-only file lock and a preserved runtime directory serialize cgroup reuse across daemon restarts. The frozen parent prevents a Docker start that completes late from running a descendant. Starts, resumes, replacement restarts and exec need a live grant and the expected cgroup parent.

Existing unleased execution is killed on enabled startup. A parent monitor also fences if the watchdog exits. Deleting or fencing a copy ends renewal.

A stopped or suspended placement keeps its lease for a quick wake, and its request cost continues until rest, delete or fence. Graceful daemon upgrades and restarts can stop leased processes: drain or rest before maintenance.

Enabled hosts latch their policy in the non-secret store-lease-mode-v1 file. Disabling is refused until an operator drains or rests every copy, waits out all published terms, and deliberately removes that marker; restoring retained data then takes a new epoch. This prevents an ordinary configuration toggle from silently starting an old leased epoch without its fence.

Control never equates a network timeout with a fence. Once the store’s Date passes the last published expiry, control must win a conditional overwrite with an exact fence marker. A racing renewal wins instead or loses to that marker; both cannot win the same ETag.

Only then do a Postgres proof and displacement commit together. A crash between the store write and the database commit is recovered by recognizing that exact generation marker. The whole node is not marked lost.

Recovery uses a ready stored snapshot, excludes the prior host and takes a new epoch; missing snapshots or capacity leave the old data retained and placement displaced. Planned handoffs also wait out any remaining published term after the prior copy stops renewing.

Fault model and limits

This is an opt-in prototype for store/control partitions and daemon stalls or crashes on a trusted, non-suspending Linux host. It assumes the independent watchdog and kernel run within the reserved scheduling margin, and that the store supplies current Date plus linearizable conditional writes. It is not a hard real-time guarantee against:

  • an arbitrarily stalled kernel;
  • a suspended hypervisor;
  • a compromised host;
  • a live-memory VM clone;
  • an externally killed watchdog plus daemon;
  • an administrator disabling containment.

Whole-host suspension must stay disabled; use an external power fence before recovering such a host. non_suspending_host is an explicit host policy prerequisite, not a runtime proof of a hypervisor’s behavior. Do not enable automatic lease recovery where this fault model cannot hold. No fault measurements are published for it yet.

Request volume

The steady-state renewal count is two requests (GET and conditional PUT) per interval. That is 720 requests per placement-hour at the default ten seconds, excluding startup, failures, signing and upkeep. Control’s refresh adds two GETs per placement per minute (120 per hour), for 840 requests per placement-hour in all. These are calculations, not measurements. The watchdog and parent monitor have overhead of their own that is not profiled.

How this is tested

CI’s lease step runs after the other end-to-end suites on a disposable Ubuntu runner. It switches that runner’s Docker to cgroupfs, restarts its test stores, and runs:

shell
HERMITBOX_LEASE_E2E=1 \
  HERMITBOXD_SUDO=1 \
  HERMITBOXD_BIN=$PWD/target/debug/hermitboxd \
  DATABASE_URL="<database-url>" \
  S3_TEST_ENDPOINT=http://127.0.0.1:9000 \
  bun test control/e2e/store-lease.e2e.test.ts

It creates two real local nodes and cuts only root node traffic to a counting S3 proxy. It records three 15-second renewal windows and three stop samples, and asserts each stop precedes its ten-second term. It then conditionally fences the expired generation, and restores snapshot data on the other node under a higher epoch.

A separate case stops hermitboxd with SIGSTOP and observes Docker’s running state end while the daemon remains stopped. Raw counts, windows and nearest-rank p50/p90 go to JSON and the job summary.

run it yourself
$curl -fsSL https://hbx.sh | sh
or ask your agent
Install Hermitbox and set it up for me
Linux (x86_64 or aarch64), no root, no Docker. Agents can read every page: llms.txt · llms-full.txt
the floor · nothing below this line