From 78827837d429193e8b67f9cc597f75876dad7092 Mon Sep 17 00:00:00 2001 From: Lucas Manning Date: Wed, 16 Oct 2024 09:53:36 -0700 Subject: [PATCH] Update containerd shim to use OOMKill instead of OOM. The reason for this is outlined in https://github.com/containerd/containerd/commit/7275411ec811f1294e1b3466bc24e963ea90f002. TL;DR: K8s sets mem limits on the pod cgroup (slice), which means the scope cgroup (container) gets OOMKilled, not OOMed. Fixes #9723 PiperOrigin-RevId: 686543615 --- pkg/shim/runsc/oom_v2.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/shim/runsc/oom_v2.go b/pkg/shim/runsc/oom_v2.go index 30b9e75b5..89b7bed2e 100644 --- a/pkg/shim/runsc/oom_v2.go +++ b/pkg/shim/runsc/oom_v2.go @@ -71,15 +71,15 @@ func (w *watcherV2) run(ctx context.Context) { } logrus.Debugf("Received OOM event, id: %q, event: %+v", i.id, i.ev) lastOOM := lastOOMMap[i.id] - if i.ev.OOM > lastOOM { + if i.ev.OOMKill > lastOOM { if err := w.publisher.Publish(ctx, runtime.TaskOOMEventTopic, &TaskOOM{ ContainerID: i.id, }); err != nil { logrus.WithError(err).Error("Publish OOM event") } } - if i.ev.OOM > 0 { - lastOOMMap[i.id] = i.ev.OOM + if i.ev.OOMKill > 0 { + lastOOMMap[i.id] = i.ev.OOMKill } } }