cgroupv2: fix Poststop hooks could not run when using systemd driver#2329
Closed
lifubang wants to merge 1 commit intoopencontainers:masterfrom
Closed
cgroupv2: fix Poststop hooks could not run when using systemd driver#2329lifubang wants to merge 1 commit intoopencontainers:masterfrom
lifubang wants to merge 1 commit intoopencontainers:masterfrom
Conversation
554de67 to
3d9c9d3
Compare
Signed-off-by: lifubang <lifubang@acmcoder.com>
lifubang
commented
Apr 20, 2020
| return err | ||
| unitName := getUnitName(m.Cgroups) | ||
| statusChan := make(chan string, 1) | ||
| if _, err := dbusConnection.StopUnit(unitName, "replace", statusChan); err == nil { |
Member
Author
There was a problem hiding this comment.
@kolyshkin
I think we may not need StopUnit method. Because if the init process has been exited, the cgroup path will be deleted by systemd automatically.
WDYT
Contributor
There was a problem hiding this comment.
Well, I think it is still needed, otherwise it will show up in systemctl output as "killed" or something like that (I haven't checked yet, just a hunch).
We can also take a look at crun implementation -- in there the unit is removed from systemd first, then killed. Might make more sense.
Contributor
|
@lifubang can you please rebase it? ( |
Member
Author
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.
How to reproduce:
The error is in here:
runc/libcontainer/state_linux.go
Lines 63 to 76 in bf0a8e1
If we got an error, the Poststop hooks could not run because the func has returned.
The reason is here:
runc/libcontainer/cgroups/utils.go
Lines 472 to 495 in bf0a8e1
Because we delete the cgroup paths value in cgroup manager when destroy.
Signed-off-by: lifubang lifubang@acmcoder.com