Skip to content

Commit

Permalink
runtime: check for pause pid existence
Browse files Browse the repository at this point in the history
check that the pause pid exists before trying to move it to a separate
scope.

Closes: containers#12065

Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed Oct 27, 2021
1 parent 825889c commit 6b3b0a1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
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

0 comments on commit 6b3b0a1

Please sign in to comment.