Flipping EXECUTIONS_MODE=queue on a multi-container n8n deployment without re-architecting binary storage and V8 heap limits caused a 100.0% HTTP 500 failure rate on 2.0 MiB file uploads and crashed both worker containers simultaneously with Exit Code 137 (OOMKilled=true).
Queue Mode fixes single-node CPU saturation fast, yet partial migrations fail silently. After raising reverse-proxy body limits with our n8n HTTP 413 Payload Too Large Nginx and Compose guide, teams often add Redis and two worker containers to process PDFs, audio recordings, or CSV exports in parallel. Minutes later, webhooks return generic Error in workflow payloads and the Executions list fills with endless spinning rows.
/home/node/.n8n/binaryData volume across main, webhook, and every worker container (or configure N8N_DEFAULT_BINARY_DATA_MODE=s3 across multiple hosts). (2) Set NODE_OPTIONS=--max-old-space-size=768 inside each 1024m worker container so V8 garbage-collects before hitting the Linux cgroup OOM wall. (3) Cap n8n worker --concurrency=2 to 4 for binary or PDF workflows instead of over-subscribing memory.x-n8n-shared: &n8n-shared
image: n8nio/n8n:1.76.1
environment: &n8n-env
DB_TYPE: postgresdb
DB_POSTGRESDB_HOST: postgres
DB_POSTGRESDB_PORT: "5432"
DB_POSTGRESDB_DATABASE: n8n_queue
DB_POSTGRESDB_USER: n8n_user
DB_POSTGRESDB_PASSWORD: ${DB_PASSWORD}
N8N_ENCRYPTION_KEY: ${N8N_ENCRYPTION_KEY}
EXECUTIONS_MODE: queue
QUEUE_BULL_REDIS_HOST: redis
QUEUE_BULL_REDIS_PORT: "6379"
OFFLOAD_MANUAL_EXECUTIONS_TO_WORKERS: "true"
N8N_DEFAULT_BINARY_DATA_MODE: filesystem
GENERIC_TIMEZONE: UTC
TZ: UTC
volumes:
- n8n_shared_binary:/home/node/.n8n/binaryData
services:
n8n-main:
<<: *n8n-shared
command: ["start"]
ports:
- "127.0.0.1:5678:5678"
n8n-webhook:
<<: *n8n-shared
command: ["webhook"]
ports:
- "127.0.0.1:5679:5678"
n8n-worker-1:
<<: *n8n-shared
command: ["worker", "--concurrency=2"]
mem_limit: 1024m
environment:
<<: *n8n-env
NODE_OPTIONS: "--max-old-space-size=768"
n8n-worker-2:
<<: *n8n-shared
command: ["worker", "--concurrency=2"]
mem_limit: 1024m
environment:
<<: *n8n-env
NODE_OPTIONS: "--max-old-space-size=768"
volumes:
n8n_shared_binary:
n8nio/n8n:1.76.1 running separated main, webhook, worker-1, and worker-2 containers alongside redis:7-alpine and postgres:17-alpine.How EXECUTIONS_MODE=queue Splits Ingress, State, and Worker Filesystems
Understanding both outages starts with what Redis actually carries in n8n Queue Mode. When an external caller posts a multipart file to a dedicated n8n webhook container, n8n does not serialize multi-megabyte binary blobs into Redis lists. Instead, the ingress container streams the file to its configured binary backend, writes an execution record into PostgreSQL 17, and pushes a compact BullMQ job pointer onto redis:7-alpine.

1001) and heap allocation (1002) workflows into PostgreSQL 17 via n8n import:workflow before worker boot.To test every failure boundary deterministically, we seeded two workflows via CLI into our six-container cluster: Workflow 1001 receives a 2,097,152-byte (2.0 MiB) binary upload and computes its SHA-256 digest on a queue worker, while Workflow 1002 allocates multi-megabyte V8 arrays to simulate heavy document parsing. Note that we also pinned explicit GENERIC_TIMEZONE=UTC and TZ=UTC across every service anchor so cron triggers and worker logs never drift, matching the container clock rules in our n8n Docker timezone drift fix.

main (15680), webhook (15681), two BullMQ workers, redis:7-alpine, and postgres:17-alpine.Phase 1 Reproduction: 100% Binary File Not Found Across Isolated Containers
Many Compose templates set N8N_DEFAULT_BINARY_DATA_MODE=filesystem to keep large files out of PostgreSQL tables, mount a persistent volume on n8n-main, and forget to mount that same volume onto n8n-webhook and n8n-worker replicas.

