-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
runc delete -f: fix for cg v1 + paused container #3217
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -393,6 +393,14 @@ func (c *linuxContainer) Signal(s os.Signal, all bool) error { | |
if err := c.initProcess.signal(s); err != nil { | ||
return fmt.Errorf("unable to signal init: %w", err) | ||
} | ||
if status == Paused { | ||
// For cgroup v1, killing a process in a frozen cgroup | ||
// does nothing until it's thawed. Only thaw the cgroup | ||
// for SIGKILL. | ||
if s, ok := s.(unix.Signal); ok && s == unix.SIGKILL { | ||
_ = c.cgroupManager.Freeze(configs.Thawed) | ||
} | ||
} | ||
return nil | ||
} | ||
return ErrNotRunning | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Haven't tried, but what happens currently if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The logic for not allowing |
||
|
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.
Would've been nice to check if the cgroup manager is v1 or v2 here, but still LGTM.
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.
We are going to use cgroup.kill for v2 and hybrid hierarchies, this code is just to fix the issue
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.
Right, I get that -- my point is more that it would've been nice if we didn't thaw the cgroup unless we really had to.