Skip to content

A restarted VM supervisor runs on a uid, NetId and budget that were already returned #209

Backlog

Description

@markovejnovic

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/fire_vmm.ex:85-94: the child spec is restart: :transient and its start arguments are the original Opts. lib/hyper/node.ex:152-158: the uid, the NetId and the Mutable are bound to the first pid.
  • Chain:
    1. A VM supervisor process exits abnormally.
    2. Its :DOWN frees the uid in Users, the NetId in Net and the reservation in Budget.Hard, and drops its hold on the Mutable.
    3. The node's DynamicSupervisor restarts the child from the same Opts: same uid, same NetId, same Mutable pid. Nothing binds or reserves for the new pid.
    4. The pools hand that uid and NetId to the next boot.
  • Effect: two VMs on one uid and one NetId, and a running VM the hard budget does not count.
  • Trigger: only the supervisor process itself dying abnormally. A crashing guest does not do it: a child crash loop ends the supervisor with :shutdown, which :transient does not restart.
  • Not traced: whether the restarted VM gets as far as booting on a Mutable whose only holder died.
  • Model: id_pool_small --step stepTransientRestart violates freedUnused, and placement_vm_respawn violates admittedWithinCapacity. The trace, from spec/ on that branch after npm ci:
    node_modules/.bin/quint run id_pool.qnt --main id_pool_small --step stepTransientRestart \
      --invariant freedUnused --max-samples 100000 --max-steps 40
  • Repro: not written. E2E: kill a VM supervisor pid with a reason other than :shutdown, boot another VM, and compare the uids and NetIds.
  • Fix: restart: :temporary, since a restart cannot re-claim what the first pid's death returned. Or have the supervisor claim its own ids in init/1. Related: uid and NetId are released even when teardown failed #152, Give each VM its own supervision subtree for its resources #97.
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