2.0 MiB multipart webhook uploads fail in ~183 ms with HTTP 500 {"message":"Error in workflow"}.We reproduced that exact misconfiguration in Phase 1 and fired 6 concurrent 2.0 MiB multipart uploads at gfl-c1-lab3-webhook on port 15681. Every single request failed: 0 of 6 succeeded (100.0% failure rate), returning HTTP 500 {"message":"Error in workflow"} within 182.64 ms to 185.55 ms.

/home/node/.n8n/binaryData reveals 12 files (six 2.0M payloads plus .metadata sidecars) trapped inside gfl-c1-lab3-webhook while both workers see 0 files.Checking container directories revealed where the bytes went. Inside gfl-c1-lab3-webhook, /home/node/.n8n/binaryData held 12 stranded files (six 2.0M payloads plus six .metadata JSON files). Inside gfl-c1-lab3-worker-1 and gfl-c1-lab3-worker-2, the same directory path held 0 files because each container wrote to its private Linux overlayfs layer.

execution_entity confirms executions 1..6 aborted inside node Compute Binary SHA256 on Worker with File not found.Querying PostgreSQL's execution_entity and execution_data tables exposed the exact exception hidden behind the generic HTTP 500 response: BullMQ dispatched jobs 1, 5, 3 to worker-1 and jobs 2, 6, 4 to worker-2, and all six crashed inside node Compute Binary SHA256 on Worker with File not found after roughly 33 ms. Review the official n8n binary data scaling documentation whenever adding separate webhook or worker containers.

worker-1 pulling jobs 1, 5, 3 and worker-2 pulling jobs 2, 6, 4 from Redis BullMQ.Phase 2 Reproduction: 256 MiB Worker SIGKILL (Exit 137) and BullMQ Orphaned Locks
Fixing shared storage uncovers the second trap: container memory ceilings paired with default worker concurrency. Operators squeezing stacks onto small VPS instances often slap mem_limit: 256m onto worker containers while leaving NODE_OPTIONS unset and running n8n worker --concurrency=5 (or the default 10).

256m cgroup limit with --concurrency=5, the Linux OOM killer terminates both worker-1 and worker-2 (ExitCode=137, OOMKilled=true).In Phase 2, we mounted the shared volume, set mem_limit: 256m on both workers without a V8 heap cap, and dispatched concurrent 210 MiB heap jobs. Both gfl-c1-lab3-worker-1 and gfl-c1-lab3-worker-2 died at the exact same second with Status=exited | ExitCode=137 | OOMKilled=true. Because Node's V8 allocator inspected the 7.75 GiB VM memory total rather than the Linux kernel cgroup v2 limit enforced by Docker container memory constraints, V8 delayed garbage collection until the kernel fired SIGKILL (128 + 9 = 137). For deeper kernel OOM diagnostics, see our Docker container Exit Code 137 OOMKilled root-cause guide.

SIGKILL, Redis retains orphaned jobs 7..10 in bull:jobs:active with bull:jobs:10:lock counting down from PTTL = 29,271 ms.What happens inside Redis and PostgreSQL right after a worker receives SIGKILL? Inspecting Redis immediately with redis-cli showed 4 orphaned active jobs (7, 8, 9, 10) stranded in bull:jobs:active. Job 10 still held bull:jobs:10:lock with a remaining PTTL = 29,271 ms out of BullMQ's default 30-second lock window. No surviving worker can touch those locked jobs until the TTL expires and the stall-check cycle fires, controlled by the n8n Queue Mode BullMQ stall environment variables.

SIGKILL bypasses Node.js shutdown handlers, PostgreSQL leaves executions 7..10 frozen in status = running with stoppedAt = NULL.Simultaneously, PostgreSQL's execution_entity table showed executions 7, 8, 9, 10 frozen in status = running with stoppedAt = NULL. If a restarted worker pulls that retried job and hits the same 256m ceiling again, the execution enters an OOM stall loop until maxStalledCount permanently fails it.
Even without a kernel OOM kill, synchronous JavaScript inside an n8n Code node can trigger the exact same BullMQ stall mechanism. Every active worker renews its Redis job lock on an async timer roughly halfway through the 30-second lock window (N8N_QUEUE_BULL_SETTINGS_LOCKRENEWTIME=15000 against N8N_QUEUE_BULL_SETTINGS_LOCKDURATION=30000). Blocking the single-threaded Node.js event loop for 32 seconds with synchronous regex parsing, huge JSON.parse() calls, or unstreamed ZIP decompression starves that renewal timer. Redis expires bull:jobs:<id>:lock, a second worker picks up the job while the first worker is still running, and downstream APIs receive duplicate webhook side effects.
Phase 3 Production Benchmark: Shared Binary Volume + 75% V8 Heap Rule
To eliminate both failure modes, Phase 3 applied three coordinated changes: a shared named volume (n8n_shared_binary:/home/node/.n8n/binaryData) across all four n8n containers, mem_limit: 1024m paired with Node.js --max-old-space-size=768 (75% of container RAM, reserving 256 MiB for C++ binary Buffer memory and V8 off-heap spaces), and worker concurrency capped at --concurrency=2.

