set rlimit in backend

This commit is contained in:
Ted Unangst 2021-03-15 14:11:31 -04:00
parent bd39a9c2bc
commit 0e4aa4db19
2 changed files with 11 additions and 0 deletions

View File

@ -94,6 +94,10 @@ func backendServer() {
if err != nil { if err != nil {
log.Panicf("unable to register shrinker: %s", err) log.Panicf("unable to register shrinker: %s", err)
} }
err = setLimits()
if err != nil {
log.Printf("error setting backend limits: %s", err)
}
for _, h := range backendhooks { for _, h := range backendhooks {
h() h()
} }

View File

@ -41,3 +41,10 @@ func getSensors() Sensors {
return sensors return sensors
} }
func setLimits() error {
var limit syscall.Rlimit
limit.Cur = 2 * 1024 * 1024 * 1024
limit.Max = 2 * 1024 * 1024 * 1024
return syscall.Setrlimit(syscall.RLIMIT_DATA, &limit)
}