raw_exec: oom_score_adj support (#23308)

This commit is contained in:
Piotr Kazmierczak
2024-06-14 11:36:27 +02:00
committed by GitHub
parent 94bb91ab80
commit 85430be6dd
11 changed files with 145 additions and 82 deletions

3
.changelog/23308.txt Normal file
View File

@@ -0,0 +1,3 @@
```release-note:improvement
raw_exec: Added support for oom_score_adj
```

View File

@@ -90,6 +90,7 @@ var (
"args": hclspec.NewAttr("args", "list(string)", false),
"cgroup_v2_override": hclspec.NewAttr("cgroup_v2_override", "string", false),
"cgroup_v1_override": hclspec.NewAttr("cgroup_v1_override", "list(map(string))", false),
"oom_score_adj": hclspec.NewAttr("oom_score_adj", "number", false),
})
// capabilities is returned by the Capabilities RPC and indicates what
@@ -156,6 +157,9 @@ type TaskConfig struct {
//
// * All resource isolation guarantees are lost FOR ALL TASKS if set *
OverrideCgroupV1 hclutils.MapStrStr `codec:"cgroup_v1_override"`
// OOMScoreAdj sets the oom_score_adj on Linux systems
OOMScoreAdj int `codec:"oom_score_adj"`
}
// TaskState is the state which is encoded in the handle returned in
@@ -324,6 +328,10 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive
return nil, nil, fmt.Errorf("failed to decode driver config: %v", err)
}
if driverConfig.OOMScoreAdj < 0 {
return nil, nil, fmt.Errorf("oom_score_adj must not be negative")
}
d.logger.Info("starting task", "driver_cfg", hclog.Fmt("%+v", driverConfig))
handle := drivers.NewTaskHandle(taskHandleVersion)
handle.Config = cfg
@@ -353,6 +361,7 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive
Resources: cfg.Resources.Copy(),
OverrideCgroupV2: cgroupslib.CustomPathCG2(driverConfig.OverrideCgroupV2),
OverrideCgroupV1: driverConfig.OverrideCgroupV1,
OOMScoreAdj: int32(driverConfig.OOMScoreAdj),
}
// ensure only one of cgroups_v1_override and cgroups_v2_override have been

View File

