首页 > 解决方案 > Kubernetes 集群下 POD 上的无效标记压缩接近堆限制分配失败和 v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath

问题描述

我在 K8S 集群上运行微服务,我的一个微服务有 4-6 个 pod。

它不断抛出以下内容:

v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]

和:

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

我在后端使用 NODE JS。

从谷歌搜索这个问题我发现人们建议这样做

NODE_OPTIONS
  --max-old-space-size=8000

但是问题并没有停止,在我的应用程序运行了一段时间(20-30 分钟)并且 pod 开始工作后,内存开始增加,直到达到我专用于 POD 的最大值(8GB)和然后是重新启动。

为什么这仍然发生?为什么--max-old-space-size=8192不解决堆问题?

标签: javascriptnode.jskubernetesmemoryheap-memory

解决方案


推荐阅读