Merge pull request #843 from aledbf/low-fs-max

Avoid setting maximum number of open file descriptors lower than 1024
This commit is contained in:
Manuel Alejandro de Brito Fontes 2017-06-12 16:42:36 -04:00 committed by GitHub
commit ff6b713caf

View file

@ -459,11 +459,13 @@ func (n *NGINXController) OnUpdate(ingressCfg ingress.Configuration) error {
// the limit of open files is per worker process // the limit of open files is per worker process
// and we leave some room to avoid consuming all the FDs available // and we leave some room to avoid consuming all the FDs available
wp, err := strconv.Atoi(cfg.WorkerProcesses) wp, err := strconv.Atoi(cfg.WorkerProcesses)
glog.V(3).Infof("number of worker processes: %v", wp)
if err != nil { if err != nil {
wp = 1 wp = 1
} }
maxOpenFiles := (sysctlFSFileMax() / wp) - 1024 maxOpenFiles := (sysctlFSFileMax() / wp) - 1024
if maxOpenFiles < 0 { glog.V(3).Infof("maximum number of open file descriptors : %v", sysctlFSFileMax())
if maxOpenFiles < 1024 {
// this means the value of RLIMIT_NOFILE is too low. // this means the value of RLIMIT_NOFILE is too low.
maxOpenFiles = 1024 maxOpenFiles = 1024
} }