Frequent Unknown failures with Unhandled Promise Rejection Warning

Looking through my logs last night and noticed that I am seeing quite a bit of sub workflows failing due to unknown reason. When looking at the debugs I see the following printed every time this happens:


2021-10-13T14:10:58.670Z | verbose  | Start external error workflow {"errorWorkflowId":"1","workflowId":38,"file":"WorkflowExecuteAdditionalData.js","function":"executeErrorWorkflow"},
(node:7) UnhandledPromiseRejectionWarning: Error: job stalled more than maxStalledCount,
    at Queue.onFailed (/usr/local/lib/node_modules/n8n/node_modules/bull/lib/job.js:516:18),
    at Queue.emit (events.js:315:20),
    at Queue.EventEmitter.emit (domain.js:467:12),
    at Redis.messageHandler (/usr/local/lib/node_modules/n8n/node_modules/bull/lib/queue.js:444:14),
    at Redis.emit (events.js:315:20),
    at Redis.EventEmitter.emit (domain.js:467:12),
    at DataHandler.handleSubscriberReply (/usr/local/lib/node_modules/n8n/node_modules/ioredis/built/DataHandler.js:80:32),
    at DataHandler.returnReply (/usr/local/lib/node_modules/n8n/node_modules/ioredis/built/DataHandler.js:47:18),
    at JavascriptRedisParser.returnReply (/usr/local/lib/node_modules/n8n/node_modules/ioredis/built/DataHandler.js:21:22),
    at JavascriptRedisParser.execute (/usr/local/lib/node_modules/n8n/node_modules/redis-parser/lib/parser.js:544:14),
    at Socket.<anonymous> (/usr/local/lib/node_modules/n8n/node_modules/ioredis/built/DataHandler.js:25:20),
    at Socket.emit (events.js:315:20),
    at Socket.EventEmitter.emit (domain.js:467:12),
    at addChunk (internal/streams/readable.js:309:12),
    at readableAddChunk (internal/streams/readable.js:284:9),
    at Socket.Readable.push (internal/streams/readable.js:223:10),
    at TCP.onStreamRead (internal/stream_base_commons.js:188:23),
(node:7) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 57)

Any ideas on how to resolve this?

Hey @willfore,

What version of n8n are you running and how do you have it setup? Does it seem to impact all workflows or just certain ones and do they have anything in common?

I’m running 0.139.1 in queue mode on docker. It seems to only impact the sub workflow and the parent workflow fails as well of course but it shows a failure reason. All other workflows run fine.

Hi @willfore, thanks for posting.

Sadly our queue-mode expert is out until the 25th, but I’ll assign him to this thread so that he can pick it up when he gets back.

Is there a way to change the value of maxStalledCount?