Raising a container's memory limit after an OOM kill only moves the cliff a few gigabytes higher and makes the next recovery take longer.
On 10 November 2026 at 19:32:52 UTC, our standalone production FalkorDB 4.12.5 pod hit its third OOMKilled termination (exit code 137) under a 12 GiB container limit, even though maxmemory was set to 9 GiB. Earlier escalations had already stepped the pod from 4 GiB to 8 GiB on 30 October, and from 8 GiB to 12 GiB on 6 November. Each crash left the graph service offline for roughly two hours.
Two puzzles behind the crash loop
First, why did a database capped at 9 GiB blow past a 12 GiB container limit? Operators often assume maxmemory bounds the entire process, yet it only caps stored graph data. Per-query execution buffers (QUERY_MEM_CAPACITY, which defaults to unlimited) and client output buffers sit outside that cap. Prometheus metrics ruled out background persistence forks: an RDB save at 19:01 UTC added roughly 93 MB of copy-on-write overhead, and no AOF rewrite was active near the crash. Instead, at 19:24 UTC, eight minutes before the kernel killed the container, redis_memory_used_bytes peaked near 11.0 GB while process RSS reached 12.765 GB and working set hit 12.860 GB. Unbounded graph reads and uncapped per-query buffers pushed total process memory past the cgroup ceiling.
Second, why could we not simply edit startup flags in the manifest and restart the pod? Recovery downtime came from replaying an uncompacted append-only file, not from loading the base RDB snapshot. On a single-replica graph pod, restarting immediately to apply new FALKORDB_ARGS would force another two-hour AOF replay before the database could serve a single query.
Guarding the live process before restarting it
We split remediation into three steps so live memory protection took hold before any restart:
- Apply runtime limits directly to the running instance: use a KubeBlocks reconfiguration to cap
maxmemory-clientsat 1 GiB and set normal client output buffer limits (512 MiB hard, 256 MiB soft over 60 seconds), then runGRAPH.CONFIG SET QUERY_MEM_CAPACITY 2147483648for a 2 GiB per-query ceiling. - Confirm that bounded graph-read limits were already active in the application pods, then run
BGREWRITEAOFand wait until the base and current AOF sizes matched so the persisted journal compacted to a clean checkpoint. - Roll the updated KubeBlocks manifest with a 16 GiB pod memory limit and
QUERY_MEM_CAPACITYpersisted inFALKORDB_ARGS, preserving all existing KubeBlocks cluster fields during the update.
The dynamic KubeBlocks parameters and persisted cluster environment looked like this:
# Dynamic client memory guards (applied live without restart)
parameters:
- key: client-output-buffer-limit normal
value: "512mb 256mb 60"
- key: maxmemory-clients
value: "1gb"
# Persisted in the Cluster spec after BGREWRITEAOF checkpointing
env:
- name: FALKORDB_ARGS
value: "MAX_QUEUED_QUERIES 25 TIMEOUT 0 RESULTSET_SIZE -1 QUERY_MEM_CAPACITY 2147483648"
resources:
limits:
memory: "16Gi"Compacting the append-only file between applying live runtime guards and rolling the manifest turned a multi-hour outage risk into a controlled restart. Runtime GRAPH.CONFIG SET protects only the running process until exit, while manifest edits take effect only on restart.
Verifying data parity without trusting list order
Once the pod returned, we verified node and edge counts across every graph in the store. Comparing GRAPH.LIST output by positional index failed initially because graph iteration order changed across the restart. Keying the comparison by graph name confirmed exact parity across all 31 named graphs, 440,242 nodes, and 2,041,607 edges, followed by five consecutive HTTP 200 health checks and passing CHUNKS, GRAPH_COMPLETION, TEMPORAL, and bounded visualization checks.
What this change solved and what stayed open
Containing FalkorDB stopped the crash loop without losing graph state and showed that live runtime guards plus BGREWRITEAOF made this single-replica restart predictable. It did not prove that a 2 GiB per-query ceiling fits every future workload, nor did it clear unrelated pipeline failures elsewhere in the stack. A global-context-index improvement run still hit the 300-second gateway limit on a Qdrant ReadTimeout, and a follow-up merge request for Record.vector handling and stage-lock ordering stayed unbuilt after disk exhaustion on a CI runner. Recording those open boundaries keeps a real database recovery from being overstated as an end-to-end cure.
