You've got a container with a 512MB memory limit, and the kernel keeps OOM-killing your Node process. What's actually going on, and how do you fix it properly?
A good answer keeps the V8 heap limit separate from total process memory and sizes both against the cgroup limit with honest headroom
That's the kernel OOM killer. It terminates the process when the container's total memory crosses the cgroup limit. With Node the usual cause is that V8's default heap limit doesn't match the container. V8 sizes its heap from the memory it detects, which can be way more than 512MB, so the heap grows past what the container allows and the kernel kills the process before V8 even thinks it's out of memory. The fix is setting --max-old-space-size explicitly, around 400MB for a 512MB container I think, so V8 collects harder and throws a heap-out-of-memory error instead of getting killed. It's also worth checking for a memory leak, because a leak will hit any limit eventually. And setting the flag through NODE_OPTIONS keeps it consistent across entrypoints.