Job stalled more than max Stalled Count

Where can I read about this problem? I want to figure out how to fix

What is the error message (if any)?

Failed execution
There was a problem executing the
workflow:
“job stalled more than
max Stalled Count”

Please share the workflow

{
  "meta": {
    "instanceId": "c9ac854275bfa2e08489d3d201c3050a1e6dea7b42b40663bd83f030a9efa2a3"
  },
  "nodes": [
    {
      "parameters": {
        "operation": "executeQuery",
        "query": "=SELECT *\nFROM \"users\" INNER JOIN channels ON channels.\"chatId\" = \"users\".\"chatId\"\nWHERE \"users\".\"status\" = '1' AND \"users\".\"chatId\" = '{{$node[\"Set\"].json[\"channelId\"]}}'",
        "additionalFields": {}
      },
      "name": "select users",
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 1,
      "position": [
        1040,
        300
      ],
      "notesInFlow": true,
      "id": "f9a15307-69ec-4dd0-82ef-c6d8e3785133",
      "alwaysOutputData": false,
      "retryOnFail": true,
      "credentials": {
        "postgres": {
          "id": "50",
          "name": "tracker"
        }
      }
    },
    {
      "parameters": {
        "triggerTimes": {
          "item": [
            {
              "mode": "everyWeek",
              "hour": 6,
              "weekday": "5"
            }
          ]
        }
      },
      "id": "0704732d-3d04-4a2f-81a5-60e20de19670",
      "name": "Cron",
      "type": "n8n-nodes-base.cron",
      "typeVersion": 1,
      "position": [
        600,
        300
      ]
    },
    {
      "parameters": {
        "requestMethod": "POST",
        "url": "=https://api.telegram.org/bot{{$items(\"Set\")[0].json[\"token\"]}}/sendMessage",
        "options": {
          "batchInterval": 100,
          "batchSize": 1,
          "useQueryString": true
        },
        "bodyParametersUi": {
          "parameter": [
            {
              "name": "chat_id",
              "value": "={{$node[\"select users\"].json[\"userId\"]}}"
            },
            {
              "name": "text",
              "value": "=-----?"
            },
            {
              "name": "reply_markup",
              "value": "={\"inline_keyboard\":[[{\"text\":\"✅ \",\"callback_data\":\"r2{{$node[\"select users\"].json[\"chatId\"]}}\"}],[{\"text\":\"⏸\",\"callback_data\":\"r1{{$node[\"select users\"].json[\"chatId\"]}}\"}],[{\"text\":\"---",\"callback_data\":\"r0{{$node[\"select users\"].json[\"chatId\"]}}\"}]]}"
            },
            {
              "name": "parse_mode",
              "value": "Markdown"
            },
            {
              "name": "disable_web_page_preview",
              "value": "True"
            }
          ]
        }
      },
      "name": "HTTP Request1",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        1240,
        300
      ],
      "retryOnFail": false,
      "waitBetweenTries": 5000,
      "maxTries": 5,
      "id": "3583d50d-d480-4098-930c-4a627bdfce23",
      "continueOnFail": true
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "token",
              "value": "----"
            },
            {
              "name": "supportLink",
              "value": "https://t.me/sudnik"
            },
            {
              "name": "welcomeMessage",
              "value": "=---"
            },
            {
              "name": "welcomeMessageUsernameNotExist",
              "value": "=---"
            },
            {
              "name": "welcomeMessageUsernameAdded",
              "value": "=---."
            }
          ],
          "number": [
            {
              "name": "adminId",
              "value": -1001229874701
            },
            {
              "name": "channelId",
              "value": -1001700527084
            },
            {
              "name": "moderationPeriod",
              "value": 25
            },
            {
              "name": "logChatId",
              "value": 1096005889
            }
          ]
        },
        "options": {}
      },
      "id": "e6bc43a7-18ee-4a0e-86a4-290899f63b26",
      "name": "Set",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        820,
        300
      ]
    }
  ],
  "connections": {
    "select users": {
      "main": [
        [
          {
            "node": "HTTP Request1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Cron": {
      "main": [
        [
          {
            "node": "Set",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set": {
      "main": [
        [
          {
            "node": "select users",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Information on your n8n setup

  • 190
  • postgreSQL
  • main, workerA, workerB
  • web app
1 Like

Hi @krynble, could you perhaps help out with this one, seeing the error seems to come from bull? Thank you!

More details:

id:2505034
url:n8n.io - Workflow Automation
error
message:job stalled more than maxStalledCount
stack:Error: job stalled more than maxStalledCount\n at Queue.onFailed (/usr/local/lib/node_modules/n8n/node_modules/bull/lib/job.js:516:18)\n at Queue.emit (node:events:513:28)\n at Queue.emit (node:domain:489:12)\n at Redis.messageHandler (/usr/local/lib/node_modules/n8n/node_modules/bull/lib/queue.js:444:14)\n at Redis.emit (node:events:513:28)\n at Redis.emit (node:domain:489:12)\n at DataHandler.handleSubscriberReply (/usr/local/lib/node_modules/n8n/node_modules/ioredis/built/DataHandler.js:80:32)\n at DataHandler.returnReply (/usr/local/lib/node_modules/n8n/node_modules/ioredis/built/DataHandler.js:47:18)\n at JavascriptRedisParser.returnReply (/usr/local/lib/node_modules/n8n/node_modules/ioredis/built/DataHandler.js:21:22)\n at JavascriptRedisParser.execute (/usr/local/lib/node_modules/n8n/node_modules/redis-parser/lib/parser.js:544:14)\n at Socket. (/usr/local/lib/node_modules/n8n/node_modules/ioredis/built/DataHandler.js:25:20)\n at Socket.emit (node:events:513:28)\n at Socket.emit (node:domain:489:12)\n at addChunk (node:internal/streams/readable:315:12)\n at readableAddChunk (node:internal/streams/readable:289:9)\n at Socket.Readable.push (node:internal/streams/readable:228:10)\n at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
mode:trigger

Hey @Andrey_Sudnik

This error comes from Bull, the library we use to handle the queue.

There is an explanation about Stalled jobs that can be found here: Welcome to Bull’s Guide | Premium Queue package for handling distributed jobs and messages in NodeJS..

This may come from 2 possible reasons:

  1. You are executing a workflow that runs for too long, with cpu intensive work causing the event loop to be too busy so that it’s not responding back to bull or
  2. You workers are overwhelmed with things to run, effectively causing the same issue as above, but instead of a single cpu intensive job, there are multiple

I would suggest checking your worker’s health and perhaps increasing the count.

1 Like

Ah another possibility that just came to my mind is that a worker might pick up the job, start working on it and crash for any reason (maybe out of memory).

When that happens, until another worker picks it up, the job may be considered stalled since n8n (and Bull) cannot say for sure what happened to that running job.

1 Like

Thank you! Now I know what I can try to do

I just created a github issue on this error. Queue Mode out of memory with sufficient ressources · Issue #4867 · n8n-io/n8n · GitHub
Sadly I have no idea how to get rid of it in detail. Like mentioned in github is was no problem on regular setup without queue mode.

As I understand the queue is somehow overwhelmet with the input, but why is there no setting available to let it do batches of x one after another?