aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArne Henrik Juul <arnej@yahooinc.com>2023-01-24 09:23:49 +0000
committerArne Henrik Juul <arnej@yahooinc.com>2023-01-24 09:23:49 +0000
commitd0964cbf4594e606a7e86b01669a9cf19c2381ba (patch)
tree86a640c3f6aaffafe9e1729bd1007933634d5ab0
parent0137c3fdae9171b370eae22c67e3ee4784b71f60 (diff)
* fix silly mistake for RLIMIT_CORE
* never adjust hard limits down * slight improvements in tracing
-rw-r--r--client/go/util/setrlimit.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/client/go/util/setrlimit.go b/client/go/util/setrlimit.go
index 71e5676a7a0..ba4d84fb18f 100644
--- a/client/go/util/setrlimit.go
+++ b/client/go/util/setrlimit.go
@@ -15,7 +15,7 @@ import (
type ResourceId int
const (
- RLIMIT_CORE ResourceId = unix.RLIMIT_AS
+ RLIMIT_CORE ResourceId = unix.RLIMIT_CORE
RLIMIT_NOFILE ResourceId = unix.RLIMIT_NOFILE
RLIMIT_NPROC ResourceId = unix.RLIMIT_NPROC
NO_RLIMIT uint64 = ^uint64(0)
@@ -41,6 +41,7 @@ func readableLimit(val uint64) string {
}
func SetResourceLimit(resource ResourceId, newVal uint64) {
+ trace.Debug("Wanted", newVal, "as limit for", resource.String())
var current unix.Rlimit
err := unix.Getrlimit(int(resource), &current)
if err != nil {
@@ -59,14 +60,13 @@ func SetResourceLimit(resource ResourceId, newVal uint64) {
newVal = current.Max
}
}
- if current.Cur < newVal {
- wanted.Cur = newVal
- }
+ wanted.Cur = newVal
err = unix.Setrlimit(int(resource), &wanted)
if err != nil {
- trace.Trace("Failed setting resource limit:", err)
- } else if (current.Cur != wanted.Cur) || (current.Max != wanted.Max) {
+ trace.Trace("Failed setting limit for", resource, ":", err)
+ } else {
trace.Debug("Resource limit", resource, "was:", readableLimit(current.Cur), "/", readableLimit(current.Max))
- trace.Trace("Resource limit", resource, "adjusted OK:", readableLimit(wanted.Cur), "/", readableLimit(wanted.Max))
+ _ = unix.Getrlimit(int(resource), &current)
+ trace.Trace("Resource limit", resource, "adjusted to:", readableLimit(current.Cur), "/", readableLimit(current.Max))
}
}