fix(cmd): add ps command for containerd recovery#601
Open
sidneychang wants to merge 1 commit intourunc-dev:mainfrom
Open
fix(cmd): add ps command for containerd recovery#601sidneychang wants to merge 1 commit intourunc-dev:mainfrom
sidneychang wants to merge 1 commit intourunc-dev:mainfrom
Conversation
✅ Deploy Preview for urunc canceled.
|
5e34c4d to
358ca69
Compare
Add a runc-compatible `ps --format json` command to urunc.
containerd-shim-urunc-v2 reuses the runc shim manager and task
service. During containerd restart, the recovery path calls Pids(),
which eventually invokes the runtime binary as:
urunc ps --format json <container-id>
Without this command, containerd cannot obtain the host-visible PID
associated with the urunc task and may treat the shim as leaked.
Return the VMM / sandbox monitor PID stored in state.json as a []int,
matching the JSON format expected by containerd/go-runc and runc's ps
implementation. Keep the result as a slice so it can be extended later
if urunc supports multiple VMM or unikernel processes for one container.
Signed-off-by: sidneychang <2190206983@qq.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.
Description
Add a runc-compatible
ps --format jsoncommand to urunc.containerd-shim-urunc-v2 reuses the runc shim manager and task service. During containerd restart, the recovery path calls Pids(), which eventually invokes the runtime binary as:
Without this command, containerd cannot obtain the host-visible PID associated with the urunc task and may treat the shim as leaked.
Return the VMM / sandbox monitor PID stored in state.json as a []int, matching the JSON format expected by containerd/go-runc and runc's ps implementation. Keep the result as a slice so it can be extended later if urunc supports multiple VMM or unikernel processes for one container.
Related issues
How was this tested?
Before the fix
The urunc container was running before restarting containerd:
After restarting containerd:
the same container became Created:
The state stayed Created on the next check:
The urunc shim process was still alive:
After stopping and removing the container:
the shim was still left behind:
At that point, the container metadata had already disappeared:
This shows the failure mode before the fix: containerd restart caused the urunc container to fall from Up to Created, and cleanup left a live containerd-shim-urunc-v2 process behind.
After the fix
After replacing the binaries with the fixed version, a new urunc container was started:
The container was Up before restarting containerd:
After restarting containerd:
the container remained Up:
The container was then stopped and removed normally:
After removal, no urunc shim was left behind; only the grep process appeared:
LLM usage
ChatGPT
Checklist
make lint).make test_ctr,make test_nerdctl,make test_docker,make test_crictl).