Renovate kept getting OOMKilled on the BMAX Mini PC* that runs my entire k3s cluster. The CronJob would start, run for a while and die with exit code 137. The obvious reading was not enough memory, so I raised the limit.
Three limits later (1 GiB, then 2 GiB, then 4 GiB) it was still dying. The fix wasn’t a bigger limit. It was changing what Renovate did with the memory it had.
View the complete homelab infrastructure source on GitHub
The Escalation
Round 1: the CronJob was OOMKilled at 1 GiB, on every retry. The scanned dependency count had just grown from about 190 to 217 after a batch of new Terraform stacks and ExternalSecrets, and 896Mi of V8 heap under a 1 GiB limit left very little room for everything outside the heap. I raised the limit to 2 GiB with a 1536Mi heap, keeping roughly 25% non-heap headroom, and suspended the CronJob until the fix merged.
Round 2: a day later it was OOMKilled again at 2 GiB. Every job, three retries each, kubectl describe pod showing exit code 137, reason OOMKilled. I checked for regressions: no commit between the last clean run and the first failure had meaningfully grown the dependency count. The internal-docs relocation merged after the failures started, and Renovate doesn’t scan .md files anyway. I read it as ordinary run-to-run variance tipping an already marginal limit over. The kernel’s oom-kill records showed every kill landing only 30 to 40Mi over the 2 GiB cap, so I went to 4 GiB with a 3072Mi heap, roughly double the near-kill value.
That fix nearly shipped wrong. The PR merged at 3 GiB with a 2304Mi heap, because the 4 GiB edit was described in the PR but never made before merge. A follow-up PR two minutes later corrected it to 4 GiB. The CronJob was still suspended in between, so the 3 GiB version never ran.
Round 3: at 4 GiB it was OOMKilled again.
The Diagnostic Run
Guessing at limits wasn’t working, so I stopped trying to outrun the spike and measured it instead.
I ran Renovate off-cluster with 12 GiB of headroom, a real GitHub token, real branches and explicit authorization, to measure the actual peak.
The run finished cleanly with exit 0. Peak memory: 3.99 GiB.
So this was never unbounded growth. The kernel’s oom-kill records put the 2 GiB kills at an anon-rss of about 2054 to 2064Mi and the 4 GiB kills at about 4.12 to 4.15 GiB, both just over the cap. Those numbers only show where the limit was, not how high the process wanted to go. A 3.99 GiB peak leaves no margin under a 4 GiB cgroup limit, so normal run-to-run variance was enough to cross it mid-spike, before GC could reclaim anything.
The Root Cause: Terraform Hash Concurrency
The spike wasn’t random. Renovate’s Terraform manager was downloading and SHA256-hashing all 14 platform builds of a major hashicorp/aws provider bump (5.x → 6.53.0) to keep .terraform.lock.hcl valid.
At Renovate’s default concurrentRequestLimit of 16, all 14 of those provider zips, each a large binary, can sit in memory at once while being hashed. Any major provider upgrade with many platform builds will trigger the same spike.
So the fix was to flatten the spike at the source, in a hostRules entry for releases.hashicorp.com:
{
"hostRules": [
{
"matchHost": "releases.hashicorp.com",
"concurrentRequestLimit": 2
}
]
}
This caps concurrent requests to releases.hashicorp.com at 2, so only two provider zips are buffered at a time and the spike shrinks. On top of that, the limit went to 6 GiB with a 4608Mi V8 heap as defense in depth, sized from the measured 3.99 GiB peak with real GC margin instead of a blind guess.
env:
- name: NODE_OPTIONS
value: "--max-old-space-size=4608"
resources:
requests:
memory: 1Gi
limits:
memory: 6Gi
The CronJob had been suspended during the outage, and this fix doesn’t re-enable it. That’s a separate decision once the change is reviewed and validated in production.
The Lesson
The memory bumps were the obvious response to OOMKilled, and they were wrong, because they treated the symptom (the process needs more memory) instead of the cause (the process buffers too many large objects at once).
The diagnostic run with 12 GiB of headroom was the turning point. Once I had the real peak, 3.99 GiB, the question changed: why is the peak that high, and can I flatten it instead of accommodating it?
concurrentRequestLimit: 2 flattens it. The memory limit is the safety net, not the fix.
It’s the same pattern as Kubernetes resource requests: you size requests for what the app needs to run normally and use limits as a ceiling for spikes. Here the normal usage was far below the spike, and the spike was inflated by a default nobody had touched.
The same trap exists outside Kubernetes. Azure VM sizing, AKS node pool autoscaling and Cosmos DB RU allocation all invite you to answer peak usage with more capacity instead of finding out what drives the peak.