Skip to content

Commit

Permalink
Up default Podman rlimits to avoid max open files
Browse files Browse the repository at this point in the history
Every port we open consumes an open FD. This can easily consume
all available FDs for the podman process. Set rlimits to resolve
this.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #1437
Approved by: rhatdan
  • Loading branch information
mheon authored and rh-atomic-bot committed Sep 13, 2018
1 parent 70b160a commit 9126b45
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmd/podman/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,17 @@ func main() {
logrus.SetLevel(level)
}

// Only if not rootless, set rlimits for open files.
// We open numerous FDs for ports opened
if os.Geteuid() == 0 {
rlimits := new(syscall.Rlimit)
rlimits.Cur = 1048576
rlimits.Max = 1048576
if err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, rlimits); err != nil {
return errors.Wrapf(err, "error setting new rlimits")
}
}

if logLevel == "debug" {
debug = true

Expand Down

0 comments on commit 9126b45

Please sign in to comment.