Skip to content

The check for memory limits is currently broken for cgroups v1 #11609

Open
@afbjorklund

Description

@afbjorklund

Currently it checks "" (empty string), if cgroup2 is false:

// HasMemoryCgroup checks whether it is possible to set memory limit for cgroup.
func HasMemoryCgroup() bool {
        memcg := true
        if runtime.GOOS == "linux" {
                var memory string
                if cgroup2, err := IsCgroup2UnifiedMode(); err == nil && cgroup2 {
                        memory = "/sys/fs/cgroup/memory/memsw.limit_in_bytes"
                }
                if _, err := os.Stat(memory); os.IsNotExist(err) {
                        klog.Warning("Your kernel does not support memory limit capabilities or the cgroup is not mounted.")
                        memcg = false
                }
        }
        return memcg
}

Since 7b0bf57

Most likely the code is also wrong for cgroups v2 as well ?

The end result is no memory limits, for the docker driver.

Seems to be the same issue as in #10935

Metadata

Metadata

Assignees

No one assigned

    Labels

    co/docker-driverIssues related to kubernetes in containerhelp wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/bugCategorizes issue or PR as related to a bug.lifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness.priority/important-longtermImportant over the long term, but may not be staffed and/or may need multiple releases to complete.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions