Help for owners
My self-hosted n8n keeps crashing or running out of memory
Short answer
n8n does not limit how much data a node fetches, so one workflow can use more memory than the server has. Large lists, big files, the Code node, manual test runs and many workflows running at once are the documented causes. The fixes are smaller batches, sub-workflows, more memory, and where needed a higher Node heap limit.
Does this sound like your situation?
- n8n shows Connection Lost, or a 503 error, while a workflow runs.
- A node says execution stopped and n8n may have run out of memory.
- The container restarts by itself, often at the same time of day.
- It only fails when a big spreadsheet, export or file is processed.
- The server logs say JavaScript heap out of memory.
Why does this happen?
n8n puts no limit on the data a node handles
n8n's documentation says it does not limit how much data a node can fetch or process, so an execution can exceed the memory available. A workflow that works with ten rows can fail with ten thousand.
Confirmed by docs.n8n.io
Some things cost far more memory than others
The docs name large JSON data, large binary data, many nodes in one workflow, memory-heavy nodes such as the Code node, manual executions that copy data for the editor, and other workflows running at the same time.
Confirmed by docs.n8n.io
Saved execution history fills the database
n8n saves execution data, and the docs warn that it can grow the database until storage runs out. Pruning of finished executions is on by default, and workflow settings can override it. A heavy history slows the whole instance.
Confirmed by docs.n8n.io
The server is small for the load
The docs list adding memory on self-hosted instances as the first remedy, and queue mode, with separate workers behind a queue, as the option for high volume and spiky load.
Confirmed by docs.n8n.io
What can I do about it today?
- Note which workflow was runningCheck the executions list for the workflow that failed, and the time. Memory errors usually repeat on the same workflow.
- Stop running that workflow by hand with big dataThe docs say manual executions copy data to the editor and use more memory. Let it run on its schedule, or test with a few rows.
- Do not restart over and overOne restart to get back in is fine. Repeated restarts during a run can leave half-finished work.
- Ask your host for the memory graphMost providers show memory use for the server. Send your developer a screenshot covering the failure time.
- Back up before anything is changedAsk for a copy of the n8n data folder and database, plus the encryption key, before anyone resizes or reconfigures the server.
When should I bring someone in?
- The crashes repeat and workflows that handle orders, invoices or leads are being missed.
- You cannot tell which workflow causes it.
- You are not sure the n8n data and encryption key are backed up.
How do I handle it?
- Measure before resizingI check container and server memory over time, the execution list and the logs, and tie each spike to a workflow.
- Shrink the heavy workflowFollowing n8n's guidance: fewer items per run, Loop Over Items with a sub-workflow per batch that returns only a small result, less use of the Code node.
- Control history and concurrencyExecution data saving and pruning are set to keep only what is useful, and a cap on simultaneous production executions is considered where it fits.
- Give the right amount of memoryServer memory is raised if the measured need justifies it, and the Node heap limit is changed only where the docs describe it for heap errors.
- Alert and back upA memory alert and a tested backup of data folder, database and encryption key are put in place, so the next incident is noticed early.
The price depends on what I find, so I quote in writing after a short discovery call. Tell me what is happening and I reply within 24 hours.
What do owners ask about this?
Is it a memory leak in n8n?
The documentation attributes memory errors to data size, heavy nodes, manual runs and concurrency, not to a leak. I read the measurements for your instance before drawing any conclusion.
Will more memory fix it?
Sometimes. The docs list it as one remedy, but a workflow that loads everything into memory at once will fail again as the data grows, so it is usually combined with smaller batches.
Should I move to n8n Cloud?
n8n's own pages suggest a larger plan on its cloud and more memory for self-hosting. That is a business choice; I only help you decide with the facts of your usage.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Found a mistake? Tell me.