n8n - 💡(How to fix) Fix Task runner grant token TTL (15s) too short for low-power hardware — causes 100%+ CPU retry loop [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
n8n-io/n8n#28638Fetched 2026-04-18 05:56:53
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Timeline (top)
commented ×1labeled ×1mentioned ×1subscribed ×1

Root Cause

On low-power hardware (Intel N150, 4 cores), the external task runner consistently fails to authenticate with the task broker because the grant token expires before the runner process can spawn and connect.

Fix Action

Fix / Workaround

Current workaround

Volume-mount a patched task-broker-auth.service.js with a higher TTL:

volumes:
  - ./patches/task-broker-auth.service.js:/usr/local/lib/node_modules/n8n/dist/task-runners/task-broker/auth/task-broker-auth.service.js:ro

Code Example

const GRANT_TOKEN_TTL = 15 * constants_1.Time.seconds.toMilliseconds;

---

volumes:
  - ./patches/task-broker-auth.service.js:/usr/local/lib/node_modules/n8n/dist/task-runners/task-broker/auth/task-broker-auth.service.js:ro
RAW_BUFFERClick to expand / collapse

Bug Description

On low-power hardware (Intel N150, 4 cores), the external task runner consistently fails to authenticate with the task broker because the grant token expires before the runner process can spawn and connect.

The grant token TTL is hardcoded to 15 seconds in task-broker-auth.service.js:

const GRANT_TOKEN_TTL = 15 * constants_1.Time.seconds.toMilliseconds;

There is no environment variable or configuration option to change this value.

On slower hardware, the runner takes >15s to:

  1. Receive the grant token from the broker
  2. Spawn the Node.js/Python process
  3. Establish the WebSocket upgrade using the token

This causes a tight retry loop:

  • Broker issues grant token → token expires before runner connects → 403 → broker issues new token → repeat
  • The retry loop consumes 100%+ CPU continuously, making the entire system unusable
  • Both internal and external runners are affected identically

To Reproduce

  1. Deploy n8n v2.14.2 with an external task runner on low-power hardware (Intel N150, Celeron, Atom, or similar)
  2. Trigger any workflow that uses a Code node
  3. Observe the runner failing with 403 errors in a tight loop
  4. CPU usage spikes to 100%+ and stays there

Expected behavior

  • The grant token TTL should be configurable via an environment variable (e.g., N8N_RUNNERS_GRANT_TOKEN_TTL=120)
  • The default of 15 seconds is reasonable for fast hardware, but there should be a way to increase it for slower systems
  • Alternatively, the runner could use a backoff strategy instead of tight retries on 403

Current workaround

Volume-mount a patched task-broker-auth.service.js with a higher TTL:

volumes:
  - ./patches/task-broker-auth.service.js:/usr/local/lib/node_modules/n8n/dist/task-runners/task-broker/auth/task-broker-auth.service.js:ro

This is fragile and breaks on version updates.

Debug Info

  • n8nVersion: 2.14.2
  • platform: docker (self-hosted)
  • database: PostgreSQL
  • executionMode: main (default)
  • hardware: Intel N150 (4 cores, 12GB RAM)
  • runner mode: external (n8nio/runners:2.14.2)

Operating System

Linux (Debian 12)

n8n Version

2.14.2

Node.js Version

22.x

Database

PostgreSQL

Execution mode

main (default)

Hosting

self hosted

extent analysis

TL;DR

Increase the grant token TTL to a higher value, such as 120 seconds, to accommodate slower hardware and prevent token expiration before the runner process can connect.

Guidance

  • Identify the current grant token TTL value in task-broker-auth.service.js and consider increasing it to a higher value, such as 120 seconds, to accommodate slower hardware.
  • Implement a backoff strategy for the runner to handle 403 errors instead of tight retries, which can help reduce CPU usage and prevent the system from becoming unusable.
  • Consider adding an environment variable, such as N8N_RUNNERS_GRANT_TOKEN_TTL, to make the grant token TTL configurable and avoid hardcoding the value.
  • Test the workaround of volume-mounting a patched task-broker-auth.service.js with a higher TTL, but be aware that this solution is fragile and may break on version updates.

Example

// Example of increasing the grant token TTL in task-broker-auth.service.js
const GRANT_TOKEN_TTL = 120 * constants_1.Time.seconds.toMilliseconds;

Notes

The current workaround of volume-mounting a patched task-broker-auth.service.js is fragile and may break on version updates. A more robust solution would be to add an environment variable to make the grant token TTL configurable.

Recommendation

Apply a workaround by increasing the grant token TTL to a higher value, such as 120 seconds, to accommodate slower hardware and prevent token expiration before the runner process can connect. This can be done by patching the task-broker-auth.service.js file or by adding an environment variable to make the grant token TTL configurable.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

  • The grant token TTL should be configurable via an environment variable (e.g., N8N_RUNNERS_GRANT_TOKEN_TTL=120)
  • The default of 15 seconds is reasonable for fast hardware, but there should be a way to increase it for slower systems
  • Alternatively, the runner could use a backoff strategy instead of tight retries on 403

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

n8n - 💡(How to fix) Fix Task runner grant token TTL (15s) too short for low-power hardware — causes 100%+ CPU retry loop [1 comments, 2 participants]