Skip to content

cri: fix memory.memsw.limit_in_bytes: no such file or directory #7836

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

Merged
merged 1 commit into from
Dec 19, 2022

Conversation

AkihiroSuda
Copy link
Member

Skip automatic if swapLimit == 0 { s.Linux.Resources.Memory.Swap = &limit } when the swap controller is missing. (default on Ubuntu 20.04)

Fix #7828 (regression in PR #7783 "cri: make swapping disabled with memory limit")

@AkihiroSuda AkihiroSuda added area/cri Container Runtime Interface (CRI) cherry-pick/1.6.x Change to be cherry picked to release/1.6 branch labels Dec 19, 2022
Skip automatic `if swapLimit == 0 { s.Linux.Resources.Memory.Swap = &limit }` when the swap controller is missing.
(default on Ubuntu 20.04)

Fix issue 7828 (regression in PR 7783 "cri: make swapping disabled with memory limit")

Signed-off-by: Akihiro Suda <[email protected]>
Copy link
Contributor

@MikeZappa87 MikeZappa87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for your error messages.

@dmcgowan dmcgowan merged commit 8f7cfbd into containerd:main Dec 19, 2022
@dmcgowan dmcgowan added cherry-picked/1.6.x PR commits are cherry-picked into release/1.6 branch and removed cherry-pick/1.6.x Change to be cherry picked to release/1.6 branch labels Dec 19, 2022
Copy link
Member

@mikebrow mikebrow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have to be fast around here to get in a code review :-O

@@ -449,7 +481,7 @@ func WithResources(resources *runtime.LinuxContainerResources, tolerateMissingHu
if limit != 0 {
s.Linux.Resources.Memory.Limit = &limit
// swap/memory limit should be equal to prevent container from swapping by default
if swapLimit == 0 {
if swapLimit == 0 && swapControllerAvailable() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about line 488 below?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the merged commit is to a regression.. my question is more to the question of how far down the chain should we go to find the setup error for a pod with a swap limit set on a node that doesn't have swap enabled..

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have the same question but the line was not touched in #7783 so I left it as-is. Can be discussed in a separate issue/PR.

@zhsj
Copy link
Contributor

zhsj commented Dec 20, 2022

@AkihiroSuda I got failed TestUpdateOCILinuxResource when upgrading containerd to 1.6.14.

The reason is I'm building containerd in schroot, which doesn't have cgroup. So swapControllerAvailable is false. However TestUpdateOCILinuxResource expects a non nil swap value.

I'm not sure how best we can fix that. swapControllerAvailable is not exported to pkg/cri/server.

@AkihiroSuda
Copy link
Member Author

@AkihiroSuda I got failed TestUpdateOCILinuxResource when upgrading containerd to 1.6.14.

The reason is I'm building containerd in schroot, which doesn't have cgroup. So swapControllerAvailable is false. However TestUpdateOCILinuxResource expects a non nil swap value.

I'm not sure how best we can fix that. swapControllerAvailable is not exported to pkg/cri/server.

Perhaps the swapControllerAvailable can be mocked to true during the test, or the test should be just skipped when cgroup is unavailable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cri Container Runtime Interface (CRI) cherry-picked/1.6.x PR commits are cherry-picked into release/1.6 branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1.6.13 memory.memsw.limit_in_bytes: no such file or directory
7 participants