Files
OpenShell/docs
ShijuandJohn Myers 292c9c8d48 fix(vm): flush guest filesystem before a planned sandbox stop (#4195)
* fix(vm): flush guest filesystem before a planned sandbox stop

A planned stop of a MicroVM sandbox ended the VM before the guest wrote its dirty pages to disk, so files written shortly before the stop were missing after the next start.

The driver closed the host supervisor's parent-liveness pipe before it sent SIGTERM. The supervisor exits at once on that end-of-file, so it never ran its orderly shutdown: terminate the workload, then ask the guest to terminate. Signal the supervisor first, keep the pipe open until it has exited, and give it a grace period derived from the supervisor's own bounds and kept below the gateway's reclaim deadline.

In the guest runtime, syncfs the root filesystem after the process tree is terminated and before the termination is acknowledged, bounded to 3 seconds and best effort. Only the VM backend, which uses a vsock boundary listener, flushes; the container drivers share this runtime and are unchanged.

A sandbox whose main process has already exited is not covered.

Closes #4185

Signed-off-by: Shiju <shiju@nvidia.com>

* fix(vm): warn about unconfirmed flush after supervisor kill

Preserve the supervisor exit status so a planned stop warns when a signal
killed the supervisor and guest writeback was not confirmed. Keep normal
workload exit codes quiet, including 143 after a handled SIGTERM.

Extend the existing process tests to check the warning after a forced kill
and its absence after an orderly shutdown.

Refs #4185

Signed-off-by: Shiju <shiju@nvidia.com>

* fix(vm): satisfy shutdown timeout control-flow lint

Use if let for the single successful timeout pattern while preserving
the supervisor exit status and forced-kill error handling.

Signed-off-by: Shiju <shiju@nvidia.com>

* fix(vm): preserve shutdown merge resolutions during rebase

Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com>

* docs(vm): explain planned stop durability and flush limits

Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com>

---------

Signed-off-by: Shiju <shiju@nvidia.com>
Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com>
Co-authored-by: John Myers <9696606+johntmyers@users.noreply.github.com>
2026-10-20 09:18:31 +00:00
..