Merge pull request #3578 from sofat1989/containerd-stress

update the max if cur will be greater than max for setting the limit
This commit is contained in:
Phil Estes 2019-08-26 05:57:40 -07:00 committed by GitHub
commit 3ad49a208b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,6 +31,9 @@ func setRlimit() error {
} }
if limit.Cur < rlimit { if limit.Cur < rlimit {
limit.Cur = rlimit limit.Cur = rlimit
if limit.Max < limit.Cur {
limit.Max = limit.Cur
}
if err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, &limit); err != nil { if err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, &limit); err != nil {
return err return err
} }