all repos — honk @ 8a0d7362a4559a898070f54293d6062e4983906c

my fork of honk

set rlimit in backend
Ted Unangst tedu@tedunangst.com
Mon, 15 Mar 2021 14:11:31 -0400
commit

8a0d7362a4559a898070f54293d6062e4983906c

parent

796aa4e8d07547dc7f9ab17e45ae77b5bf1e43b6

2 files changed, 11 insertions(+), 0 deletions(-)

jump to
M backend.gobackend.go

@@ -94,6 +94,10 @@ lis, err := net.Listen("unix", sockname)

if err != nil { 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 { h() }
M sensors.gosensors.go

@@ -41,3 +41,10 @@ sensors.CPU = time.Duration(usage.Utime.Nano()).Seconds()

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) +}