@@ -163,6 +163,10 @@ type ExecCommand struct {
//
// * All resource isolation guarantees are lost FOR ALL TASKS if set *
OverrideCgroupV1 map[string]string
// OOMScoreAdj allows setting oom_score_adj (likelihood of process being
// OOM killed) on Linux systems
OOMScoreAdj int32
}
func (c *ExecCommand) getCgroupOr(controller, fallback string) string {

View File

@@ -121,8 +121,8 @@ func (e *UniversalExecutor) statCG(cgroup string) (int, func(), error) {
func (e *UniversalExecutor) configureResourceContainer(command *ExecCommand, pid int) (func(), error) {
cgroup := command.StatsCgroup()
// ensure tasks do not inherit Nomad agent oom_score_adj value
if err := e.setOomAdj(); err != nil {
// ensure tasks get the desired oom_score_adj value set
if err := e.setOomAdj(command.OOMScoreAdj); err != nil {
return nil, err
}
@@ -280,12 +280,10 @@ func (e *UniversalExecutor) configureCG2(cgroup string, command *ExecCommand) {
_ = ed.Write("cpuset.cpus", cpusetCpus)
}
func (e *UniversalExecutor) setOomAdj() error {
// children should not inherit Nomad agent oom_score_adj value
//
func (e *UniversalExecutor) setOomAdj(oomScore int32) error {
// /proc/self/oom_score_adj should work on both cgroups v1 and v2 systems
// range is -1000 to 1000; 0 is the default
return os.WriteFile("/proc/self/oom_score_adj", []byte("0"), 0644)
return os.WriteFile("/proc/self/oom_score_adj", []byte(strconv.Itoa(int(oomScore))), 0644)
}
func (*UniversalExecutor) computeCPU(command *ExecCommand) uint64 {

View File

@@ -7,6 +7,9 @@ package executor
import (
"fmt"
"os"
"strconv"
"strings"
"testing"
"github.com/hashicorp/nomad/ci"
@@ -99,3 +102,28 @@ func TestExecutor_InvalidCgroup(t *testing.T) {
must.ErrorContains(t, err, "unable to configure cgroups: no such file or directory")
}
func TestUniversalExecutor_setOomAdj(t *testing.T) {
ci.Parallel(t)
factory := universalFactory
testExecCmd := testExecutorCommand(t)
execCmd, allocDir := testExecCmd.command, testExecCmd.allocDir
execCmd.Cmd = "sleep"
execCmd.Args = []string{"infinity"}
execCmd.OOMScoreAdj = 1000
factory.configureExecCmd(t, execCmd)
defer allocDir.Destroy()
executor := factory.new(testlog.HCLogger(t), compute)
defer executor.Shutdown("", 0)
p, err := executor.Launch(execCmd)
must.NoError(t, err)
oomScore, err := os.ReadFile(fmt.Sprintf("/proc/%d/oom_score_adj", p.Pid))
must.NoError(t, err)
oomScoreInt, _ := strconv.Atoi(strings.TrimSuffix(string(oomScore), "\n"))
must.Eq(t, execCmd.OOMScoreAdj, int32(oomScoreInt))
}

View File

@@ -54,6 +54,7 @@ func (c *grpcExecutorClient) Launch(cmd *ExecCommand) (*ProcessState, error) {
Capabilities: cmd.Capabilities,
CgroupV2Override: cmd.OverrideCgroupV2,
CgroupV1Override: cmd.OverrideCgroupV1,
OomScoreAdj: cmd.OOMScoreAdj,
}
resp, err := c.client.Launch(ctx, req)
if err != nil {

View File

@@ -43,6 +43,7 @@ func (s *grpcExecutorServer) Launch(ctx context.Context, req *proto.LaunchReques
Capabilities: req.Capabilities,
OverrideCgroupV2: req.CgroupV2Override,
OverrideCgroupV1: req.CgroupV1Override,
OOMScoreAdj: req.OomScoreAdj,
})
if err != nil {

View File

@@ -48,6 +48,7 @@ type LaunchRequest struct {
Capabilities []string `protobuf:"bytes,19,rep,name=capabilities,proto3" json:"capabilities,omitempty"`
CgroupV2Override string `protobuf:"bytes,20,opt,name=cgroup_v2_override,json=cgroupV2Override,proto3" json:"cgroup_v2_override,omitempty"`
CgroupV1Override map[string]string `protobuf:"bytes,21,rep,name=cgroup_v1_override,json=cgroupV1Override,proto3" json:"cgroup_v1_override,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
OomScoreAdj int32 `protobuf:"varint,22,opt,name=oom_score_adj,json=oomScoreAdj,proto3" json:"oom_score_adj,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@@ -226,6 +227,13 @@ func (m *LaunchRequest) GetCgroupV1Override() map[string]string {
return nil
}
func (m *LaunchRequest) GetOomScoreAdj() int32 {
if m != nil {
return m.OomScoreAdj
}
return 0
}
type LaunchResponse struct {
Process *ProcessState `protobuf:"bytes,1,opt,name=process,proto3" json:"process,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@@ -900,80 +908,82 @@ func init() {
}
var fileDescriptor_66b85426380683f3 = []byte{
// 1163 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x6b, 0x8f, 0xdb, 0x44,
0x17, 0xae, 0x37, 0xbb, 0xb9, 0x9c, 0x24, 0xbb, 0xe9, 0xbc, 0x6d, 0x5f, 0x37, 0x08, 0x75, 0x31,
0x12, 0x8d, 0xa0, 0x78, 0xdb, 0xf4, 0x2a, 0x90, 0x28, 0xea, 0xb6, 0xa0, 0xaa, 0x17, 0x56, 0xde,
0xd2, 0x4a, 0x7c, 0xc0, 0x4c, 0xed, 0x69, 0x32, 0x8a, 0xe3, 0x31, 0x33, 0xe3, 0x74, 0x57, 0x42,
0xe2, 0x4f, 0x80, 0xc4, 0x0f, 0xe0, 0x33, 0xbf, 0x11, 0xcd, 0xcd, 0x9b, 0x6c, 0x4b, 0xe5, 0x14,
0xf1, 0x29, 0x33, 0x8f, 0x9f, 0x73, 0x9b, 0x33, 0xe7, 0x99, 0xc0, 0x95, 0x94, 0xd3, 0x05, 0xe1,
0x62, 0x4f, 0x4c, 0x31, 0x27, 0xe9, 0x1e, 0x39, 0x22, 0x49, 0x29, 0x19, 0xdf, 0x2b, 0x38, 0x93,
0xac, 0xda, 0x86, 0x7a, 0x8b, 0x3e, 0x99, 0x62, 0x31, 0xa5, 0x09, 0xe3, 0x45, 0x98, 0xb3, 0x39,
0x4e, 0xc3, 0x22, 0x2b, 0x27, 0x34, 0x17, 0xe1, 0x2a, 0x6f, 0x78, 0x69, 0xc2, 0xd8, 0x24, 0x23,
0xc6, 0xc9, 0xcb, 0xf2, 0xd5, 0x9e, 0xa4, 0x73, 0x22, 0x24, 0x9e, 0x17, 0x96, 0x10, 0x58, 0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xd5, 0xbf, 0xff, 0xa7,
0xe4, 0x4d, 0xdf, 0x7f, 0x35, 0x86, 0xf5, 0xef, 0xff, 0x92, 0x1c, 0xd6, 0xbf, 0xff, 0xcb, 0xb2,
0x16, 0x9c, 0x41, 0x7f, 0x78, 0xd0, 0x57, 0xd0, 0xa1, 0xe4, 0x04, 0xcf, 0x69, 0x3e, 0x41, 0x77,
0x6b, 0x6a, 0xbb, 0xb2, 0x32, 0xfa, 0x6e, 0x2d, 0x5d, 0x2a, 0x5f, 0xbf, 0xbf, 0x03, 0x97, 0xd6,
0xc8, 0xbb, 0xea, 0xdd, 0x6b, 0xfd, 0xb0, 0x65, 0x24, 0xad, 0xa9, 0x7f, 0xae, 0xff, 0x1d, 0x00,
0x00, 0xff, 0xff, 0x86, 0x06, 0x47, 0x8b, 0x85, 0x0d, 0x00, 0x00,
// 1187 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x7d, 0x6f, 0xdb, 0x44,
0x1c, 0x9e, 0x9b, 0xa6, 0x49, 0x7e, 0x49, 0xda, 0xec, 0xd8, 0x8a, 0x17, 0x84, 0x56, 0x8c, 0xc4,
0x22, 0x18, 0xee, 0xd6, 0xbd, 0x0a, 0x24, 0x06, 0xeb, 0x06, 0x9a, 0xf6, 0x42, 0xe5, 0x8e, 0x4d,
0xe2, 0x0f, 0xcc, 0xcd, 0xbe, 0x25, 0xb7, 0x38, 0x3e, 0x73, 0x77, 0xce, 0x5a, 0x09, 0x89, 0x2f,
0x01, 0x12, 0x1f, 0x80, 0x4f, 0xc4, 0x27, 0x42, 0xf7, 0xe6, 0x26, 0xdd, 0x98, 0xdc, 0x22, 0xfe,
0xca, 0xdd, 0xe3, 0xe7, 0xf7, 0x7e, 0xf7, 0x5c, 0xe0, 0x72, 0xca, 0xe9, 0x9c, 0x70, 0xb1, 0x2d,
0x26, 0x98, 0x93, 0x74, 0x9b, 0x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,
0xaa, 0x82, 0xfe, 0x06, 0x6d, 0x77, 0xdb, 0xd1, 0xad, 0xba, 0x3e, 0x8e, 0xa9, 0xcd, 0xf0, 0xf6,
0xc9, 0x0d, 0xab, 0x04, 0x7e, 0xf7, 0x60, 0xe3, 0xd8, 0x8d, 0x47, 0x5f, 0xd5, 0xf5, 0xf7, 0x76,
0x51, 0x1a, 0xde, 0x39, 0xb5, 0x7d, 0x95, 0xd6, 0xaf, 0xd0, 0xb2, 0xd2, 0x82, 0x6a, 0x4f, 0x74,
0x59, 0x9d, 0x86, 0xb7, 0x4e, 0x6c, 0x57, 0x45, 0x3f, 0x80, 0xa6, 0x96, 0x0d, 0x54, 0x7b, 0xac,
0x8b, 0xd2, 0x36, 0xbc, 0x71, 0x42, 0x2b, 0x17, 0xf7, 0x8a, 0xa7, 0xce, 0xbf, 0xd1, 0x9d, 0xfa,
0xe7, 0x7f, 0x49, 0xd0, 0xea, 0x9f, 0xff, 0x63, 0xf2, 0xa6, 0xcf, 0xbf, 0xba, 0x86, 0xf5, 0xcf,
0xff, 0x82, 0x1c, 0xd6, 0x3f, 0xff, 0x8b, 0xb2, 0x16, 0x9c, 0x41, 0x7f, 0x7a, 0xd0, 0x57, 0xd0,
0xbe, 0xe4, 0x04, 0xcf, 0x68, 0x3e, 0x46, 0x77, 0x6a, 0x6a, 0xbb, 0xb2, 0x32, 0xfa, 0x6e, 0x2d,
0x5d, 0x2a, 0x5f, 0x9f, 0xde, 0x81, 0x4b, 0x6b, 0xe4, 0x5d, 0xf1, 0xee, 0xb6, 0x7e, 0x6c, 0x1a,
0x49, 0x5b, 0xd3, 0x3f, 0xd7, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0xd2, 0x85, 0x8d, 0xe6, 0xa9,
0x0d, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.

View File

@@ -52,6 +52,7 @@ message LaunchRequest {
repeated string capabilities = 19;
string cgroup_v2_override = 20;
map<string,string> cgroup_v1_override = 21;
int32 oom_score_adj = 22;
}
message LaunchResponse {

View File

@@ -408,7 +408,12 @@ type LinuxResources struct {
CPUQuota int64
CPUShares int64
MemoryLimitBytes int64
OOMScoreAdj int64
// OOMScoreAdj field in LinuxResources is never used and left for
// compatibility reasons. Docker, raw_exec and exec2 drivers allow tasks to
// set per-task oom_score_adj values using their own TaskConfig OOMScoreAdj
// fields
OOMScoreAdj int64
CpusetCpus string
CpusetCgroupPath string

View File

@@ -50,6 +50,9 @@ The `raw_exec` driver supports the following configuration in the job spec:
~> The `task.user` field cannot be set on a Task using the `raw_exec` driver if
the Nomad client has been hardened according to the [production][hardening] guide.
- `oom_score_adj` - (Optional) A positive integer to indicate the likelihood of
the task being OOM killed (valid only for Linux). Defaults to 0.
## Examples
To run a binary present on the Node:
@@ -152,7 +155,7 @@ manage the process tree. Cgroups are used on Linux when Nomad is being run with
appropriate privileges, and the cgroup system is mounted.
If the cluster is configured with memory oversubscription enabled, a task using
the `raw_exec` driver can be configured to have no maximum memory limit by
the `raw_exec` driver can be configured to have no maximum memory limit by
setting `memory_max = -1`.
```hcl