Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
afbjorklund opened this issue Jun 8, 2021 · 6 comments
Open

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

afbjorklund opened this issue Jun 8, 2021 · 6 comments
Labels
co/docker-driver Issues related to kubernetes in container help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete.

Comments

@afbjorklund
Copy link
Collaborator

afbjorklund commented Jun 8, 2021

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

@afbjorklund afbjorklund added kind/bug Categorizes issue or PR as related to a bug. co/docker-driver Issues related to kubernetes in container labels Jun 8, 2021
@sharifelgamal sharifelgamal added the priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. label Jun 9, 2021
@sharifelgamal sharifelgamal added this to the 1.22.0-candidate milestone Jun 9, 2021
@sharifelgamal
Copy link
Collaborator

Yeah this seems like a simple fix, let's do it ASAP.

@sharifelgamal
Copy link
Collaborator

@daehyeok could you look at this?

@afbjorklund
Copy link
Collaborator Author

Will let someone look at this, wasn't so simple it seems.

@sharifelgamal sharifelgamal added the help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. label Sep 27, 2021
@spowelljr spowelljr modified the milestones: 1.24.0, 1.25.0-candidate Nov 5, 2021
@spowelljr spowelljr added priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. and removed priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. labels Dec 29, 2021
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 26, 2022
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels May 26, 2022
@sharifelgamal sharifelgamal added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. labels Jun 1, 2022
@sharifelgamal
Copy link
Collaborator

This remains an issue we'd like to fix.

@spowelljr spowelljr modified the milestones: 1.26.0, 1.27.0-candidate Jun 24, 2022
@spowelljr spowelljr modified the milestones: 1.27.0-previous, 1.29.0 Nov 28, 2022
@spowelljr spowelljr modified the milestones: 1.31.0, 1.32.0 Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
co/docker-driver Issues related to kubernetes in container help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete.
Projects
None yet
Development

No branches or pull requests

5 participants