Repository navigation
Closed as not planned
Closed as not planned
Copy link
Labels
Description
Description
We observed that, occasionally, the reason field for Kubernetes containers which are oom killed immediately after their start is set to Error rather than OOMKilled.
This was discovered by a recently added e2e node test in k/k, see related issue: kubernetes/kubernetes#116082.
Steps to reproduce the issue
- Run via Kubernetes a container with memory restricted to 15M, and using with the following command
sh -c "dd if=/dev/zero of=/dev/null bs=20M"
Note that, it fails only occasionally.
Describe the results you received and expected
The reason field set to OOMKilled.
What version of containerd are you using?
1.6.12-0ubuntu022.04.1gke1
Any other relevant information
Example containerd logs from a failed k/k test:
Feb 26 12:05:17 tmp-node-e2e-169abffc-ubuntu-gke-2204-1-24-v20230222 containerd[1178]: time="2023-02-26T12:05:17.360444314Z" level=debug msg="Finish redirecting stream \"stdout\" to log file \"/var/log/pods/oomkiller-test-8138_oomkill-target-pod_b53d7fb0-9151-4f0e-870a-ffbccd16f809/oomkill-target-container/0.log\""
Feb 26 12:05:17 tmp-node-e2e-169abffc-ubuntu-gke-2204-1-24-v20230222 containerd[1178]: time="2023-02-26T12:05:17.396182820Z" level=debug msg="event forwarded" ns=k8s.io topic=/tasks/oom type=containerd.events.TaskOOM
Feb 26 12:05:17 tmp-node-e2e-169abffc-ubuntu-gke-2204-1-24-v20230222 containerd[1178]: time="2023-02-26T12:05:17.396518375Z" level=debug msg="Received containerd event timestamp - 2023-02-26 12:05:17.395915965 +0000 UTC, namespace - \"k8s.io\", topic - \"/tasks/oom\""
Feb 26 12:05:17 tmp-node-e2e-169abffc-ubuntu-gke-2204-1-24-v20230222 containerd[1178]: time="2023-02-26T12:05:17.396864926Z" level=info msg="TaskOOM event &TaskOOM{ContainerID:46390b63528810c6bc07c965dfdc4f91f3d9c503e8de1f64bb9509e2f13a8c94,XXX_unrecognized:[],}"
Feb 26 12:05:17 tmp-node-e2e-169abffc-ubuntu-gke-2204-1-24-v20230222 containerd[1178]: time="2023-02-26T12:05:17.398091484Z" level=debug msg="event forwarded" ns=k8s.io topic=/tasks/start type=containerd.events.TaskStart
Feb 26 12:05:17 tmp-node-e2e-169abffc-ubuntu-gke-2204-1-24-v20230222 containerd[1178]: time="2023-02-26T12:05:17.405313372Z" level=info msg="StartContainer for \"8421aeb51bfcb395c8fda0423e90b2408df13439fd1a73fdf3210091ea1d3080\" returns successfully"
Note that the TaskOOM event is logged before StartContainer for \"container_id\" returns successfully. In successful runs of the test the StartContainer for \"container_id\" returns successfully is logged before TaskOOM .
Show configuration if it is related to CRI plugin.
No response
Activity
mimowo commentedon Feb 28, 2023
/cc @SergeyKanzhelev @mikebrow @bobbypage
mimowo commentedon Mar 7, 2023
Update: there are no flakes in the e2e test in k/k (https://testgrid.k8s.io/presubmits-kubernetes-blocking#pull-kubernetes-node-e2e-containerd) since we added a sleep in the test before allocation: https://github.com/kubernetes/kubernetes/pull/116082/files. This suggests it was indeed caused by a race-condition in containerd.
SergeyKanzhelev commentedon Mar 10, 2023
Can you link the containerd issue here and close this bug than? I tend to agree. Thank you!
mimowo commentedon Mar 10, 2023
This is the PR that fixed the issue from the test stability POV in k/k: kubernetes/kubernetes#116082
lengrongfu commentedon Jul 30, 2023
From the log,
oomkill-multi-target-containercontainer can be found that the kernel has sent the oom signal, but the container did not receive the/task/oomevent before exiting.https://testgrid.k8s.io/sig-node-containerd#containerd-node-e2e-1.7
https://storage.googleapis.com/kubernetes-jenkins/logs/ci-containerd-node-e2e-1-7/1683184526936772608/artifacts/tmp-node-e2e-92a26bb7-cos-97-16919-353-1-system.log
mikebrow commentedon Aug 8, 2023
quick scan of the log ^
first stand out:
Jul 23 18:56:46 tmp-node-e2e-92a26bb7-cos-97-16919-353-1 containerd[910]: time="2023-07-23T18:56:46.424828104Z" level=debug msg="containerEventsChan is full, discarding event {ContainerId:98bac6c4b73cfd4c647647aa80248208b67de059874d4ddfdd1aa43ea3967e54 ContainerEventType:CONTAINER_STOPPED_EVENT CreatedAt:1690138606424696583