/home/node/.n8n/binaryData across ingress and workers yields 10/10 HTTP 200 responses in 312.51 ms with verified SHA-256 digests.First, we fired 10 concurrent 2.0 MiB (2,097,152 B) multipart uploads at gfl-c1-lab3-webhook. All 10 of 10 requests returned HTTP 200 OK in 312.51 ms total wall time (0.0% error rate), and every worker returned the exact expected SHA-256 digest 0ba552bd3e6e97511dc86eb9f9aab38b04aff16426b3256a2aae673cd21bfc37.

worker-1 peaks at 415.6 MiB RSS inside its 1 GiB container ceiling while Redis (11.69 MiB) and PostgreSQL (47.76 MiB) stay tiny.Next, we submitted 8 heavy 180 MiB heap jobs across the two concurrency-capped workers. All 8 of 8 jobs finished cleanly in 3,683.07 ms with ExitCode=0 and OOMKilled=false on both workers. During peak execution, docker stats --no-stream captured worker-1 at 415.60 MiB RSS (40.59% of its 1 GiB limit), proving empirically why a 256 MiB ceiling (1.62x too small) guaranteed instant OOM crashes.
To quantify full webhook-to-worker round-trip latency under sustained concurrency, we also drove 200 concurrent HTTP POST triggers across 25 parallel connections using oha 1.16.0 (oha -n 200 -c 25 -m POST --no-tui --output-format json) against gfl-c1-lab3-webhook on port 15681 with responseMode="lastNode", forcing every HTTP call to enqueue onto redis:7-alpine, execute on worker-1 or worker-2, persist state in PostgreSQL 17, and return the worker payload. All 200 of 200 requests returned HTTP 200 OK (100.0% success rate) at 242.42 req/s, recording 57.116 ms minimum latency, 99.777 ms mean latency, 96.357 ms p50, 124.371 ms p95, and 158.653 ms p99 (160.603 ms max).

oha -n 200 -c 25 HTTP webhook-to-worker benchmark achieving 200/200 HTTP 200 OK responses at 242.42 req/s with p50 = 96.36 ms, p95 = 124.37 ms, and p99 = 158.65 ms.
OOMKilled=false), bull:jobs:active drains to 0, and PostgreSQL records all 18 executions in status = success.| Benchmark Phase | Binary Storage & Worker Sizing | 2.0 MiB Multipart Binary Result | Heavy Heap Stress Result | Redis BullMQ & Postgres State |
|---|---|---|---|---|
| Phase 1 (Isolated OverlayFS) | filesystem mode, no shared volume, concurrency=5 |
0 / 6 OK (100% HTTP 500) in ~183 ms |
Not run (ingress handoff broken) | 12 files stranded on webhook; PG File not found |
| Phase 2 (Untuned 256m Workers) | Shared volume, mem_limit=256m, unset NODE_OPTIONS, concurrency=5 |
Volume mounted | Both workers OOMKilled (Exit 137) | Jobs 7..10 orphaned in bull:jobs:active (PTTL 29,271 ms); PG stuck running |
| Phase 3 (Tuned Production) | Shared n8n_shared_binary, 1024m limit, --max-old-space-size=768, concurrency=2 |
10 / 10 HTTP 200 OK (SHA-256 verified in 312.51 ms) |
8 / 8 Completed in 3,683.07 ms (415.6 MiB peak RSS) |
0 OOM kills, 0 stuck locks, 18/18 PG success |
Cluster Memory Footprint and Multi-Host Scaling Checklist
Side-by-side telemetry charts confirm that properly tuned Queue Mode does not require bloated servers. Even while crunching multi-megabyte binary streams and 180 MiB heap arrays, all six containers combined consumed just 998.05 MiB of host RAM (415.60 MiB active worker, 225.60 MiB main editor, 166.70 MiB webhook ingress, 130.70 MiB second worker, 47.76 MiB PostgreSQL 17, and 11.69 MiB Redis 7).

2.0 MiB binary verification rate: 0.0% on container-local overlayfs versus 100.0% (10/10 SHA-256 verified) with a shared volume.
--max-old-space-size=768 inside 1024m) with --concurrency=2 eliminates Exit Code 137 crashes completely.Notice how keeping concurrency at 2 per worker drained all 8 heavy jobs in 3.68 seconds, whereas over-subscribing concurrency triggered a 29.27-second orphaned lock stall.

