Skip to content

fix(vm): spare a stopped origin when the restore kill step fails#92

Merged
CMGS merged 1 commit into
masterfrom
fix/wake-liveness-scan-brick
Jul 6, 2026
Merged

fix(vm): spare a stopped origin when the restore kill step fails#92
CMGS merged 1 commit into
masterfrom
fix/wake-liveness-scan-brick

Conversation

@CMGS

@CMGS CMGS commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Closes #91.

What

KillForRestore marked the VM error on any non-ErrNotRunning failure — including WithRunningVM's fail-closed /proc-scan error, which is a false liveness-unknown for a hibernated VM (its VMM is provably gone: hibernate's own terminate failure already marks error, so stopped implies no VMM). A transient procfs hiccup at wake therefore bricked the VM permanently: ResolveForRestore refuses error state, and nothing on disk had been mutated. Route the failure through FailRestore (#89's origin-aware helper) instead:

  • stopped origin (hibernate wake): spared — stays stopped, wake retries converge
  • running origin (in-place revert): unchanged — a failed kill of a live VMM still quarantines

Plus a one-word FailRestore doc fix ("post-kill" → "restore-path": it now also guards the kill step itself; the origin-provenance note is unchanged and still holds — the kill step is pre-kill).

Deliberately accepted corner

A stopped record with a genuinely live VMM (half-failed vm start) whose kill fails is now also spared: restore aborts before any mutation either way (no double-VMM risk), and sparing lets the next wake retry the kill instead of welding shut a record that was already lying. A sentinel-error split in WithRunningVM (scan-error vs real kill failure) was evaluated and rejected as overdesign — it would touch a primitive shared by stop/delete/start to sharpen behavior only in this should-never-happen corner.

Verification

  • TestKillForRestoreFailureKeepsOriginContract (reuses the stub-VMM harness; injects a failing terminate — the /proc-scan branch itself isn't unit-reachable, but both branches converge on the one changed marking site): stopped→stays stopped, running→error
  • Negative-tested: with the fix stashed the stopped case FAILs; restored it PASSes
  • make lint 0 issues ×2 GOOS, full suite 25 pkgs green

KillForRestore marked the VM error on any non-ErrNotRunning failure,
including WithRunningVM's fail-closed /proc-scan error. For a hibernated
(stopped) VM the VMM is provably gone — hibernate marks error if its
terminate fails — so a transient scan hiccup during wake bricked a
perfectly restorable VM: ResolveForRestore refuses error state, and
nothing on disk had been touched. Route the failure through FailRestore
(#89's origin-aware helper): stopped origins stay stopped and the wake
remains retryable; a failed kill of a genuinely live VMM on a running
origin still quarantines.

Closes #91
@CMGS CMGS merged commit 9d11a0f into master Jul 6, 2026
4 checks passed
@CMGS CMGS deleted the fix/wake-liveness-scan-brick branch July 6, 2026 09:27
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.

restore: a transient /proc-scan error during a hibernated-VM wake bricks it via MarkError

1 participant