I am getting messages when executing a code node of pretty small size that indicate a possible out of memory error.
I am running n8n via pm2 on my own virtual server, which has 16GB of memory available. I have not seen n8n use more than 300mb of memory.
Is there a configuration step I need to enable using more than 300mb of memory during executions?
Thanks in advance; I see some other posts that might be relevant, but they all seem to relate to cloud hosted instances, and don’t include any details other than “provision more memory” which I’m assuming means to the physical server.
It sounds like it is going to more of a pm2 question than an n8n one. I did a quick search online and found that if you are not using a pm2 ecosystem file you can do something like --node-args='--max-old-space-size=600M'
But you may not actually be hitting a memory limit, What is your workflow doing and what does the n8n output in the pm2 log say?
I didn’t see that n8n had anything in an error log; thanks for mentioning this.
This workflow has worked, and has gone mostly unchanged except a few n8n upgrades.
With this last upgrade, which skipped a few versions has made me start chasing resource issues; I’ve upgraded from sqlite to mysql (reimported workflows, no migration).
Here is the error for my log, repeated several times:
There was a problem running hook "workflowExecuteAfter" TypeError: Method Date.prototype.toISOString called on incompatible receiver [object Object]
at Proxy.toISOString (<anonymous>)
at Proxy.toJSON (<anonymous>)
at stringifyFnReplacer (/usr/lib/node_modules/n8n/node_modules/safe-stable-stringify/index.js:182:21)
at stringifyFnReplacer (/usr/lib/node_modules/n8n/node_modules/safe-stable-stringify/index.js:256:23)
at stringifyFnReplacer (/usr/lib/node_modules/n8n/node_modules/safe-stable-stringify/index.js:256:23)
at stringifyFnReplacer (/usr/lib/node_modules/n8n/node_modules/safe-stable-stringify/index.js:256:23)
at stringifyFnReplacer (/usr/lib/node_modules/n8n/node_modules/safe-stable-stringify/index.js:256:23)
at stringifyFnReplacer (/usr/lib/node_modules/n8n/node_modules/safe-stable-stringify/index.js:221:23)
at stringifyFnReplacer (/usr/lib/node_modules/n8n/node_modules/safe-stable-stringify/index.js:221:23)
at stringifyFnReplacer (/usr/lib/node_modules/n8n/node_modules/safe-stable-stringify/index.js:256:23)
at stringifyFnReplacer (/usr/lib/node_modules/n8n/node_modules/safe-stable-stringify/index.js:256:23)
at stringifyFnReplacer (/usr/lib/node_modules/n8n/node_modules/safe-stable-stringify/index.js:221:23)
at stringifyFnReplacer (/usr/lib/node_modules/n8n/node_modules/safe-stable-stringify/index.js:256:23)
at stringifyFnReplacer (/usr/lib/node_modules/n8n/node_modules/safe-stable-stringify/index.js:256:23)
at stringifyFnReplacer (/usr/lib/node_modules/n8n/node_modules/safe-stable-stringify/index.js:256:23)
at stringifyFnReplacer (/usr/lib/node_modules/n8n/node_modules/safe-stable-stringify/index.js:217:25)
at stringifyFnReplacer (/usr/lib/node_modules/n8n/node_modules/safe-stable-stringify/index.js:256:23)
at stringify (/usr/lib/node_modules/n8n/node_modules/safe-stable-stringify/index.js:598:18)
at Format.transform (/usr/lib/node_modules/n8n/node_modules/logform/json.js:28:19)
at DerivedLogger._transform (/usr/lib/node_modules/n8n/node_modules/winston/lib/winston/logger.js:313:29)
at DerivedLogger.Transform._read (/usr/lib/node_modules/n8n/node_modules/readable-stream/lib/_stream_transform.js:166:10)
at DerivedLogger.Transform._write (/usr/lib/node_modules/n8n/node_modules/readable-stream/lib/_stream_transform.js:155:83)
at doWrite (/usr/lib/node_modules/n8n/node_modules/readable-stream/lib/_stream_writable.js:390:139)
at writeOrBuffer (/usr/lib/node_modules/n8n/node_modules/readable-stream/lib/_stream_writable.js:381:5)
at DerivedLogger.Writable.write (/usr/lib/node_modules/n8n/node_modules/readable-stream/lib/_stream_writable.js:302:11)
at DerivedLogger.log (/usr/lib/node_modules/n8n/node_modules/winston/lib/winston/logger.js:252:14)
at Logger.log (/usr/lib/node_modules/n8n/src/Logger.ts:93:15)
at Logger.error (/usr/lib/node_modules/n8n/src/Logger.ts:107:8)
at WorkflowRunnerProcess.sendHookToParentProcess (/usr/lib/node_modules/n8n/src/WorkflowRunnerProcess.ts:342:16)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at WorkflowHooks.hookFunctions.workflowExecuteAfter (/usr/lib/node_modules/n8n/src/WorkflowRunnerProcess.ts:371:6)
at WorkflowHooks.executeHookFunctions (/usr/lib/node_modules/n8n/node_modules/n8n-workflow/src/WorkflowHooks.ts:45:5)
at /usr/lib/node_modules/n8n/node_modules/n8n-core/src/WorkflowExecute.ts:1242:6
You can see in the nodes, I’m taking nested JSON from the SNS trigger, breaking it out, and then running a series of regex to extract some matching data into fields for use in a telegram message.
Perfect, so that log error is something we know about and will be fixed soon. It sounds like it might not be a memory issue which is always good. For now can you install 0.220.1 and let me know if that works for you.
Thanks all; I figured out that rolling back is just as easy as with git – npm install -g [email protected]
However, my workflow still has an error, although its an error I had after the one I previously pasted, and had assumed that was related to not being able to safely stop the execution (because of memory problems)
Error fetching feature flags ReferenceError: AbortSignal is not defined
at PostHog.<anonymous> (/usr/lib/node_modules/n8n/node_modules/posthog-core/src/index.ts:460:6)
at step (/usr/lib/node_modules/n8n/node_modules/node_modules/tslib/tslib.es6.js:102:23)
at Object.next (/usr/lib/node_modules/n8n/node_modules/node_modules/tslib/tslib.es6.js:83:53)
at /usr/lib/node_modules/n8n/node_modules/node_modules/tslib/tslib.es6.js:76:71
at new Promise (<anonymous>)
at __awaiter (/usr/lib/node_modules/n8n/node_modules/node_modules/tslib/tslib.es6.js:72:12)
at PostHogCoreStateless.fetchWithRetry (/usr/lib/node_modules/n8n/node_modules/posthog-node/lib/index.cjs.js:1063:16)
at PostHog.<anonymous> (/usr/lib/node_modules/n8n/node_modules/posthog-core/src/index.ts:219:17)
at step (/usr/lib/node_modules/n8n/node_modules/node_modules/tslib/tslib.es6.js:102:23)
at Object.next (/usr/lib/node_modules/n8n/node_modules/node_modules/tslib/tslib.es6.js:83:53)
at /usr/lib/node_modules/n8n/node_modules/node_modules/tslib/tslib.es6.js:76:71
at new Promise (<anonymous>)
at __awaiter (/usr/lib/node_modules/n8n/node_modules/node_modules/tslib/tslib.es6.js:72:12)
at PostHogCoreStateless.getDecide (/usr/lib/node_modules/n8n/node_modules/posthog-node/lib/index.cjs.js:833:16)
at PostHog.<anonymous> (/usr/lib/node_modules/n8n/node_modules/posthog-core/src/index.ts:318:39)
at step (/usr/lib/node_modules/n8n/node_modules/node_modules/tslib/tslib.es6.js:102:23)
at Object.next (/usr/lib/node_modules/n8n/node_modules/node_modules/tslib/tslib.es6.js:83:53)
at /usr/lib/node_modules/n8n/node_modules/node_modules/tslib/tslib.es6.js:76:71
at new Promise (<anonymous>)
at __awaiter (/usr/lib/node_modules/n8n/node_modules/node_modules/tslib/tslib.es6.js:72:12)
at PostHog.call [as getFeatureFlagsAndPayloadsStateless] (/usr/lib/node_modules/n8n/node_modules/posthog-node/lib/index.cjs.>
at PostHog.<anonymous> (/usr/lib/node_modules/n8n/node_modules/posthog-node/src/posthog-node.ts:324:85)
at step (/usr/lib/node_modules/n8n/node_modules/node_modules/tslib/tslib.es6.js:102:23)
at Object.next (/usr/lib/node_modules/n8n/node_modules/node_modules/tslib/tslib.es6.js:83:53)
at fulfilled (/usr/lib/node_modules/n8n/node_modules/node_modules/tslib/tslib.es6.js:73:58)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
@Jon thanks for asking. Yes the workflow is still failing with the same non descriptive error message (in the UI) and only what I pasted in my last in the PM2 error log.
@Jon I am travelling this morning, away from my PC just now; but I did put the workflow in a prior reply; I’ll be back in a few hours and can paste it again if you can’t find it.
You did I missed it, I guess a couple of other questions for when you are back… What version of node are you using and what OS are you running on (I assume Linux)
I am running on Debian 11 Linux; with PM2, and I just downgraded to 220.1; I last remember it working on 218.1; so I might downgrade a bit further when I get back to the house in a couple hours.