如何解释此内核消息:cgroup out of memory: Kill process 1234 .... score 1974 or 牺牲 child?

luc*_*iet 6 containers out-of-memory kubernetes

所以,我正在运行一个正在被杀死的 docker 容器。

Memory cgroup out of memory: Kill process 1014588 (my-process) score 1974 or sacrifice child
Run Code Online (Sandbox Code Playgroud)

pid 并没有真正的帮助,因为实例将重新启动。我不知道这score 1974部分该怎么做。这是某种评级吗?这是它需要下降到的字节数吗?

是否会因为系统上的其他东西挤压这个容器而发出kill,或者只能这个容器被封顶?

而牺牲子部分,我认为这与某种子流程有关?

Ric*_*ico 6

我相信这实际上是在这里回答的

如果您在此处查看 Linux 内核代码。你会看到的:

/*
 * If any of p's children has a different mm and is eligible for kill,
 * the one with the highest oom_badness() score is sacrificed for its
 * parent.  This attempts to lose the minimal amount of work done while
 * still freeing memory.
 */
Run Code Online (Sandbox Code Playgroud)

mm 的意思是“内存管理”。

这里唯一的区别是这个 kill 是由 cgroups 触发的,因为您可能遇到了内存限制。