New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: add retry for killing container with host pidns #4164
base: main
Are you sure you want to change the base?
Conversation
ee034a4
to
c9fd3bd
Compare
Signed-off-by: lifubang <lifubang@acmcoder.com>
c9fd3bd
to
952cec9
Compare
# Make sure all processes are gone. | ||
pids=$(cat "$cgpath"/cgroup.procs) || true # OK if cgroup is gone | ||
echo "pids: $pids" | ||
if [ -n "$pids" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: no need for this condition
while [ $retry -lt 10 ] && [ -n "$pids" ]; do | ||
# Make sure all processes are gone. | ||
pids=$(cat "$cgpath"/cgroup.procs) || true # OK if cgroup is gone | ||
echo "pids: $pids" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd add retry counter here, e.g.
echo "try $retry; pids: $pids"
pids=$(cat "$cgpath"/cgroup.procs) || true # OK if cgroup is gone | ||
echo "pids: $pids" | ||
retry=0 | ||
while [ $retry -lt 10 ] && [ -n "$pids" ]; do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can do
while [ $((retry++)) -lt 10 ] && [ -n "$pids" ]; do
When testing kill container with host pidns:
stopped
, so no need to wait it becomesstopped
after killing;runc kill cid KILL
, there are still some process exists in the cgroup if we view it immediately, so add a retry to wait all processes gone.Fix: #4163