998.05 MiB across the entire six-container stack.
3,683.07 ms, nearly 8x faster than waiting out a single 30-second BullMQ dead-lock window.| Cluster Service Container | Process Role & Command | Measured Peak RSS | Container Memory Ceiling | Active PIDs |
|---|---|---|---|---|
gfl-c1-lab3-worker-1 |
n8n worker --concurrency=2 (active heavy batch) |
415.60 MiB | 1,024 MiB (40.59%) |
13 |
gfl-c1-lab3-main |
n8n start (editor UI, schedules, migrations) |
225.60 MiB | Host VM limit (7.75 GiB) |
13 |
gfl-c1-lab3-webhook |
n8n webhook (dedicated HTTP multipart ingress) |
166.70 MiB | Host VM limit (7.75 GiB) |
12 |
gfl-c1-lab3-worker-2 |
n8n worker --concurrency=2 (post-GC idle) |
130.70 MiB | 1,024 MiB (12.76%) |
13 |
gfl-c1-lab3-pg17 |
postgres:17-alpine (execution & workflow metadata) |
47.76 MiB | Host VM limit (7.75 GiB) |
14 |
gfl-c1-lab3-redis |
redis:7-alpine (BullMQ wait/active/lock keys) |
11.69 MiB | Host VM limit (7.75 GiB) |
6 |
Before exposing your Queue Mode cluster to live traffic, verify both HTTP ports independently: port 15680 (or internal 5678) serves the main editor UI while dedicated webhook replicas expose lightweight /healthz probes ({"status":"ok"}) for your reverse proxy or load balancer.

gfl-c1-lab3-main editor interface on port 15680 remaining responsive while heavy heap jobs execute on isolated workers.
gfl-c1-lab3-webhook ingress container serving {"status":"ok"} on port 15681 at 166.7 MiB RSS.When converting existing single-container docker run deployments into multi-service YAML anchors like the template above, drop your current flags into our Docker run to Compose YAML converter first. And once you scale beyond 4 to 6 worker containers hammering PostgreSQL 17 simultaneously, calculate your database connection ceiling and PgBouncer pool budget in our PostgreSQL and PgBouncer memory pool calculator so worker bursts never exhaust backend slots.
Pair that shared n8n_shared_binary volume with automatic execution pruning before going live. Without retention rules, six hundred 2.0 MiB webhook uploads per day will write over 36 GiB of binary payloads and .metadata sidecars onto disk every month. Set EXECUTIONS_DATA_PRUNE=true and EXECUTIONS_DATA_MAX_AGE=168 (7 days) on n8n-main so the leader process sweeps expired rows in PostgreSQL and unlinks their matching files from /home/node/.n8n/binaryData automatically.
Double-check N8N_ENCRYPTION_KEY parity across every container before starting the stack. If a worker boots without the exact encryption string stored in your .env file, n8n generates a random key inside that worker container and every credential decryption call fails mid-job. Using a single Compose YAML anchor (&n8n-env) guarantees identical database, Redis, timezone, binary-mode, and encryption variables across main, webhook, and every horizontal worker replica.

N8N_ENCRYPTION_KEY requirements.

mem_limit triggers immediate kernel SIGKILL (137).n8n Queue Mode, Binary Storage & BullMQ Recovery FAQ
Why did binary uploads work on my single n8n container and break immediately in Queue Mode?
In single-process regular mode, the same container receives the multipart HTTP upload, writes the file into /home/node/.n8n/binaryData, and runs every downstream node. In EXECUTIONS_MODE=queue, the webhook container writes the file locally and pushes only a lightweight execution ID into Redis, so separate worker containers fail with File not found unless storage is shared.
Why do OOM-killed workers leave executions stuck as 'Running' in the n8n UI?
Linux's cgroup OOM killer sends SIGKILL (9), terminating the Node.js worker process before it can update PostgreSQL or release its Redis BullMQ lock. Until the 30-second bull:jobs:<id>:lock TTL expires and BullMQ's stall checker exceeds N8N_QUEUE_BULL_SETTINGS_MAXSTALLEDCOUNT, the execution row stays open.
Why shouldn't I set --max-old-space-size equal to 100% of mem_limit?
Node's --max-old-space-size flag only caps the V8 managed JavaScript old-generation heap. Native C++ Buffer allocations used during multipart file reads, TLS buffers, V8 young-generation semi-spaces, and executable code pages live outside that ceiling, requiring at least 25% container RAM headroom.
When do I need S3 binary storage instead of a shared Docker named volume?
A shared Docker named volume solves binary access cleanly when main, webhook, and all worker containers run on the same Docker host. As soon as workers span multiple VMs or Kubernetes nodes without a POSIX RWX network filesystem, switch to N8N_DEFAULT_BINARY_DATA_MODE=s3.
Run Prefilled Sizing Math & Download the 1-Page Runbook
Size quantized GGUF weights + GQA KV cache memory and compare 36-month Cloud GPU vs local AI hardware TCO.