Repository navigation
fix(firecracker): VMs outlived their runs and snapshots - #52
Merged
Merged
Conversation
Every Firecracker run and every snapshot left its VM running. Teardown happens in box __fc, which already runs inside podman's user namespace, and inPodmanNS tried to enter that namespace again through nsenter: setns into the user namespace a process is already in fails with EINVAL, the error went to /dev/null, and crun kill never ran. Only box down, which runs on the host, stopped a VM. Each leaked VM held its RAM and kept its memory snapshot file alive; on the test machine ten of them pinned about 4 GB. inPodmanNS now runs the command directly when the process is already in the namespace. The escape suite gains a check that no VM outlives its run: it fails on the old binary (two VMs left, the snapshot's and the run's) and passes on all three backends with this fix. Present since the Firecracker backend landed in v0.3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Bug: every Firecracker run and every snapshot left its VM running. Present since the Firecracker backend landed in v0.3.
Cause
Teardown happens in
box __fc, which already runs inside podman's user namespace.Removekilled the VM throughinPodmanNS, which enters that namespace withnsenter --user --target <pause>. Entering the user namespace a process is already in fails:The error went to
/dev/null, socrun killnever ran. Onlybox down, which runs on the host, stopped a VM. Each leaked VM kept its RAM and its memory snapshot file alive; on the test machine ten of them (from builds and runs) pinned about 4 GB.Fix
inPodmanNSruns the command directly when the process is already inside the namespace (_CONTAINERS_USERNS_CONFIGUREDis set there, by podman and by box's ownnsenterpath). That fixes every caller, not just this one.Test
upone.up/down→ 0 Firecracker processes, 0 crun containers and 0 VM directories left.