feat(node): periodic Reaper to GC orphaned VM resources#44
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
An unclean VM death (host OOM-kill, `:erlang.halt`, a crash before the FireVMM relaunch-time cleanup runs) can strand a firecracker cgroup leaf and a `hyper-rw-*` thin volume whose vm_id never reboots, so nothing ever clears them. Add `Hyper.Node.Reaper`, a periodic liveness-aware GC started last under `Hyper.Node`. Each tick it lists the cgroup leaves under the parent cgroup and the `hyper-rw-*` dm volumes, subtracts the VMs this node still runs (via the VM supervisor and the routing CRDT), and -- only after a leaf shows up orphaned on two consecutive ticks (`Plan.confirm/2`, so a VM mid-boot is never reaped) -- removes the chroot/cgroup via the helper and the dm volume. Entirely best-effort: every failure is logged and the next tick retries. The decision logic is the pure `Hyper.Node.Reaper.Plan` (rw_ids/orphans/confirm), covered by example + property tests; the GenServer is a thin shell around it. The tick interval is a fixed constant -- the two-strike confirmation already makes the exact value non-load-bearing, so nothing here is configurable. Also corrects `Jailer.cgroup_dir/1` to `<parent>/<id>` (no `<exec>` level): the jailer (cgroup v2, `--parent-cgroup`) places firecracker directly under the parent cgroup, confirmed via `/proc/<pid>/cgroup`. This also fixes the existing FireVMM teardown (`daemon.ex`), which removes the same leaf, and is what lets the Reaper enumerate leaves by listing the parent dir. Extracted from the VM-boot branch (chore/get-a-vm-running).
dbca262 to
c455162
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.