Skip to content
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

runtime: check for pause pid existence #12111

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion libpod/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,11 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (retErr error) {
return err
}
if became {
utils.MovePauseProcessToScope(pausePid)
// Check if the pause process was created. If it was created, then
// move it to its own systemd scope.
if _, err = os.Stat(pausePid); err == nil {
utils.MovePauseProcessToScope(pausePid)
}
os.Exit(ret)
}
}
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/system_reset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ var _ = Describe("podman system reset", func() {
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))

Expect(session.ErrorToString()).To(Not(ContainSubstring("Failed to add pause process")))

// If remote then the API service should have exited
// On local tests this is a noop
podmanTest.StartRemoteService()
Expand Down
4 changes: 2 additions & 2 deletions utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ func moveProcessToScope(pidPath, slice, scope string) error {
func MovePauseProcessToScope(pausePidPath string) {
err := moveProcessToScope(pausePidPath, "user.slice", "podman-pause.scope")
if err != nil {
unified, err := cgroups.IsCgroup2UnifiedMode()
if err != nil {
unified, err2 := cgroups.IsCgroup2UnifiedMode()
if err2 != nil {
logrus.Warnf("Failed to detect if running with cgroup unified: %v", err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be err2

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in this case we want to report the original error of moving the PID to a different scope

}
if RunsOnSystemd() && unified {
Expand Down