Memory leaks with the new n8n updates?

I’m not sure if the new updates have memory leaks or became memory intensive for some reason, but all my n8n instances have been having problems.

I’ve upgraded RAM to 2GB and added swap (2-4GB), but it was still having issues until I restarted it and quickly turned off all the workflows. Then it didn’t shut down that time.

I will say, n8n was able to handle more and was super reliable before the recent updates with folders, evaluations, etc.

This is one of the huge workflows I had running. I’ve broken it down into 3 smaller workflows.

Does it matter for memory consumption when the workflow is huge with tons of triggers? or does n8n have to load the entire thing then run it, or does it extract that part of the workflow linked to the trigger then run that?

And I got this error for one of the workflow executions:
Workflow did not finish, possible out-of-memory issue

I’m having these issues with instances I have in droplets on DigitalOcean. I have an 8GB Hetzner server, and I don’t really have any issues with that one.

But these droplets were working amazingly a few versions back, handling even more than what I have right now even with way less RAM..

Please let me know if there’s anything I can do on my end, maybe a config I need to change to make this work better and restore the old performance.

This is my config:


I added those last 3 lines when I started having issues. It helped a little.

Thanks in advance!

Update: As soon an I turn a couple of those workflows on (Not th huge ones), it freezes and stops working again..

It is recommended that you upgrade your device, enable the default multi-worker operation mode of Queue, and distribute tasks to multiple workers for load execution

You can also split workflows by function, and then string multiple workflows together, which is easier to maintain and disperses the pressure on a single node

1 Like

Try to remove N8N_RUNNERS_ENABLED=true. There seems to be currently issues with the runners.

1 Like

A task-runner related memory leak was fixed in [email protected]. Could you kindly confirm the issue is resolved for you on that version?

2 Likes

In the process of migrating to an 8GB RAM server, but still need to fix the current n8n instances I already have. I’ve been wanting to set up Queue mode for a long time now, just didn’t have the time to run a test and learn how to do it.

Also, I want to highlight how efficient n8n was in previous versions, even with lower RAM. I believe there’s a memory leak bug that needs to be addressed. We can’t keep increasing RAM when there’s a fundamental performance issue.

Tried this with no luck :confused:

Updated to n8n:next (1.97.1) and I’m still facing the same issue, as soon as I turn on those few workflows, it stops working and freezes..

These are the logs:

root@n8n-go:/opt/n8n-docker-caddy# docker compose logs -t n8n
WARN[0000] /opt/n8n-docker-caddy/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion 
n8n-1  | 2025-06-08T16:50:02.992681719Z User settings loaded from: /home/node/.n8n/config
n8n-1  | 2025-06-08T16:50:05.246553721Z Initializing n8n process
n8n-1  | 2025-06-08T16:50:06.050411519Z n8n ready on ::, port 5678
n8n-1  | 2025-06-08T16:50:06.064754758Z 
n8n-1  | 2025-06-08T16:50:06.064791648Z There is a deprecation related to your environment variables. Please take the recommended actions to update your configuration:
n8n-1  | 2025-06-08T16:50:06.064796148Z  - N8N_RUNNERS_ENABLED -> Running n8n without task runners is deprecated. Task runners will be turned on by default in a future version. Please set `N8N_RUNNERS_ENABLED=true` to enable task runners now and avoid potential issues in the future. Learn more: https://docs.n8n.io/hosting/configuration/task-runners/
n8n-1  | 2025-06-08T16:50:06.064799968Z 
n8n-1  | 2025-06-08T16:50:06.144469053Z [license SDK] Skipping renewal on init because renewal is not due yet or cert is not initialized
n8n-1  | 2025-06-08T16:50:09.014804502Z Version: 1.97.1
n8n-1  | 2025-06-08T16:50:09.194276619Z  ================================
n8n-1  | 2025-06-08T16:50:09.194637857Z    Start Active Workflows:
n8n-1  | 2025-06-08T16:50:09.195061515Z  ================================
n8n-1  | 2025-06-08T16:51:04.296536544Z 
n8n-1  | 2025-06-08T16:51:04.296621912Z <--- Last few GCs --->
n8n-1  | 2025-06-08T16:51:04.296629283Z 
n8n-1  | 2025-06-08T16:51:04.296634752Z [6:0x7fd03285e690]    63419 ms: Mark-Compact (reduce) 510.1 (532.2) -> 507.2 (529.5) MB, 248.49 / 0.00 ms  (+ 49.5 ms in 19 steps since start of marking, biggest step 16.8 ms, walltime since start of marking 436 ms) (average mu = 0.344, current mu = 0.395[6:0x7fd03285e690]    63462 ms: Scavenge 508.8 (529.7) -> 507.9 (532.7) MB, 1.86 / 0.00 ms  (average mu = 0.344, current mu = 0.395) allocation failure; 
n8n-1  | 2025-06-08T16:51:04.303916233Z 
n8n-1  | 2025-06-08T16:51:04.304027312Z 
n8n-1  | 2025-06-08T16:51:04.304059812Z <--- JS stacktrace --->
n8n-1  | 2025-06-08T16:51:04.304065052Z 
n8n-1  | 2025-06-08T16:51:04.304980588Z FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
n8n-1  | 2025-06-08T16:51:04.306936210Z ----- Native stack trace -----
n8n-1  | 2025-06-08T16:51:04.306950940Z 
n8n-1  | 2025-06-08T16:51:07.044055792Z User settings loaded from: /home/node/.n8n/config
n8n-1  | 2025-06-08T16:51:08.946615812Z Last session crashed
n8n-1  | 2025-06-08T16:51:18.962945726Z Initializing n8n process
n8n-1  | 2025-06-08T16:51:19.559270708Z n8n ready on ::, port 5678
n8n-1  | 2025-06-08T16:51:19.572705251Z 
n8n-1  | 2025-06-08T16:51:19.572751551Z There is a deprecation related to your environment variables. Please take the recommended actions to update your configuration:
n8n-1  | 2025-06-08T16:51:19.572756991Z  - N8N_RUNNERS_ENABLED -> Running n8n without task runners is deprecated. Task runners will be turned on by default in a future version. Please set `N8N_RUNNERS_ENABLED=true` to enable task runners now and avoid potential issues in the future. Learn more: https://docs.n8n.io/hosting/configuration/task-runners/
n8n-1  | 2025-06-08T16:51:19.572762331Z 
n8n-1  | 2025-06-08T16:51:19.641833513Z [license SDK] Skipping renewal on init because renewal is not due yet or cert is not initialized
n8n-1  | 2025-06-08T16:51:22.317939520Z Version: 1.97.1
n8n-1  | 2025-06-08T16:51:22.461891889Z  ================================
n8n-1  | 2025-06-08T16:51:22.462264558Z    Start Active Workflows:
n8n-1  | 2025-06-08T16:51:22.462592236Z  ================================
n8n-1  | 2025-06-08T16:52:16.268393552Z 
n8n-1  | 2025-06-08T16:52:16.268448892Z <--- Last few GCs --->
n8n-1  | 2025-06-08T16:52:16.268454322Z 
n8n-1  | 2025-06-08T16:52:16.268457572Z [6:0x7fcac96a1690]    70410 ms: Scavenge (reduce) 508.0 (530.4) -> 507.1 (530.4) MB, 1.96 / 0.00 ms  (average mu = 0.284, current mu = 0.210) allocation failure; 
n8n-1  | 2025-06-08T16:52:16.274926885Z [6:0x7fcac96a1690]    70860 ms: Mark-Compact (reduce) 508.6 (530.6) -> 505.6 (530.6) MB, 394.28 / 0.00 ms  (+ 27.9 ms in 2 steps since start of marking, biggest step 27.8 ms, walltime since start of marking 439 ms) (average mu = 0.259, current mu = 0.235)
n8n-1  | 2025-06-08T16:52:16.275035745Z 
n8n-1  | 2025-06-08T16:52:16.275045175Z <--- JS stacktrace --->
n8n-1  | 2025-06-08T16:52:16.275048725Z 
n8n-1  | 2025-06-08T16:52:16.275143224Z FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
n8n-1  | 2025-06-08T16:52:16.275231844Z ----- Native stack trace -----
n8n-1  | 2025-06-08T16:52:16.275241214Z 
n8n-1  | 2025-06-08T16:52:18.682810337Z User settings loaded from: /home/node/.n8n/config
n8n-1  | 2025-06-08T16:52:20.577028635Z Last session crashed
n8n-1  | 2025-06-08T16:52:30.590949554Z Initializing n8n process
n8n-1  | 2025-06-08T16:52:31.188177685Z n8n ready on ::, port 5678
n8n-1  | 2025-06-08T16:52:31.199034369Z 
n8n-1  | 2025-06-08T16:52:31.199073499Z There is a deprecation related to your environment variables. Please take the recommended actions to update your configuration:
n8n-1  | 2025-06-08T16:52:31.199078319Z  - N8N_RUNNERS_ENABLED -> Running n8n without task runners is deprecated. Task runners will be turned on by default in a future version. Please set `N8N_RUNNERS_ENABLED=true` to enable task runners now and avoid potential issues in the future. Learn more: https://docs.n8n.io/hosting/configuration/task-runners/
n8n-1  | 2025-06-08T16:52:31.199081788Z 
n8n-1  | 2025-06-08T16:52:31.261207001Z [license SDK] Skipping renewal on init because renewal is not due yet or cert is not initialized
n8n-1  | 2025-06-08T16:52:34.093201897Z Version: 1.97.1
n8n-1  | 2025-06-08T16:52:34.254388247Z  ================================
n8n-1  | 2025-06-08T16:52:34.254954615Z    Start Active Workflows:
n8n-1  | 2025-06-08T16:52:34.255337923Z  ================================
n8n-1  | 2025-06-08T16:53:29.068579148Z 
n8n-1  | 2025-06-08T16:53:29.068660628Z <--- Last few GCs --->
n8n-1  | 2025-06-08T16:53:29.068665488Z 
n8n-1  | 2025-06-08T16:53:29.078976866Z [6:0x7f0c744d7690]    71808 ms: Mark-Compact (reduce) 510.1 (533.7) -> 507.3 (530.9) MB, 277.14 / 0.01 ms  (+ 65.3 ms in 19 steps since start of marking, biggest step 17.2 ms, walltime since start of marking 470 ms) (average mu = 0.348, current mu = 0.352
n8n-1  | 2025-06-08T16:53:29.079126685Z 
n8n-1  | 2025-06-08T16:53:29.079135925Z <--- JS stacktrace --->
n8n-1  | 2025-06-08T16:53:29.079139285Z 
n8n-1  | 2025-06-08T16:53:29.079251774Z FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
n8n-1  | 2025-06-08T16:53:29.079318615Z ----- Native stack trace -----
n8n-1  | 2025-06-08T16:53:29.079326884Z 
n8n-1  | 2025-06-08T16:53:31.612945122Z User settings loaded from: /home/node/.n8n/config
n8n-1  | 2025-06-08T16:53:33.511396184Z Last session crashed
n8n-1  | 2025-06-08T16:53:43.522954551Z Initializing n8n process
n8n-1  | 2025-06-08T16:53:44.153556798Z n8n ready on ::, port 5678
n8n-1  | 2025-06-08T16:53:44.164289034Z 
n8n-1  | 2025-06-08T16:53:44.164311004Z There is a deprecation related to your environment variables. Please take the recommended actions to update your configuration:
n8n-1  | 2025-06-08T16:53:44.164326194Z  - N8N_RUNNERS_ENABLED -> Running n8n without task runners is deprecated. Task runners will be turned on by default in a future version. Please set `N8N_RUNNERS_ENABLED=true` to enable task runners now and avoid potential issues in the future. Learn more: https://docs.n8n.io/hosting/configuration/task-runners/
n8n-1  | 2025-06-08T16:53:44.164330594Z 
n8n-1  | 2025-06-08T16:53:44.230036441Z [license SDK] Skipping renewal on init because renewal is not due yet or cert is not initialized
n8n-1  | 2025-06-08T16:53:46.918745035Z Version: 1.97.1
n8n-1  | 2025-06-08T16:53:47.035744651Z  ================================
n8n-1  | 2025-06-08T16:53:47.036181038Z    Start Active Workflows:
n8n-1  | 2025-06-08T16:53:47.036559667Z  ================================
n8n-1  | 2025-06-08T16:53:47.402379841Z    - "CI - Software Expense Tracking" (ID: YXA2vktqzUDneLym))
n8n-1  | 2025-06-08T16:53:47.402677501Z      => Started
n8n-1  | 2025-06-08T16:53:49.242362672Z    - "CI - Ideas & Issues System" (ID: ewnTC0jIhPe0Pl2Z))
n8n-1  | 2025-06-08T16:53:49.242918839Z      => Started
n8n-1  | 2025-06-08T16:53:49.816536105Z    - "CI - Knowledge Base system" (ID: 1B0PfT1OvyUj6rQA))
n8n-1  | 2025-06-08T16:53:49.817049742Z      => Started
n8n-1  | 2025-06-08T16:53:49.817877680Z 
n8n-1  | 2025-06-08T16:53:49.817891129Z Editor is now accessible via:
n8n-1  | 2025-06-08T16:53:49.817894479Z https://[REDACTED-URL]
n8n-1  | 2025-06-08T17:09:06.600588862Z 
n8n-1  | 2025-06-08T17:09:06.600629991Z <--- Last few GCs --->
n8n-1  | 2025-06-08T17:09:06.600634671Z 
n8n-1  | 2025-06-08T17:09:06.600637251Z [6:0x7fc25eb8f690]   936410 ms: Mark-Compact (reduce) 509.4 (530.7) -> 507.7 (530.7) MB, 446.91 / 0.00 ms  (average mu = 0.157, current mu = 0.120) allocation failure; scavenge might not succeed
n8n-1  | 2025-06-08T17:09:06.614991652Z 
n8n-1  | 2025-06-08T17:09:06.615110672Z 
n8n-1  | 2025-06-08T17:09:06.615119522Z <--- JS stacktrace --->
n8n-1  | 2025-06-08T17:09:06.615141272Z 
n8n-1  | 2025-06-08T17:09:06.615255901Z FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
n8n-1  | 2025-06-08T17:09:06.615335491Z ----- Native stack trace -----
n8n-1  | 2025-06-08T17:09:06.615344371Z 
n8n-1  | 2025-06-08T17:09:09.439709516Z User settings loaded from: /home/node/.n8n/config
n8n-1  | 2025-06-08T17:09:11.182331763Z Last session crashed
n8n-1  | 2025-06-08T17:09:21.214980419Z Initializing n8n process
n8n-1  | 2025-06-08T17:09:21.889074998Z n8n ready on ::, port 5678
n8n-1  | 2025-06-08T17:09:21.901365677Z 
n8n-1  | 2025-06-08T17:09:21.901400397Z There is a deprecation related to your environment variables. Please take the recommended actions to update your configuration:
n8n-1  | 2025-06-08T17:09:21.901406307Z  - N8N_RUNNERS_ENABLED -> Running n8n without task runners is deprecated. Task runners will be turned on by default in a future version. Please set `N8N_RUNNERS_ENABLED=true` to enable task runners now and avoid potential issues in the future. Learn more: https://docs.n8n.io/hosting/configuration/task-runners/
n8n-1  | 2025-06-08T17:09:21.901412067Z 
n8n-1  | 2025-06-08T17:09:21.972881341Z [license SDK] Skipping renewal on init because renewal is not due yet or cert is not initialized
n8n-1  | 2025-06-08T17:09:24.869764283Z Version: 1.97.1
n8n-1  | 2025-06-08T17:09:25.034998359Z  ================================
n8n-1  | 2025-06-08T17:09:25.035640226Z    Start Active Workflows:
n8n-1  | 2025-06-08T17:09:25.036207485Z  ================================
root@n8n-go:/opt/n8n-docker-caddy#

At least we can now safely rule out the (now fixed) memory leak in the task runners as the cause. It should be safe to re-enable them by setting N8N_RUNNERS_ENABLED=true.

One thing to double-check: it looks like you’re setting NODE_OPTIONS=--max-old-space-size=512. That flag actually limits the memory available to Node.js to just 512 MB. Unless this was intentional, I’d recommend either removing it or increasing the value significantly to avoid unnecessary memory constraints.

1 Like

I added N8N_RUNNERS_ENABLED=true back

  • I switched the Node.js memory to 2048

Still had the same issue

Then removed the Node.js memory limit line from the .yml file (keeping N8N_RUNNERS_ENABLED=true)

Same problem, it crashes as soon as it starts, unless I manage to quickly turn off those 3 active workflows. [which in most cases only possible when I have NODE_OPTIONS=--max-old-space-size=512]

These are the logs of the n8n instance firing up:

root@[HOSTNAME]:/opt/n8n-docker-caddy# docker compose up
WARN[0000] /opt/n8n-docker-caddy/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion 
[+] Running 3/3
 ✔ Network n8n-docker-caddy_default    Created                                                                                        0.1s 
 ✔ Container n8n-docker-caddy-n8n-1    Created                                                                                        0.1s 
 ✔ Container n8n-docker-caddy-caddy-1  Created                                                                                        0.1s 
Attaching to caddy-1, n8n-1
caddy-1  | {"level":"info","ts":1749413006.730384,"msg":"maxprocs: Leaving GOMAXPROCS=1: CPU quota undefined"}
caddy-1  | {"level":"info","ts":1749413006.7313514,"msg":"GOMEMLIMIT is updated","package":"github.com/KimMachineGun/automemlimit/memlimit","GOMEMLIMIT":1853374464,"previous":9223372036854775807}
caddy-1  | {"level":"info","ts":1749413006.7322245,"msg":"using config from file","file":"/etc/caddy/Caddyfile"}
caddy-1  | {"level":"info","ts":1749413006.7346182,"msg":"adapted config to JSON","adapter":"caddyfile"}
caddy-1  | {"level":"warn","ts":1749413006.7348614,"msg":"Caddyfile input is not formatted; run 'caddy fmt --overwrite' to fix inconsistencies","adapter":"caddyfile","file":"/etc/caddy/Caddyfile","line":2}
caddy-1  | {"level":"info","ts":1749413006.7373714,"logger":"admin","msg":"admin endpoint started","address":"localhost:2019","enforce_origin":false,"origins":["//127.0.0.1:2019","//localhost:2019","//[::1]:2019"]}
caddy-1  | {"level":"info","ts":1749413006.738037,"logger":"http.auto_https","msg":"server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS","server_name":"srv0","https_port":443}
caddy-1  | {"level":"info","ts":1749413006.738272,"logger":"http.auto_https","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}
caddy-1  | {"level":"info","ts":1749413006.739473,"logger":"http","msg":"enabling HTTP/3 listener","addr":":443"}
caddy-1  | {"level":"info","ts":1749413006.7402198,"msg":"failed to sufficiently increase receive buffer size (was: 208 kiB, wanted: 7168 kiB, got: 416 kiB). See https://github.com/quic-go/quic-go/wiki/UDP-Buffer-Sizes for details."}
caddy-1  | {"level":"info","ts":1749413006.74172,"logger":"http.log","msg":"server running","name":"srv0","protocols":["h1","h2","h3"]}
caddy-1  | {"level":"warn","ts":1749413006.7419899,"logger":"http","msg":"HTTP/2 skipped because it requires TLS","network":"tcp","addr":":80"}
caddy-1  | {"level":"warn","ts":1749413006.742157,"logger":"http","msg":"HTTP/3 skipped because it requires TLS","network":"tcp","addr":":80"}
caddy-1  | {"level":"info","ts":1749413006.7423573,"logger":"http.log","msg":"server running","name":"remaining_auto_https_redirects","protocols":["h1","h2","h3"]}
caddy-1  | {"level":"info","ts":1749413006.742572,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["[DOMAIN]"]}
caddy-1  | {"level":"warn","ts":1749413006.74493,"logger":"tls","msg":"stapling OCSP","error":"no OCSP stapling for [[DOMAIN]]: no OCSP server specified in certificate","identifiers":["[DOMAIN]"]}
caddy-1  | {"level":"info","ts":1749413006.7459815,"msg":"autosaved config (load with --resume flag)","file":"/config/caddy/autosave.json"}
caddy-1  | {"level":"info","ts":1749413006.7461538,"msg":"serving initial configuration"}
caddy-1  | {"level":"info","ts":1749413006.749712,"logger":"tls","msg":"storage cleaning happened too recently; skipping for now","storage":"FileStorage:/data/caddy","instance":"[INSTANCE_ID]","try_again":1749499406.7497106,"try_again_in":86399.99999963}
caddy-1  | {"level":"info","ts":1749413006.7497888,"logger":"tls","msg":"finished cleaning storage units"}
caddy-1  | {"level":"info","ts":1749413006.7502124,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"[MEMORY_ADDRESS]"}
n8n-1    | User settings loaded from: /home/node/.n8n/config
n8n-1    | Last session crashed
n8n-1    | Initializing n8n process
n8n-1    | n8n ready on ::, port 5678
n8n-1    | n8n Task Broker ready on 127.0.0.1, port 5679
n8n-1    | [license SDK] Skipping renewal on init because renewal is not due yet or cert is not initialized
n8n-1    | Registered runner "JS Task Runner" ([RUNNER_ID]) 
n8n-1    | Version: 1.97.1
n8n-1    |  ================================
n8n-1    |    Start Active Workflows:
n8n-1    |  ================================
n8n-1    | 
n8n-1    | <--- Last few GCs --->
n8n-1    | 
n8n-1    | [7:[MEMORY_ADDRESS]]   114363 ms: Mark-Compact 955.7 (1002.2) -> 943.7 (1002.2) MB, 634.89 / 0.00 ms  (average mu = 0.282, current mu = 0.255) allocation failure; scavenge might not succeed
n8n-1    | [7:[MEMORY_ADDRESS]]   115255 ms: Mark-Compact 957.5 (1004.0) -> 945.4 (1004.0) MB, 688.50 / 0.00 ms  (average mu = 0.255, current mu = 0.228) allocation failure; scavenge might not succeed
n8n-1    | 
n8n-1    | 
n8n-1    | <--- JS stacktrace --->
n8n-1    | 
n8n-1    | FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
n8n-1    | ----- Native stack trace -----
n8n-1    | 
caddy-1  | {"level":"error","ts":1749413122.9765534,"logger":"http.log.error","msg":"read tcp [INTERNAL_IP]:[PORT]->[INTERNAL_IP]:[PORT]: read: connection reset by peer","request":{"remote_ip":"[CLIENT_IP]","remote_port":"[PORT]","client_ip":"[CLIENT_IP]","proto":"HTTP/2.0","method":"GET","host":"[DOMAIN]","uri":"/rest/workflows?includeScopes=true&includeFolders=true&filter=%7B%22projectId%22%3A%22[PROJECT_ID]%22%2C%22isArchived%22%3Afalse%7D&skip=0&take=1","headers":{"Sec-Fetch-Site":["same-origin"],"Accept-Language":["en"],"Sec-Fetch-Mode":["cors"],"Push-Ref":["[PUSH_REF]"],"Cookie":["[REDACTED]"],"Sec-Ch-Ua-Platform":["\"macOS\""],"Accept":["application/json, text/plain, */*"],"If-None-Match":["W/\"[ETAG]\""],"Priority":["u=1, i"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"],"Sec-Ch-Ua":["\"Not.A/Brand\";v=\"99\", \"Chromium\";v=\"136\""],"Browser-Id":["[BROWSER_ID]"],"Dnt":["1"],"Accept-Encoding":["gzip, deflate, br, zstd"],"Sec-Fetch-Dest":["empty"],"Sec-Ch-Ua-Mobile":["?0"]},"tls":{"resumed":true,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"[DOMAIN]"}},"duration":83.007847709,"status":502,"err_id":"[ERROR_ID]","err_trace":"reverseproxy.statusError (reverseproxy.go:1390)"}
[... additional error logs with similar pattern of redacted sensitive information ...]
n8n-1 exited with code 0
[... more connection refused errors with redacted sensitive information ...]
n8n-1    | User settings loaded from: /home/node/.n8n/config
n8n-1    | Last session crashed
n8n-1    | Initializing n8n process
n8n-1    | n8n ready on ::, port 5678
n8n-1    | n8n Task Broker ready on 127.0.0.1, port 5679
n8n-1    | [license SDK] Skipping renewal on init because renewal is not due yet or cert is not initialized
n8n-1    | Registered runner "JS Task Runner" ([RUNNER_ID]) 
n8n-1    | Version: 1.97.1
n8n-1    |  ================================
n8n-1    |    Start Active Workflows:
n8n-1    |  ================================

More info:

Stats with all workflows off for 1.97.1 (2 GB Memory / 1 AMD vCPU / 25 GB Disk)

lmk if I can provide anything else to help identify the problem

Also, can I safely revert back to an older n8n version? I need those production instances for Monday :confused:

Maybe it’s the stats causing this..?

Hey @brahimh,

You should be ok to try an older version, Do you know which version you were on before you updated?

Are you able to share the workflows with us so we can take a look at them? For now I would keep the runners disabled, drop the old space change which I think you have already done and try something older while we look into it.

Can you also share the size of your sqlite database?

One thing you could do is export all of your workflows and credentials then rename the database (safe to delete it once everything is back), install an older n8n version and import everything again that would at least remove any extra data and you can pick any n8n version to install.

1 Like

@Jon I’m not sure which version I was on. I was having memory problems a long time ago, but only when performing heavy tasks, like using the n8n API to process tons of n8n executions. But even then it was only giving a memory error, not shutting down completely.

For context, I had a droplet that stopped working either after I added that workflow, after an update, or both - I don’t really remember.

I created a fresh droplet and imported all the workflows, then that one also started having problems. So maybe it’s this workflow, but in some cases when testing, I left this workflow off and it still froze.

ORIGINAL Droplet

~/.n8n $ ls -la
total 8013780
drwxr-sr-x    6 node     node          4096 Jun  9 22:55 .
drwxr-sr-x    1 node     node          4096 Jun 10 05:50 ..
drwxr-sr-x    2 node     node          4096 Nov 27  2023 binaryData
-rw-------    1 node     node            56 Nov 27  2023 config
-rw-r--r--    1 node     node             0 Jun  8 02:55 crash.journal
-rw-r--r--    1 node     node     8206065664 Jun  9 22:55 database.sqlite
drwxr-sr-x    2 node     node          4096 Nov 27  2023 git
-rw-r--r--    1 node     node             0 Jun  8 02:54 n8nEventLog-1.log
-rw-r--r--    1 node     node             0 Jun  8 02:51 n8nEventLog-2.log
-rw-r--r--    1 node     node             0 Jun  8 02:48 n8nEventLog-3.log
-rw-r--r--    1 node     node         12103 Jun  9 22:55 n8nEventLog.log
drwxr-sr-x    3 node     node          4096 Nov 30  2023 nodes
drwxr-sr-x    2 node     node          4096 Apr 11  2024 ssh
~/.n8n $ ls -lh database.sqlite
-rw-r--r--    1 node     node        7.6G Jun  9 22:55 database.sqlite
~/.n8n $ du -sh .
7.7G    .
~/.n8n $ ls -lh *.sqlite *.log
-rw-r--r--    1 node     node        7.6G Jun  9 22:55 database.sqlite
-rw-r--r--    1 node     node           0 Jun  8 02:54 n8nEventLog-1.log
-rw-r--r--    1 node     node           0 Jun  8 02:51 n8nEventLog-2.log
-rw-r--r--    1 node     node           0 Jun  8 02:48 n8nEventLog-3.log
-rw-r--r--    1 node     node       11.8K Jun  9 22:55 n8nEventLog.log

FRESH DROPLET:

~/.n8n $ ls -la
total 267116
drwxr-sr-x    6 node     node          4096 Jun 10 05:37 .
drwxr-sr-x    1 node     node          4096 Jun 10 05:48 ..
drwxr-sr-x    2 node     node          4096 Jun  5 18:08 binaryData
-rw-------    1 node     node            56 Jun  5 18:08 config
-rw-r--r--    1 node     node             0 Jun  9 23:07 crash.journal
-rw-r--r--    1 node     node     272142336 Jun 10 05:37 database.sqlite
drwxr-sr-x    2 node     node          4096 Jun  5 18:08 git
-rw-r--r--    1 node     node           620 Jun  9 23:06 n8nEventLog-1.log
-rw-r--r--    1 node     node             0 Jun  9 23:05 n8nEventLog-2.log
-rw-r--r--    1 node     node             0 Jun  9 23:04 n8nEventLog-3.log
-rw-r--r--    1 node     node       1340101 Jun 10 05:37 n8nEventLog.log
drwxr-sr-x    2 node     node          4096 Jun  5 18:08 nodes
drwxr-sr-x    2 node     node          4096 Jun  5 18:08 ssh
~/.n8n $ ls -lh database.sqlite
-rw-r--r--    1 node     node      259.5M Jun 10 05:37 database.sqlite
~/.n8n $ du -sh .
260.9M  .
~/.n8n $ ls -lh *.sqlite *.log
-rw-r--r--    1 node     node      259.5M Jun 10 05:37 database.sqlite
-rw-r--r--    1 node     node         620 Jun  9 23:06 n8nEventLog-1.log
-rw-r--r--    1 node     node           0 Jun  9 23:05 n8nEventLog-2.log
-rw-r--r--    1 node     node           0 Jun  9 23:04 n8nEventLog-3.log
-rw-r--r--    1 node     node        1.3M Jun 10 05:37 n8nEventLog.log
~/.n8n $

This is the most recent workflow I’ve added (n8n was working relatively fine before creating it ..)

[was thinking maybe it’s that A2:ZZZ99999 option, but I changed it to test and it was still laggy and it takes longer to open that workflow or turn it on/off..]

One more details I wanna add to this, the n8n instance that had the problems had the evals feature

+The workflow I shared, in the google sheet trigger I have A2:ZZZ99999 as the Range, I was thinking that might be the problem, but it was freezing even when I switched it to A2:ZZ1000

Still don’t know if any of those is the main issue

Hi @brahimh.
Any news, or updates on this subject. I just updated my self hosted N8N and started experiencing the memory issue similar to yours. did you fix it ?

I believe it was due to a mix of:

  • The n8n update
  • A recently created workflow (the one I shared)

Perhaps both, or maybe neither.

I’ve added swap memory storage to help with that and updated to the recent beta version then.

But I abandoned that original DigitalOcean droplet and created a new one , then migrated all my workflows and credentials (Still had problems).

Now I got another server on Hetzner that I’ll start using as my main server and stop the droplets. The Hetzner one I got has 8GB of RAM and a lot more storage than the droplet, so even if there’s a case of a memory leak, I think it shouldn’t be affected as much.

1 Like

interesting I have a vps of 12GB and 300G in storage yet I have big issues with the AI agent node. Once scenario arrives to this node it crashes and I loose connection with server.

@redsef_ENJRI1 Which n8n version are you on? and did you try the config recommendations above from the n8n team?

@Jon Were you able to figure out the source of the problem with my n8n? maybe it’s the same problem that I had based on the workflow I shared and the logs?

Version: 1.98.2
yeah I followed all recommendations above
Also downgraded to the last version where my scenarios were running fine but no change. The thing is that it only get stuck and cruches when it arrives to AI agent node then I get memory message…

I’m also noticing memory issues in some n8n instances with an AI agent, seems like it’s an n8n memory leak..

1 Like

Need I say more? This is my workflow running on Hostinger n8n setup. Half on version 116 then I downgraded to 114 thinking that was the problem. I am going to make a cron to take docker down and up every night to solve for now. The workflow is just an AI agent with all the google tools hooked up. As you can see doing a docker stop and start releases the memory.

What I can’t understand is why others are not seeing this. When the memory gets high the workflow locks on and will not turn off even when the workflow is deactivated and can’t be turned off no matter what. The only solution I have found is to export all the workflows to json and reload in a fresh instance of n8n and then I have to hook up about 20 credentials. Such a pain.

PS I fixed the problem with the workflow stuck on even when it is deactivated. Wow saved myself so much time. Here are the commands for anyone else who might follow:

root@srv1008667:~# docker exec -u node -it root-n8n-1 n8n update:workflow --all --active=false
Permissions 0644 for n8n settings file /home/node/.n8n/config are too wide. This is ignored for now, but in the future n8n will attempt to change the permissions automatically. To automatically enforce correct permissions now set N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true (recommended), or turn this check off set N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=false.
Deactivating all workflows
Activation or deactivation will not take effect if n8n is running.
Please restart n8n for changes to take effect if n8n is currently running.
root@srv1008667:~# docker stop root-n8n-1
root-n8n-1
root@srv1008667:~# docker start root-n8n-1
root-n8n-1

Please note that this will turn off all your workflows. If you want to only do 1 you can google the n8n cli command to specify the specific workflow.