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

fix: dont set status to exit for oom condition #2772

Merged
merged 1 commit into from
Mar 26, 2019

Conversation

zhuangqh
Copy link
Contributor

@zhuangqh zhuangqh commented Mar 26, 2019

Signed-off-by: zhuangqh zhuangqhc@gmail.com

Ⅰ. Describe what this PR did

fix: dont set status to exit for oom condition

pouch would fail to stop or remove a oom container if it was set
to exited status

Ⅱ. Does this pull request fix one issue?

Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)

$ CID=$(pouch run -d busybox top)
$ pouch exec -it $CID sh
$ run a oom program

// another terminal
$ pouch ps -a | grep $CID
// container is up
$ pouch inspect $CID | grep -i oom
// oomkilled is set to true

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

CRI part using state.Error info string to identify oom status

pouch would fail to stop or remove a oom container if it was set
to exited status

Signed-off-by: zhuangqh <zhuangqhc@gmail.com>
@codecov
Copy link

codecov bot commented Mar 26, 2019

Codecov Report

Merging #2772 into master will decrease coverage by 0.15%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #2772      +/-   ##
=========================================
- Coverage   69.45%   69.3%   -0.16%     
=========================================
  Files         277     277              
  Lines       17429   17425       -4     
=========================================
- Hits        12106   12077      -29     
- Misses       3999    4016      +17     
- Partials     1324    1332       +8
Flag Coverage Δ
#criv1alpha2_test 39.34% <ø> (-0.09%) ⬇️
#integration_test_0 36.59% <ø> (+0.06%) ⬆️
#integration_test_1 35.75% <ø> (-0.04%) ⬇️
#integration_test_2 36.49% <ø> (+0.01%) ⬆️
#integration_test_3 35.47% <ø> (-0.05%) ⬇️
#node_e2e_test 35.25% <ø> (-0.04%) ⬇️
#unittest 28.53% <ø> (ø) ⬆️
Impacted Files Coverage Δ
daemon/mgr/container_state.go 91.91% <ø> (-0.32%) ⬇️
cri/ocicni/cni_manager.go 58.82% <0%> (-11.77%) ⬇️
cri/stream/portforward/httpstream.go 70.94% <0%> (-6.84%) ⬇️
daemon/mgr/events.go 89.04% <0%> (-2.74%) ⬇️
cri/stream/runtime.go 67.85% <0%> (-2.39%) ⬇️
ctrd/client.go 67.75% <0%> (-1.64%) ⬇️
pkg/meta/store.go 67.44% <0%> (-1.56%) ⬇️
daemon/mgr/container_utils.go 82.38% <0%> (-1.14%) ⬇️
ctrd/container.go 55.44% <0%> (-0.39%) ⬇️
cri/v1alpha2/cri.go 71.5% <0%> (-0.13%) ⬇️
... and 1 more

@pouchrobot pouchrobot added kind/bug This is bug report for project size/XS labels Mar 26, 2019
@HusterWan
Copy link
Contributor

LGTM

@pouchrobot pouchrobot added the LGTM one maintainer or community participant agrees to merge the pull reuqest. label Mar 26, 2019
@HusterWan HusterWan merged commit 7230376 into AliyunContainerService:master Mar 26, 2019
@allencloud
Copy link
Collaborator

I think we must add a test case to cover the oom case. @zhuangqh @HusterWan
Can we reproduce the oom case by creating a TOMCAT container with JVM allocated with 100m, while the container memory limit is only 50m?

@allencloud
Copy link
Collaborator

Actually, I am wondering if we could polish the PR description.

fix: dont set status to exit for oom condition. pouch would fail to stop or remove a oom container if it was set to exited status

The description above actually tells us almost nothing. Since you just repeated the error case.
You told us if A, then B. A=set to exited status, B=fail to stop or remove a oom container.
I think what matters is why A is not reasonable. In another word, we care about the reason of why A is wrong, not the result B if we do a wrong A.

WDYT? @zhuangqh

@zhuangqh
Copy link
Contributor Author

Actually, I am wondering if we could polish the PR description.

fix: dont set status to exit for oom condition. pouch would fail to stop or remove a oom container if it was set to exited status

The description above actually tells us almost nothing. Since you just repeated the error case.
You told us if A, then B. A=set to exited status, B=fail to stop or remove a oom container.
I think what matters is why A is not reasonable. In another word, we care about the reason of why A is wrong, not the result B if we do a wrong A.

WDYT? @zhuangqh

Actually, it is a horrible case that pouch cannot stop or remove a container which occurs oom. An oom container is stilling running as a normal container, what exits is the oom program.

@zhuangqh
Copy link
Contributor Author

I think we must add a test case to cover the oom case. @zhuangqh @HusterWan
Can we reproduce the oom case by creating a TOMCAT container with JVM allocated with 100m, while the container memory limit is only 50m?

sure, the simplest way to reproduce this issue is writing a c program and malloc a huge memory.

@allencloud
Copy link
Collaborator

sure, the simplest way to reproduce this issue is writing a c program and malloc a huge memory.

It is worth adding a case to cover it via doing what you said. @zhuangqh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug This is bug report for project LGTM one maintainer or community participant agrees to merge the pull reuqest. size/XS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants