Skip to content

An image lease is not a fence: a lapsed lease lets delete through under a live VM #208

Backlog

Description

@markovejnovic

Applies once #207 wires the lease. Found by model checking (the Quint specs in #206). A counterexample in the model, each step read in the code at e281a48. Not reproduced on a running system.

  • Where: lib/hyper/node/img.ex:133-147: the heartbeat discards a failed bump/3 and rescues a raised one. lib/hyper/img/db/lease.ex:22: 60 s TTL. lease.ex:56: the expiry is written from the VM node's clock. lib/hyper/img.ex:158: it is compared with the deleting node's clock.
  • Chain:
    1. A VM holds a lease and its node cannot reach Postgres for 60 s. Every heartbeat fails silently.
    2. The lease lapses. The VM keeps running.
    3. delete/1 finds no unexpired lease and unlinks the chain.
  • Effect: the same as No VM takes an image lease, so Img.delete/1 removes an image a VM is running from #207, behind a 60 s partition between one node and the database. Clock skew between the two nodes shortens or stretches that window.
  • Model: image_store_unfenced violates mountedChainsPresent. image_store_leased holds while heartbeats land in time. The trace, from spec/ on that branch after npm ci:
    node_modules/.bin/quint run image_store.qnt --main image_store_unfenced \
      --invariant mountedChainsPresent --max-samples 100000 --max-steps 40
  • Fix: a trade-off, since the heartbeat swallows failures on purpose (a DB hiccup must not stop a VM). Either a VM stops once its lease has lapsed unrenewed, or delete/1 needs evidence beyond the lease that no node has the image mounted. Independently of that, compute and compare the expiry with the database's now().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Fields

    No fields configured for issues without a type.

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions