N8N Memory keeps increasing until it restarts

Describe the problem/error/question

I’m hosting the latest (1.99.1) version of n8n on Heroku. The memory of my instance keeps increasing, looks like a memory leak somewhere. Below is the memory chart over 24h:

On this instance we are running quite a lot of workflows with Schedule Trigger set to run every 1 minute.

Here at 19:00 I changed all of the workflows to run every 3 minutes and also disabled some of the “heavier” ones.

As you can see regardless of it, the memory keeps increasing at the same pace.

What is the error message (if any)?

Here’s the log at the time of crash and restart:

Jun 25 09:36:48 PM app/web.1 <--- Last few GCs --->
Jun 25 09:36:48 PM app/web.1 [12:0x7f6c3a76b000]  4092118 ms: Scavenge (interleaved) 1912.9 (1950.2) -> 1912.1 (1952.2) MB, pooled: 0 MB, 15.48 / 0.00 ms  (average mu = 0.197, current mu = 0.231) task;
Jun 25 09:36:48 PM app/web.1 [12:0x7f6c3a76b000]  4093971 ms: Mark-Compact (reduce) 1915.1 (1953.4) -> 1913.7 (1950.9) MB, pooled: 0 MB, 918.77 / 0.04 ms  (+ 524.5 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 1700 ms) (average mu = 0.295,
Jun 25 09:36:48 PM app/web.1 <--- JS stacktrace --->
Jun 25 09:36:48 PM app/web.1 FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
Jun 25 09:36:48 PM app/web.1 ----- Native stack trace -----
Jun 25 09:36:48 PM app/web.1 Aborted
Jun 25 09:36:48 PM heroku/router at=info method=GET path="/rest/push?pushRef=lzzizs9yn5" host=automee-automations-14f10e8cef6e.herokuapp.com request_id=0e0eb7e8-057a-4ef2-bcce-91267c72edbb fwd="188.122.5.94" dyno=web.1 connect=0ms service=192171ms status=101 bytes=129 protocol=https
Jun 25 09:36:48 PM heroku/web.1 Process exited with status 134
Jun 25 09:36:48 PM heroku/web.1 State changed from up to crashed
Jun 25 09:36:48 PM heroku/web.1 State changed from crashed to starting
Jun 25 09:37:08 PM heroku/web.1 Starting process with command `/entrypoint.sh`

Please share your workflow

I have a lot of similar workflows like this (with schedule trigger instead of Google Drive New FIle trigger due to the fact that Google Drive New File tirgger is bugged when uploading larger amount of files at the same time):

Information on your n8n setup

  • n8n version: 1.91.1
  • Database (default: SQLite): Postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main): Default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Heroku
  • Operating system: Heroku Medium Dyno

Worst part is that after it crashes and restarts all these schedule triggers stop working, they do not fire anymore after restart until I turn the workflow off and on, or trigger it manually.